0.0.0-alpha.1 • Published 12 months ago
nx-graphql-codegen v0.0.0-alpha.1
Contents
Features
- Use
graphql-codegen
to generate code from GraphQL Schemas.
Installing
Using pnpm:
pnpm add -D nx-graphql-codegen
npm install -D nx-graphql-codegen
yarn add -D nx-graphql-codegen
Peer Dependencies
Name | Version | Required |
---|---|---|
nx | >=15.7.1 | ✅ |
@graphql-codgen/cli | >=2.16.1 | ✅ |
Executors
codegen
Run graphql-codegen.
"targets": {
"codegen": {
"executor": "nx-graphql-codegen:codegen",
"options": {
"config": "libs/my-lib/codegen.ts",
},
},
}
Name | Type | Required | Default | Description |
---|---|---|---|---|
config | string | ✅ | - | Path to GraphQL codegen YAML config file, defaults to codegen.yml on the current directory. |
debug | boolean | - | false | Display debugging info by applying the DEBUG env variable. |
overwrite | boolean | - | true | Overwrites existing files. |
profile | boolean | - | false | Use profiler to measure performance. |
project | string | - | | Name of a project in GraphQL Config. | |
require | string[] | - | [] | Loads specific require.extensions before running the codegen and reading the configuration. |
silent | boolean | - | false | Suppresses printing errors. |
watch | boolean | - | false | Watch for changes and execute generation automatically. |
Generators
codegen
Generate a target to run a graphql-codegen.
nx generate nx-graphql-codegen:codegen dev --project=my-app --config='packages/my-lib/codegen.ts'
> NX Generating nx-graphql-codegen:codegen
UPDATE libs/my-lib/project.json
Name | Alias | Type | Required | Default | Description |
---|---|---|---|---|---|
config | - | string | ✅ | - | Path to GraphQL codegen YAML config file, defaults to codegen.yml on the current directory. |
name | - | string | ✅ | - | Target name. |
project | - | string | ✅ | - | What project does the target belong to? |
Examples
Name | Path |
---|---|
typescript-operations | examples/typescript-operations |
Compatibility
nx-graphql-codegen | Nx |
---|---|
^0.0.0 | ^15.7.1 |
Credits
This plugin wouldn't be possible without the great teams behind these projects:
- The Guild - The team behind GraphQL Codegen.
- Nrwl - The team behind Nx
Please show them your support! ❤️
0.0.0-alpha.1
12 months ago