@soda-gql/cli 0.12.3 → 0.12.5

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.
package/dist/index.cjs CHANGED
@@ -617,7 +617,8 @@ const parseSchemaArgs = (argv) => {
617
617
  kind: "generate",
618
618
  schemas,
619
619
  outPath: (0, node_path.resolve)(config.outdir, "index.ts"),
620
- importExtension: config.styles.importExtension
620
+ importExtension: config.styles.importExtension,
621
+ chunkSize: config.codegen.chunkSize
621
622
  });
622
623
  };
623
624
  const formatSuccess$2 = (success) => {
@@ -669,7 +670,8 @@ const schemaCommand = async (argv) => {
669
670
  schemas: resolvedSchemas,
670
671
  outPath: (0, node_path.resolve)(command.outPath),
671
672
  format: "human",
672
- importExtension: command.importExtension
673
+ importExtension: command.importExtension,
674
+ chunkSize: command.chunkSize
673
675
  });
674
676
  if (result.isErr()) return (0, neverthrow.err)(cliErrors.fromCodegen(result.error));
675
677
  return (0, neverthrow.ok)({
@@ -773,6 +775,7 @@ const unifiedCodegen = async (argv) => {
773
775
  outPath: (0, node_path.resolve)(config.outdir, "index.ts"),
774
776
  format: "human",
775
777
  importExtension: config.styles.importExtension,
778
+ chunkSize: config.codegen.chunkSize,
776
779
  preloadedSchemas: schemaDocuments
777
780
  });
778
781
  if (codegenResult.isErr()) return (0, neverthrow.err)(cliErrors.fromCodegen(codegenResult.error));
@@ -1325,7 +1328,9 @@ const formatResultMessage = (data) => {
1325
1328
  const files = data.unformatted.map((f) => ` ${f}`).join("\n");
1326
1329
  return `${data.unformatted.length} file(s) need formatting:\n${files}`;
1327
1330
  }
1328
- return `All ${data.total} file(s) are properly formatted`;
1331
+ const msg = `All ${data.total} file(s) are properly formatted`;
1332
+ if (data.errors > 0) return `${msg} (${data.errors} file(s) had parse errors)`;
1333
+ return msg;
1329
1334
  }
1330
1335
  const parts = [];
1331
1336
  if (data.modified > 0) parts.push(`${data.modified} formatted`);
@@ -1359,10 +1364,10 @@ const FORMAT_HELP = `Usage: soda-gql format [patterns...] [options]
1359
1364
  Format soda-gql field selections by inserting empty comments.
1360
1365
 
1361
1366
  Options:
1362
- --config <path> Path to soda-gql.config.ts (auto-detected if omitted)
1363
- --check Check if files need formatting (exit 1 if unformatted)
1364
- --inject-fragment-keys Inject unique keys into anonymous fragments
1365
- --help, -h Show this help message
1367
+ --config <path> Path to soda-gql.config.ts (auto-detected if omitted)
1368
+ --check Check if files need formatting (exit 1 if unformatted)
1369
+ --inject-fragment-keys Inject unique keys into anonymous fragments
1370
+ --help, -h Show this help message
1366
1371
 
1367
1372
  Examples:
1368
1373
  soda-gql format # Use config include/exclude
@@ -1434,10 +1439,13 @@ const formatCommand = async (argv) => {
1434
1439
  errors++;
1435
1440
  continue;
1436
1441
  }
1437
- if (result.value.modified) {
1442
+ if (result.value.modified) try {
1438
1443
  await (0, node_fs_promises.writeFile)(filePath, result.value.sourceCode, "utf-8");
1439
1444
  modified++;
1440
- } else unchanged++;
1445
+ } catch {
1446
+ errors++;
1447
+ }
1448
+ else unchanged++;
1441
1449
  }
1442
1450
  }
1443
1451
  const data = {
@@ -1447,7 +1455,7 @@ const formatCommand = async (argv) => {
1447
1455
  unchanged,
1448
1456
  errors,
1449
1457
  unformatted,
1450
- hasFormattingIssues: isCheckMode && unformatted.length > 0 || errors > 0
1458
+ hasFormattingIssues: isCheckMode ? unformatted.length > 0 || errors > 0 : errors > 0
1451
1459
  };
1452
1460
  return (0, neverthrow.ok)({
1453
1461
  message: formatResultMessage(data),