GraphQL Code Generator plugin for generating documents.
- with NPM
npm install --save graphql-codegen-documents
- with Yarn:
yarn add graphql-codegen-documents
NOTE: This plugin is meant to run independently before other plugins that need to use documents
.
For example, in your package.json
scripts, add:
{
"gen": "graphql-codegen -c {your-graphql-codegen-documents-config-file}.yaml && graphql-codegen"
}
and in your your-graphql-codegen-documents-config-file
:
schema:
- path/to/schema.graphql
documents:
- path/to/my-custom-documents.graphql
generates:
path/to/generated-docs.graphql:
plugins:
- graphql-codegen-documents
config:
recursionLimit: 7
and then your other plugins
schema:
- path/to/schema.graphql
documents:
- path/to/my-custom-documents.graphql
- path/to/generated-documents.graphql
generates:
# Other plugins
- Allow to use user defined documents.
- Currently all documents will be generated from scratch.
- Allow to use
directives
(https://www.apollographql.com/docs/graphql-tools/schema-directives/). - Add tests