Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ✅ NEW: failing test * 🐛 FIX: duplicated documents (#6282) * 💡 DOC: add a bit of doc around project flag * 👌 FIX: prettier * doc: wording fix * Create fifty-jars-end.md Co-authored-by: Charly POLY <1252066+charlypoly@users.noreply.github.com>
- Loading branch information
1 parent
9e735ea
commit dfd9f07
Showing
7 changed files
with
128 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@graphql-codegen/cli": patch | ||
--- | ||
|
||
Fix/multi project |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
packages/graphql-codegen-cli/tests/test-files/graphql.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/** @type {import('graphql-config').IGraphQLConfig } */ | ||
module.exports = { | ||
generates: {}, | ||
projects: { | ||
prj1: { | ||
schema: ['**/test-documents/schema.graphql'], | ||
documents: ['**/test-documents/valid.graphql'], | ||
extensions: { | ||
codegen: { | ||
generates: { | ||
'graphqlTypes.ts': { | ||
schema: ['**/test-documents/schema.graphql'], | ||
documents: ['**/test-documents/valid.graphql'], | ||
plugins: ['typed-document-node'], | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
--- | ||
id: multiproject-config | ||
title: 'Multi Project' | ||
--- | ||
|
||
In some cases, it's useful to have multiple projects in the same config file. | ||
|
||
For example, in a monorepo, the VSCode GraphQL plugin will automatically pick up the right config for the right folder. | ||
|
||
<p> </p> | ||
|
||
--- | ||
|
||
<p> </p> | ||
|
||
## Configuration file format | ||
|
||
Here's an example for a possible config file `graphql.config.js`: | ||
|
||
```js | ||
/** @type {import('graphql-config').IGraphQLConfig } */ | ||
module.exports = { | ||
projects: { | ||
prj1: { | ||
schema: ['prj1/**/*.graphql'], | ||
documents: ['prj1/**/*.gql'], | ||
extensions: { | ||
codegen: { | ||
generates: { | ||
'graphqlTypes.ts': { | ||
plugins: ['typescript', 'typed-document-node'] | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
prj2: { | ||
schema: ['prj2/**/*.graphql'], | ||
documents: ['prj2/**/*.gql'], | ||
extensions: { | ||
codegen: { | ||
generates: { | ||
'graphqlTypes.ts': { | ||
plugins: ['typescript', 'typed-document-node'] | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
|
||
<p> </p> | ||
|
||
## Command to generate files | ||
|
||
With the previous config, you can generate files with the following command: | ||
|
||
```bash | ||
graphql-codegen --config graphql.config.js -project prj1 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dfd9f07
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
graphql-code-generator – ./
graphql-code-generator.vercel.app
graphql-code-generator-theguild.vercel.app
graphql-code-generator-git-master-theguild.vercel.app
graphql-codegen.com
graphql-code-generator.com
www.graphql-code-generator.com
www.graphql-codegen.com