@soda-gql/cli 0.12.0 → 0.12.2
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 +18 -6
- package/dist/index.cjs.map +1 -1
- package/package.json +8 -8
package/dist/index.cjs
CHANGED
|
@@ -33,12 +33,12 @@ let node_path = require("node:path");
|
|
|
33
33
|
let __soda_gql_builder = require("@soda-gql/builder");
|
|
34
34
|
let __soda_gql_config = require("@soda-gql/config");
|
|
35
35
|
let __soda_gql_codegen = require("@soda-gql/codegen");
|
|
36
|
+
let __soda_gql_typegen = require("@soda-gql/typegen");
|
|
36
37
|
let __soda_gql_common = require("@soda-gql/common");
|
|
37
38
|
let fast_glob = require("fast-glob");
|
|
38
39
|
fast_glob = __toESM(fast_glob);
|
|
39
40
|
let zod = require("zod");
|
|
40
41
|
let node_fs = require("node:fs");
|
|
41
|
-
let __soda_gql_typegen = require("@soda-gql/typegen");
|
|
42
42
|
|
|
43
43
|
//#region packages/cli/src/errors.ts
|
|
44
44
|
/**
|
|
@@ -691,15 +691,16 @@ const schemaCommand = async (argv) => {
|
|
|
691
691
|
const CODEGEN_HELP = `Usage: soda-gql codegen [subcommand] [options]
|
|
692
692
|
|
|
693
693
|
When run without a subcommand, executes the full pipeline:
|
|
694
|
-
codegen graphql (if configured) → codegen schema
|
|
694
|
+
codegen graphql (if configured) → codegen schema → typegen
|
|
695
695
|
|
|
696
696
|
Subcommands:
|
|
697
697
|
schema Generate graphql-system runtime module from schema
|
|
698
698
|
graphql Generate compat code from .graphql operation files
|
|
699
699
|
|
|
700
700
|
Options:
|
|
701
|
-
--config <path>
|
|
702
|
-
--
|
|
701
|
+
--config <path> Path to soda-gql.config.ts
|
|
702
|
+
--skip-typegen Skip prebuilt type generation in unified pipeline
|
|
703
|
+
--help, -h Show this help message
|
|
703
704
|
`;
|
|
704
705
|
/**
|
|
705
706
|
* Check if argv contains legacy schema-specific flags.
|
|
@@ -784,6 +785,14 @@ const unifiedCodegen = async (argv) => {
|
|
|
784
785
|
const writeResult = await writeGeneratedFiles(compatFiles.value.files);
|
|
785
786
|
if (writeResult.isErr()) return (0, neverthrow.err)(writeResult.error);
|
|
786
787
|
}
|
|
788
|
+
if (!argv.includes("--skip-typegen")) {
|
|
789
|
+
const typegenResult = await (0, __soda_gql_typegen.runTypegen)({ config });
|
|
790
|
+
if (typegenResult.isErr()) return (0, neverthrow.err)(cliErrors.fromTypegen(typegenResult.error));
|
|
791
|
+
const { fragmentCount, operationCount, skippedFragmentCount, warnings: typegenWarnings } = typegenResult.value;
|
|
792
|
+
const skippedNote = skippedFragmentCount > 0 ? ` (${skippedFragmentCount} skipped)` : "";
|
|
793
|
+
messages.push(`[typegen] Generated ${fragmentCount} fragment(s)${skippedNote} and ${operationCount} operation(s)`);
|
|
794
|
+
for (const w of typegenWarnings) messages.push(` warning: ${w}`);
|
|
795
|
+
}
|
|
787
796
|
return (0, neverthrow.ok)({ message: messages.join("\n") });
|
|
788
797
|
};
|
|
789
798
|
/**
|
|
@@ -8377,7 +8386,8 @@ const executeRegenerate = async (config, state, changedPaths) => {
|
|
|
8377
8386
|
if (result.isOk()) {
|
|
8378
8387
|
state.generation++;
|
|
8379
8388
|
console.log(`[typegen] Done in ${elapsed}ms`);
|
|
8380
|
-
|
|
8389
|
+
const skippedNote = result.value.skippedFragmentCount > 0 ? ` (${result.value.skippedFragmentCount} skipped)` : "";
|
|
8390
|
+
console.log(` Fragments: ${result.value.fragmentCount}${skippedNote}, Operations: ${result.value.operationCount}`);
|
|
8381
8391
|
if (result.value.warnings.length > 0) {
|
|
8382
8392
|
console.log(` Warnings: ${result.value.warnings.length}`);
|
|
8383
8393
|
for (const warning of result.value.warnings.slice(0, 3)) console.log(` - ${warning}`);
|
|
@@ -8485,7 +8495,8 @@ const formatSuccess = (data) => {
|
|
|
8485
8495
|
const lines = [];
|
|
8486
8496
|
lines.push(`Generated prebuilt types:`);
|
|
8487
8497
|
lines.push(` Types: ${data.prebuiltTypesPath}`);
|
|
8488
|
-
|
|
8498
|
+
const skippedNote = data.skippedFragmentCount > 0 ? ` (${data.skippedFragmentCount} skipped)` : "";
|
|
8499
|
+
lines.push(` Fragments: ${data.fragmentCount}${skippedNote}, Operations: ${data.operationCount}`);
|
|
8489
8500
|
if (data.warnings.length > 0) {
|
|
8490
8501
|
lines.push("");
|
|
8491
8502
|
lines.push("Warnings:");
|
|
@@ -8531,6 +8542,7 @@ const typegenCommand = async (argv) => {
|
|
|
8531
8542
|
prebuiltTypesPath: result.value.prebuiltTypesPath,
|
|
8532
8543
|
fragmentCount: result.value.fragmentCount,
|
|
8533
8544
|
operationCount: result.value.operationCount,
|
|
8545
|
+
skippedFragmentCount: result.value.skippedFragmentCount,
|
|
8534
8546
|
warnings: result.value.warnings
|
|
8535
8547
|
};
|
|
8536
8548
|
return (0, neverthrow.ok)({
|