Skip to content

Instantly share code, notes, and snippets.

@hrdtbs
Last active May 7, 2022 16:54
Show Gist options
  • Save hrdtbs/35b10260301f5beb944136e855f71623 to your computer and use it in GitHub Desktop.
Save hrdtbs/35b10260301f5beb944136e855f71623 to your computer and use it in GitHub Desktop.
Easy way to use Github GraphQL API with graphql-codegen
overwrite: true
schema: 'https://docs.github.com/public/schema.docs.graphql'
documents: 'src/**/*.graphql'
generates:
src/__generated__/graphql.ts:
plugins:
- typescript
- typescript-operations
- typescript-react-query
config:
skipTypename: true
fetcher:
endpoint: 'https://api.github.com/graphql'
isReactHook: true
fetchParams: >
{
headers: {
"Authorization": `Bearer ${process.env.GITHUB_TOKEN}`
}
}
./graphql.schema.json:
plugins:
- 'introspection'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment