Skip to content

Instantly share code, notes, and snippets.

@eddsaura
Last active December 3, 2021 10:14
Show Gist options
  • Save eddsaura/e4cd25081d9e4013f787da1c3d396606 to your computer and use it in GitHub Desktop.
Save eddsaura/e4cd25081d9e4013f787da1c3d396606 to your computer and use it in GitHub Desktop.
Installation of graphql-codegen
//Obviously before we need graphql
yarn add graphql
// Installation
yarn add -D @graphql-codegen/cli @graphql-codegen/typescript @graphql-codegen/typescript-operations @graphql-codegen/introspection @graphql-codegen/typescript-react-apollo
// Initiate
yarn graphql-codegen init
// script
"generate": "graphql-codegen --config codegen.yml
/**
* codegen.yml
**/
overwrite: true
schema: "https://url.with.schema/graphql/"
documents: "graphql/**/*.ts"
generates:
generated/graphql.tsx:
plugins:
- "typescript"
- "typescript-operations"
- "typescript-react-apollo"
./graphql.schema.json:
plugins:
- "introspection"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment