@graphql-codegen/cli 6.0.0-alpha-20250702094259-330e4c0c023358d9861caa216bc6e850fd799b01 → 6.0.0-alpha-20250805122041-8da92a5b216bd44d4db5eb263c456c54aaf2233b

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -104,13 +104,17 @@ async function generate(input, saveToFile = true) {
104
104
  }
105
105
  const { result: outputFiles, error } = await context.profiler.run(() => (0, codegen_js_1.executeCodegen)(context), 'executeCodegen');
106
106
  if (error) {
107
- if (config.writeOnPartialSuccess) {
108
- (0, logger_js_1.getLogger)().warn(` ${log_symbols_1.default.warning} One or more errors occurred. Successful generation wrote to files.`);
107
+ // If all generation failed, just throw to return non-zero code.
108
+ if (outputFiles.length === 0) {
109
+ throw error;
109
110
  }
110
- else {
111
- (0, logger_js_1.getLogger)().error(` ${log_symbols_1.default.error} One or more errors occurred. No output was written to files.`);
111
+ // If partial success, but partial output is not allowed, throw to return non-zero code.
112
+ if (!config.allowPartialOutputs) {
113
+ (0, logger_js_1.getLogger)().error(` ${log_symbols_1.default.error} One or more errors occurred, no files were generated. To allow output on errors, set config.allowPartialOutputs=true`);
112
114
  throw error;
113
115
  }
116
+ // If partial success, and partial output is allowed, warn and proceed to write to files.
117
+ (0, logger_js_1.getLogger)().warn(` ${log_symbols_1.default.warning} One or more errors occurred, some files were generated. To prevent any output on errors, set config.allowPartialOutputs=false`);
114
118
  }
115
119
  await context.profiler.run(() => writeOutput(outputFiles), 'writeOutput');
116
120
  await context.profiler.run(() => (0, hooks_js_1.lifecycleHooks)(config.hooks).beforeDone(), 'Lifecycle: beforeDone');
@@ -100,13 +100,17 @@ export async function generate(input, saveToFile = true) {
100
100
  }
101
101
  const { result: outputFiles, error } = await context.profiler.run(() => executeCodegen(context), 'executeCodegen');
102
102
  if (error) {
103
- if (config.writeOnPartialSuccess) {
104
- getLogger().warn(` ${logSymbols.warning} One or more errors occurred. Successful generation wrote to files.`);
103
+ // If all generation failed, just throw to return non-zero code.
104
+ if (outputFiles.length === 0) {
105
+ throw error;
105
106
  }
106
- else {
107
- getLogger().error(` ${logSymbols.error} One or more errors occurred. No output was written to files.`);
107
+ // If partial success, but partial output is not allowed, throw to return non-zero code.
108
+ if (!config.allowPartialOutputs) {
109
+ getLogger().error(` ${logSymbols.error} One or more errors occurred, no files were generated. To allow output on errors, set config.allowPartialOutputs=true`);
108
110
  throw error;
109
111
  }
112
+ // If partial success, and partial output is allowed, warn and proceed to write to files.
113
+ getLogger().warn(` ${logSymbols.warning} One or more errors occurred, some files were generated. To prevent any output on errors, set config.allowPartialOutputs=false`);
110
114
  }
111
115
  await context.profiler.run(() => writeOutput(outputFiles), 'writeOutput');
112
116
  await context.profiler.run(() => lifecycleHooks(config.hooks).beforeDone(), 'Lifecycle: beforeDone');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-codegen/cli",
3
- "version": "6.0.0-alpha-20250702094259-330e4c0c023358d9861caa216bc6e850fd799b01",
3
+ "version": "6.0.0-alpha-20250805122041-8da92a5b216bd44d4db5eb263c456c54aaf2233b",
4
4
  "peerDependenciesMeta": {
5
5
  "@parcel/watcher": {
6
6
  "optional": true
@@ -14,9 +14,9 @@
14
14
  "@babel/generator": "^7.18.13",
15
15
  "@babel/template": "^7.18.10",
16
16
  "@babel/types": "^7.18.13",
17
- "@graphql-codegen/client-preset": "4.8.4-alpha-20250702094259-330e4c0c023358d9861caa216bc6e850fd799b01",
18
- "@graphql-codegen/core": "4.0.3-alpha-20250702094259-330e4c0c023358d9861caa216bc6e850fd799b01",
19
- "@graphql-codegen/plugin-helpers": "6.0.0-alpha-20250702094259-330e4c0c023358d9861caa216bc6e850fd799b01",
17
+ "@graphql-codegen/client-preset": "4.8.4-alpha-20250805122041-8da92a5b216bd44d4db5eb263c456c54aaf2233b",
18
+ "@graphql-codegen/core": "4.0.3-alpha-20250805122041-8da92a5b216bd44d4db5eb263c456c54aaf2233b",
19
+ "@graphql-codegen/plugin-helpers": "6.0.0-alpha-20250805122041-8da92a5b216bd44d4db5eb263c456c54aaf2233b",
20
20
  "@graphql-tools/apollo-engine-loader": "^8.0.0",
21
21
  "@graphql-tools/code-file-loader": "^8.0.0",
22
22
  "@graphql-tools/git-loader": "^8.0.0",