-
Notifications
You must be signed in to change notification settings - Fork 1.4k
CODEGEN-834 - [cli] Handle partial generation success #10376
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: federation-fixes
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 90126ec The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
c000be1
to
9c57b83
Compare
🚀 Snapshot Release (
|
Package | Version | Info |
---|---|---|
@graphql-codegen/cli |
6.0.0-alpha-20250702094259-330e4c0c023358d9861caa216bc6e850fd799b01 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/core |
4.0.3-alpha-20250702094259-330e4c0c023358d9861caa216bc6e850fd799b01 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/add |
5.0.4-alpha-20250702094259-330e4c0c023358d9861caa216bc6e850fd799b01 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/fragment-matcher |
5.1.1-alpha-20250702094259-330e4c0c023358d9861caa216bc6e850fd799b01 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/introspection |
4.0.4-alpha-20250702094259-330e4c0c023358d9861caa216bc6e850fd799b01 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/schema-ast |
4.1.1-alpha-20250702094259-330e4c0c023358d9861caa216bc6e850fd799b01 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/time |
5.0.2-alpha-20250702094259-330e4c0c023358d9861caa216bc6e850fd799b01 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/visitor-plugin-common |
6.0.0-alpha-20250702094259-330e4c0c023358d9861caa216bc6e850fd799b01 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/typescript-document-nodes |
4.0.17-alpha-20250702094259-330e4c0c023358d9861caa216bc6e850fd799b01 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/gql-tag-operations |
4.0.18-alpha-20250702094259-330e4c0c023358d9861caa216bc6e850fd799b01 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/typescript-operations |
4.6.2-alpha-20250702094259-330e4c0c023358d9861caa216bc6e850fd799b01 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/typescript-resolvers |
5.0.0-alpha-20250702094259-330e4c0c023358d9861caa216bc6e850fd799b01 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/typed-document-node |
5.1.3-alpha-20250702094259-330e4c0c023358d9861caa216bc6e850fd799b01 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/typescript |
4.1.7-alpha-20250702094259-330e4c0c023358d9861caa216bc6e850fd799b01 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/client-preset |
4.8.4-alpha-20250702094259-330e4c0c023358d9861caa216bc6e850fd799b01 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/graphql-modules-preset |
4.0.18-alpha-20250702094259-330e4c0c023358d9861caa216bc6e850fd799b01 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/testing |
3.0.5-alpha-20250702094259-330e4c0c023358d9861caa216bc6e850fd799b01 |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/plugin-helpers |
6.0.0-alpha-20250702094259-330e4c0c023358d9861caa216bc6e850fd799b01 |
npm ↗︎ unpkg ↗︎ |
💻 Website PreviewThe latest changes are available as preview in: https://pr-10376.graphql-code-generator.pages.dev |
c0ce057
to
330e4c0
Compare
@@ -78,7 +78,10 @@ export const createWatcher = ( | |||
const debouncedExec = debounce(() => { | |||
if (!isShutdown) { | |||
executeCodegen(initialContext) | |||
.then(onNext, () => Promise.resolve()) | |||
.then( | |||
({ result }) => onNext(result), |
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.
Previously, partial success in watch mode doesn't write to files.
With this new no-throw-on-error implementation in watch mode, partial success always write to files.
Users primarily use watch mode only during development, so I think this is fine. They are already seeing something like "✔ Generate to ./src/graphql/types.generated.ts", which can be interpreted as something has been generated (check image below)

website/public/config.schema.json
Outdated
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.
I had an issue and thought running the command to update this would help 🤔
I think this file is only updated at build time before publishing the website. Maybe we don't have to track it?
Anyways, this should keep it up-to-date until we decide to ignore it (or not)
@@ -40,7 +40,7 @@ export default config | |||
|
|||
## Configuration options | |||
|
|||
Here are the supported options that you can define in the config file (see [source code](https://github.com/dotansimha/graphql-code-generator/blob/master/packages/utils/plugins-helpers/src/types.ts#L92)): | |||
Here are the supported options that you can define in the config file (see [source code](https://github.com/dotansimha/graphql-code-generator/blob/master/packages/utils/plugins-helpers/src/types.ts#L388)): |
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.
I noticed the line number changed on master, so this updates it to point to the right Config
type
Description
Introduce
allowPartialOutputs
to allow users to write partial success to files.This is a breaking change because we change how
executeCodegen
function works (exposed and can be imported): previously if anygenerates
fails, it'd throw. Now, it will return the error and output files as result and let the caller decide what to do with them.The main caller of
executeCodegen
is the CLI and it (1.) throws if there is complete failure or (2) useallowPartialOutputs
to write on partial success or notRelated #9701
Type of change
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration