@graphql-codegen/cli@3.1.0
Minor Changes
-
#8893
a118c307a
Thanks @n1ru4l! - It is no longer mandatory to declare an empty plugins array when using a preset -
#8723
a3309e63e
Thanks @kazekyo! - Introduce a new feature called DocumentTransform.DocumentTransform is a functionality that allows you to modify
documents
before they are processed by plugins. You can use functions passed to thedocumentTransforms
option to make changes to GraphQL documents.To use this feature, you can write
documentTransforms
as follows:import type { CodegenConfig } from '@graphql-codegen/cli'; const config: CodegenConfig = { schema: 'https://localhost:4000/graphql', documents: ['src/**/*.tsx'], generates: { './src/gql/': { preset: 'client', documentTransforms: [ { transform: ({ documents }) => { // Make some changes to the documents return documents; }, }, ], }, }, }; export default config;
For instance, to remove a
@localOnlyDirective
directive fromdocuments
, you can write the following code:import type { CodegenConfig } from '@graphql-codegen/cli'; import { visit } from 'graphql'; const config: CodegenConfig = { schema: 'https://localhost:4000/graphql', documents: ['src/**/*.tsx'], generates: { './src/gql/': { preset: 'client', documentTransforms: [ { transform: ({ documents }) => { return documents.map(documentFile => { documentFile.document = visit(documentFile.document, { Directive: { leave(node) { if (node.name.value === 'localOnlyDirective') return null; }, }, }); return documentFile; }); }, }, ], }, }, }; export default config;
DocumentTransform can also be specified by file name. You can create a custom file for a specific transformation and pass it to
documentTransforms
.Let's create the document transform as a file:
module.exports = { transform: ({ documents }) => { // Make some changes to the documents return documents; }, };
Then, you can specify the file name as follows:
import type { CodegenConfig } from '@graphql-codegen/cli'; const config: CodegenConfig = { schema: 'https://localhost:4000/graphql', documents: ['src/**/*.tsx'], generates: { './src/gql/': { preset: 'client', documentTransforms: ['./my-document-transform.js'], }, }, }; export default config;
Patch Changes
- #9000
4c422ccf6
Thanks @renovate! - dependencies updates:- Updated dependency
@whatwg-node/fetch@^0.8.0
↗︎ (from^0.6.0
, independencies
)
- Updated dependency
- Updated dependencies [
8206b268d
,8206b268d
,a118c307a
,a3309e63e
]:- @graphql-codegen/core@3.1.0
- @graphql-codegen/plugin-helpers@4.1.0
@graphql-codegen/core@3.1.0
Minor Changes
-
#8723
a3309e63e
Thanks @kazekyo! - Introduce a new feature called DocumentTransform.DocumentTransform is a functionality that allows you to modify
documents
before they are processed by plugins. You can use functions passed to thedocumentTransforms
option to make changes to GraphQL documents.To use this feature, you can write
documentTransforms
as follows:import type { CodegenConfig } from '@graphql-codegen/cli'; const config: CodegenConfig = { schema: 'https://localhost:4000/graphql', documents: ['src/**/*.tsx'], generates: { './src/gql/': { preset: 'client', documentTransforms: [ { transform: ({ documents }) => { // Make some changes to the documents return documents; }, }, ], }, }, }; export default config;
For instance, to remove a
@localOnlyDirective
directive fromdocuments
, you can write the following code:import type { CodegenConfig } from '@graphql-codegen/cli'; import { visit } from 'graphql'; const config: CodegenConfig = { schema: 'https://localhost:4000/graphql', documents: ['src/**/*.tsx'], generates: { './src/gql/': { preset: 'client', documentTransforms: [ { transform: ({ documents }) => { return documents.map(documentFile => { documentFile.document = visit(documentFile.document, { Directive: { leave(node) { if (node.name.value === 'localOnlyDirective') return null; }, }, }); return documentFile; }); }, }, ], }, }, }; export default config;
DocumentTransform can also be specified by file name. You can create a custom file for a specific transformation and pass it to
documentTransforms
.Let's create the document transform as a file:
module.exports = { transform: ({ documents }) => { // Make some changes to the documents return documents; }, };
Then, you can specify the file name as follows:
import type { CodegenConfig } from '@graphql-codegen/cli'; const config: CodegenConfig = { schema: 'https://localhost:4000/graphql', documents: ['src/**/*.tsx'], generates: { './src/gql/': { preset: 'client', documentTransforms: ['./my-document-transform.js'], }, }, }; export default config;
Patch Changes
- #8879
8206b268d
Thanks @renovate! - dependencies updates:- Updated dependency
tslib@~2.5.0
↗︎ (from~2.4.0
, independencies
)
- Updated dependency
- Updated dependencies [
8206b268d
,a118c307a
,a3309e63e
]:- @graphql-codegen/plugin-helpers@4.1.0
@graphql-codegen/typescript-resolvers@3.1.0
Minor Changes
- #8853
b13aa7449
Thanks @KGAdamCook! - Updated customResolveInfo to use the correct importType for external imports
Patch Changes
- #8879
8206b268d
Thanks @renovate! - dependencies updates:- Updated dependency
tslib@~2.5.0
↗︎ (from~2.4.0
, independencies
)
- Updated dependency
- Updated dependencies [
8206b268d
,8206b268d
,8206b268d
,a118c307a
,6b6fe3cbc
,a3309e63e
]:- @graphql-codegen/plugin-helpers@4.1.0
- @graphql-codegen/typescript@3.0.1
- @graphql-codegen/visitor-plugin-common@3.0.1
@graphql-codegen/client-preset@2.1.0
Minor Changes
-
#8893
a118c307a
Thanks @n1ru4l! - It is no longer mandatory to declare an empty plugins array when using a preset -
#8723
a3309e63e
Thanks @kazekyo! - Introduce a new feature called DocumentTransform.DocumentTransform is a functionality that allows you to modify
documents
before they are processed by plugins. You can use functions passed to thedocumentTransforms
option to make changes to GraphQL documents.To use this feature, you can write
documentTransforms
as follows:import type { CodegenConfig } from '@graphql-codegen/cli'; const config: CodegenConfig = { schema: 'https://localhost:4000/graphql', documents: ['src/**/*.tsx'], generates: { './src/gql/': { preset: 'client', documentTransforms: [ { transform: ({ documents }) => { // Make some changes to the documents return documents; }, }, ], }, }, }; export default config;
For instance, to remove a
@localOnlyDirective
directive fromdocuments
, you can write the following code:import type { CodegenConfig } from '@graphql-codegen/cli'; import { visit } from 'graphql'; const config: CodegenConfig = { schema: 'https://localhost:4000/graphql', documents: ['src/**/*.tsx'], generates: { './src/gql/': { preset: 'client', documentTransforms: [ { transform: ({ documents }) => { return documents.map(documentFile => { documentFile.document = visit(documentFile.document, { Directive: { leave(node) { if (node.name.value === 'localOnlyDirective') return null; }, }, }); return documentFile; }); }, }, ], }, }, }; export default config;
DocumentTransform can also be specified by file name. You can create a custom file for a specific transformation and pass it to
documentTransforms
.Let's create the document transform as a file:
module.exports = { transform: ({ documents }) => { // Make some changes to the documents return documents; }, };
Then, you can specify the file name as follows:
import type { CodegenConfig } from '@graphql-codegen/cli'; const config: CodegenConfig = { schema: 'https://localhost:4000/graphql', documents: ['src/**/*.tsx'], generates: { './src/gql/': { preset: 'client', documentTransforms: ['./my-document-transform.js'], }, }, }; export default config;
Patch Changes
-
#8879
8206b268d
Thanks @renovate! - dependencies updates:- Updated dependency
tslib@~2.5.0
↗︎ (from~2.4.0
, independencies
)
- Updated dependency
-
#8995
fe2e9c7a5
Thanks @charpeni! - UsegqlTagName
for generated examples -
#8971
6b6fe3cbc
Thanks @n1ru4l! - Allow passing fragment documents to APIs like ApollosreadFragment
-
Updated dependencies [
8206b268d
,8206b268d
,8206b268d
,8206b268d
,8206b268d
,8206b268d
,8206b268d
,a118c307a
,fe2e9c7a5
,6b6fe3cbc
,6b6fe3cbc
,a3309e63e
]:- @graphql-codegen/add@4.0.1
- @graphql-codegen/gql-tag-operations@2.0.1
- @graphql-codegen/plugin-helpers@4.1.0
- @graphql-codegen/typed-document-node@3.0.1
- @graphql-codegen/typescript@3.0.1
- @graphql-codegen/typescript-operations@3.0.1
- @graphql-codegen/visitor-plugin-common@3.0.1
@graphql-codegen/gql-tag-operations-preset@2.1.0
Minor Changes
-
#8893
a118c307a
Thanks @n1ru4l! - It is no longer mandatory to declare an empty plugins array when using a preset -
#8723
a3309e63e
Thanks @kazekyo! - Introduce a new feature called DocumentTransform.DocumentTransform is a functionality that allows you to modify
documents
before they are processed by plugins. You can use functions passed to thedocumentTransforms
option to make changes to GraphQL documents.To use this feature, you can write
documentTransforms
as follows:import type { CodegenConfig } from '@graphql-codegen/cli'; const config: CodegenConfig = { schema: 'https://localhost:4000/graphql', documents: ['src/**/*.tsx'], generates: { './src/gql/': { preset: 'client', documentTransforms: [ { transform: ({ documents }) => { // Make some changes to the documents return documents; }, }, ], }, }, }; export default config;
For instance, to remove a
@localOnlyDirective
directive fromdocuments
, you can write the following code:import type { CodegenConfig } from '@graphql-codegen/cli'; import { visit } from 'graphql'; const config: CodegenConfig = { schema: 'https://localhost:4000/graphql', documents: ['src/**/*.tsx'], generates: { './src/gql/': { preset: 'client', documentTransforms: [ { transform: ({ documents }) => { return documents.map(documentFile => { documentFile.document = visit(documentFile.document, { Directive: { leave(node) { if (node.name.value === 'localOnlyDirective') return null; }, }, }); return documentFile; }); }, }, ], }, }, }; export default config;
DocumentTransform can also be specified by file name. You can create a custom file for a specific transformation and pass it to
documentTransforms
.Let's create the document transform as a file:
module.exports = { transform: ({ documents }) => { // Make some changes to the documents return documents; }, };
Then, you can specify the file name as follows:
import type { CodegenConfig } from '@graphql-codegen/cli'; const config: CodegenConfig = { schema: 'https://localhost:4000/graphql', documents: ['src/**/*.tsx'], generates: { './src/gql/': { preset: 'client', documentTransforms: ['./my-document-transform.js'], }, }, }; export default config;
Patch Changes
- #8879
8206b268d
Thanks @renovate! - dependencies updates:- Updated dependency
tslib@~2.5.0
↗︎ (from~2.4.0
, independencies
)
- Updated dependency
- Updated dependencies [
8206b268d
,8206b268d
,8206b268d
,8206b268d
,8206b268d
,8206b268d
,8206b268d
,a118c307a
,fe2e9c7a5
,6b6fe3cbc
,6b6fe3cbc
,a3309e63e
]:- @graphql-codegen/add@4.0.1
- @graphql-codegen/gql-tag-operations@2.0.1
- @graphql-codegen/plugin-helpers@4.1.0
- @graphql-codegen/typed-document-node@3.0.1
- @graphql-codegen/typescript@3.0.1
- @graphql-codegen/typescript-operations@3.0.1
- @graphql-codegen/visitor-plugin-common@3.0.1
@graphql-codegen/graphql-modules-preset@3.1.0
Minor Changes
-
#8723
a3309e63e
Thanks @kazekyo! - Introduce a new feature called DocumentTransform.DocumentTransform is a functionality that allows you to modify
documents
before they are processed by plugins. You can use functions passed to thedocumentTransforms
option to make changes to GraphQL documents.To use this feature, you can write
documentTransforms
as follows:import type { CodegenConfig } from '@graphql-codegen/cli'; const config: CodegenConfig = { schema: 'https://localhost:4000/graphql', documents: ['src/**/*.tsx'], generates: { './src/gql/': { preset: 'client', documentTransforms: [ { transform: ({ documents }) => { // Make some changes to the documents return documents; }, }, ], }, }, }; export default config;
For instance, to remove a
@localOnlyDirective
directive fromdocuments
, you can write the following code:import type { CodegenConfig } from '@graphql-codegen/cli'; import { visit } from 'graphql'; const config: CodegenConfig = { schema: 'https://localhost:4000/graphql', documents: ['src/**/*.tsx'], generates: { './src/gql/': { preset: 'client', documentTransforms: [ { transform: ({ documents }) => { return documents.map(documentFile => { documentFile.document = visit(documentFile.document, { Directive: { leave(node) { if (node.name.value === 'localOnlyDirective') return null; }, }, }); return documentFile; }); }, }, ], }, }, }; export default config;
DocumentTransform can also be specified by file name. You can create a custom file for a specific transformation and pass it to
documentTransforms
.Let's create the document transform as a file:
module.exports = { transform: ({ documents }) => { // Make some changes to the documents return documents; }, };
Then, you can specify the file name as follows:
import type { CodegenConfig } from '@graphql-codegen/cli'; const config: CodegenConfig = { schema: 'https://localhost:4000/graphql', documents: ['src/**/*.tsx'], generates: { './src/gql/': { preset: 'client', documentTransforms: ['./my-document-transform.js'], }, }, }; export default config;
Patch Changes
- #8879
8206b268d
Thanks @renovate! - dependencies updates:- Updated dependency
tslib@~2.5.0
↗︎ (from~2.4.0
, independencies
)
- Updated dependency
- Updated dependencies [
8206b268d
,8206b268d
,a118c307a
,6b6fe3cbc
,a3309e63e
]:- @graphql-codegen/plugin-helpers@4.1.0
- @graphql-codegen/visitor-plugin-common@3.0.1
@graphql-codegen/plugin-helpers@4.1.0
Minor Changes
-
#8893
a118c307a
Thanks @n1ru4l! - markplugins
in config optional -
#8723
a3309e63e
Thanks @kazekyo! - Introduce a new feature called DocumentTransform.DocumentTransform is a functionality that allows you to modify
documents
before they are processed by plugins. You can use functions passed to thedocumentTransforms
option to make changes to GraphQL documents.To use this feature, you can write
documentTransforms
as follows:import type { CodegenConfig } from '@graphql-codegen/cli'; const config: CodegenConfig = { schema: 'https://localhost:4000/graphql', documents: ['src/**/*.tsx'], generates: { './src/gql/': { preset: 'client', documentTransforms: [ { transform: ({ documents }) => { // Make some changes to the documents return documents; }, }, ], }, }, }; export default config;
For instance, to remove a
@localOnlyDirective
directive fromdocuments
, you can write the following code:import type { CodegenConfig } from '@graphql-codegen/cli'; import { visit } from 'graphql'; const config: CodegenConfig = { schema: 'https://localhost:4000/graphql', documents: ['src/**/*.tsx'], generates: { './src/gql/': { preset: 'client', documentTransforms: [ { transform: ({ documents }) => { return documents.map(documentFile => { documentFile.document = visit(documentFile.document, { Directive: { leave(node) { if (node.name.value === 'localOnlyDirective') return null; }, }, }); return documentFile; }); }, }, ], }, }, }; export default config;
DocumentTransform can also be specified by file name. You can create a custom file for a specific transformation and pass it to
documentTransforms
.Let's create the document transform as a file:
module.exports = { transform: ({ documents }) => { // Make some changes to the documents return documents; }, };
Then, you can specify the file name as follows:
import type { CodegenConfig } from '@graphql-codegen/cli'; const config: CodegenConfig = { schema: 'https://localhost:4000/graphql', documents: ['src/**/*.tsx'], generates: { './src/gql/': { preset: 'client', documentTransforms: ['./my-document-transform.js'], }, }, }; export default config;
Patch Changes
- #8879
8206b268d
Thanks @renovate! - dependencies updates:- Updated dependency
tslib@~2.5.0
↗︎ (from~2.4.0
, independencies
)
- Updated dependency
@graphql-cli/codegen@3.0.1
Patch Changes
@graphql-codegen/add@4.0.1
Patch Changes
- #8879
8206b268d
Thanks @renovate! - dependencies updates:- Updated dependency
tslib@~2.5.0
↗︎ (from~2.4.0
, independencies
)
- Updated dependency
- Updated dependencies [
8206b268d
,a118c307a
,a3309e63e
]:- @graphql-codegen/plugin-helpers@4.1.0
@graphql-codegen/fragment-matcher@4.0.1
Patch Changes
- #8879
8206b268d
Thanks @renovate! - dependencies updates:- Updated dependency
tslib@~2.5.0
↗︎ (from~2.4.0
, independencies
)
- Updated dependency
- Updated dependencies [
8206b268d
,a118c307a
,a3309e63e
]:- @graphql-codegen/plugin-helpers@4.1.0
@graphql-codegen/introspection@3.0.1
Patch Changes
- #8879
8206b268d
Thanks @renovate! - dependencies updates:- Updated dependency
tslib@~2.5.0
↗︎ (from~2.4.0
, independencies
)
- Updated dependency
- Updated dependencies [
8206b268d
,8206b268d
,a118c307a
,6b6fe3cbc
,a3309e63e
]:- @graphql-codegen/plugin-helpers@4.1.0
- @graphql-codegen/visitor-plugin-common@3.0.1
@graphql-codegen/schema-ast@3.0.1
Patch Changes
- #8879
8206b268d
Thanks @renovate! - dependencies updates:- Updated dependency
tslib@~2.5.0
↗︎ (from~2.4.0
, independencies
)
- Updated dependency
- Updated dependencies [
8206b268d
,a118c307a
,a3309e63e
]:- @graphql-codegen/plugin-helpers@4.1.0
@graphql-codegen/visitor-plugin-common@3.0.1
Patch Changes
-
#8879
8206b268d
Thanks @renovate! - dependencies updates:- Updated dependency
tslib@~2.5.0
↗︎ (from~2.4.0
, independencies
)
- Updated dependency
-
#8971
6b6fe3cbc
Thanks @n1ru4l! - Always inline referenced fragments within their document. This prevents issues with duplicated fragments or missing fragments. -
Updated dependencies [
8206b268d
,a118c307a
,a3309e63e
]:- @graphql-codegen/plugin-helpers@4.1.0
@graphql-codegen/typescript-document-nodes@3.0.1
Patch Changes
- #8879
8206b268d
Thanks @renovate! - dependencies updates:- Updated dependency
tslib@~2.5.0
↗︎ (from~2.4.0
, independencies
)
- Updated dependency
- Updated dependencies [
8206b268d
,8206b268d
,a118c307a
,6b6fe3cbc
,a3309e63e
]:- @graphql-codegen/plugin-helpers@4.1.0
- @graphql-codegen/visitor-plugin-common@3.0.1
@graphql-codegen/gql-tag-operations@2.0.1
Patch Changes
-
#8879
8206b268d
Thanks @renovate! - dependencies updates:- Updated dependency
tslib@~2.5.0
↗︎ (from~2.4.0
, independencies
)
- Updated dependency
-
#8995
fe2e9c7a5
Thanks @charpeni! - UsegqlTagName
for generated examples -
Updated dependencies [
8206b268d
,8206b268d
,a118c307a
,6b6fe3cbc
,a3309e63e
]:- @graphql-codegen/plugin-helpers@4.1.0
- @graphql-codegen/visitor-plugin-common@3.0.1
@graphql-codegen/typescript-operations@3.0.1
Patch Changes
- #8879
8206b268d
Thanks @renovate! - dependencies updates:- Updated dependency
tslib@~2.5.0
↗︎ (from~2.4.0
, independencies
)
- Updated dependency
- Updated dependencies [
8206b268d
,8206b268d
,8206b268d
,a118c307a
,6b6fe3cbc
,a3309e63e
]:- @graphql-codegen/plugin-helpers@4.1.0
- @graphql-codegen/typescript@3.0.1
- @graphql-codegen/visitor-plugin-common@3.0.1
@graphql-codegen/typed-document-node@3.0.1
Patch Changes
-
#8879
8206b268d
Thanks @renovate! - dependencies updates:- Updated dependency
tslib@~2.5.0
↗︎ (from~2.4.0
, independencies
)
- Updated dependency
-
#8971
6b6fe3cbc
Thanks @n1ru4l! - Allow passing fragment documents to APIs like ApollosreadFragment
-
Updated dependencies [
8206b268d
,8206b268d
,a118c307a
,6b6fe3cbc
,a3309e63e
]:- @graphql-codegen/plugin-helpers@4.1.0
- @graphql-codegen/visitor-plugin-common@3.0.1
@graphql-codegen/typescript@3.0.1
Patch Changes
- #8879
8206b268d
Thanks @renovate! - dependencies updates:- Updated dependency
tslib@~2.5.0
↗︎ (from~2.4.0
, independencies
)
- Updated dependency
- Updated dependencies [
8206b268d
,8206b268d
,8206b268d
,a118c307a
,6b6fe3cbc
,a3309e63e
]:- @graphql-codegen/plugin-helpers@4.1.0
- @graphql-codegen/schema-ast@3.0.1
- @graphql-codegen/visitor-plugin-common@3.0.1