@soda-gql/cli 0.12.2 → 0.12.4
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 +22 -11
- package/dist/index.cjs.map +1 -1
- package/package.json +8 -8
package/dist/index.cjs
CHANGED
|
@@ -352,7 +352,8 @@ const FormatArgsSchema = zod.z.object({
|
|
|
352
352
|
_: zod.z.array(zod.z.string()).optional(),
|
|
353
353
|
config: zod.z.string().optional(),
|
|
354
354
|
check: zod.z.boolean().optional(),
|
|
355
|
-
"inject-fragment-keys": zod.z.boolean().optional()
|
|
355
|
+
"inject-fragment-keys": zod.z.boolean().optional(),
|
|
356
|
+
"format-tagged-templates": zod.z.boolean().optional()
|
|
356
357
|
});
|
|
357
358
|
const InitArgsSchema = zod.z.object({ force: zod.z.boolean().optional() });
|
|
358
359
|
const TypegenArgsSchema = zod.z.object({
|
|
@@ -617,7 +618,8 @@ const parseSchemaArgs = (argv) => {
|
|
|
617
618
|
kind: "generate",
|
|
618
619
|
schemas,
|
|
619
620
|
outPath: (0, node_path.resolve)(config.outdir, "index.ts"),
|
|
620
|
-
importExtension: config.styles.importExtension
|
|
621
|
+
importExtension: config.styles.importExtension,
|
|
622
|
+
chunkSize: config.codegen.chunkSize
|
|
621
623
|
});
|
|
622
624
|
};
|
|
623
625
|
const formatSuccess$2 = (success) => {
|
|
@@ -669,7 +671,8 @@ const schemaCommand = async (argv) => {
|
|
|
669
671
|
schemas: resolvedSchemas,
|
|
670
672
|
outPath: (0, node_path.resolve)(command.outPath),
|
|
671
673
|
format: "human",
|
|
672
|
-
importExtension: command.importExtension
|
|
674
|
+
importExtension: command.importExtension,
|
|
675
|
+
chunkSize: command.chunkSize
|
|
673
676
|
});
|
|
674
677
|
if (result.isErr()) return (0, neverthrow.err)(cliErrors.fromCodegen(result.error));
|
|
675
678
|
return (0, neverthrow.ok)({
|
|
@@ -773,6 +776,7 @@ const unifiedCodegen = async (argv) => {
|
|
|
773
776
|
outPath: (0, node_path.resolve)(config.outdir, "index.ts"),
|
|
774
777
|
format: "human",
|
|
775
778
|
importExtension: config.styles.importExtension,
|
|
779
|
+
chunkSize: config.codegen.chunkSize,
|
|
776
780
|
preloadedSchemas: schemaDocuments
|
|
777
781
|
});
|
|
778
782
|
if (codegenResult.isErr()) return (0, neverthrow.err)(cliErrors.fromCodegen(codegenResult.error));
|
|
@@ -1359,10 +1363,11 @@ const FORMAT_HELP = `Usage: soda-gql format [patterns...] [options]
|
|
|
1359
1363
|
Format soda-gql field selections by inserting empty comments.
|
|
1360
1364
|
|
|
1361
1365
|
Options:
|
|
1362
|
-
--config <path>
|
|
1363
|
-
--check
|
|
1364
|
-
--inject-fragment-keys
|
|
1365
|
-
--
|
|
1366
|
+
--config <path> Path to soda-gql.config.ts (auto-detected if omitted)
|
|
1367
|
+
--check Check if files need formatting (exit 1 if unformatted)
|
|
1368
|
+
--inject-fragment-keys Inject unique keys into anonymous fragments
|
|
1369
|
+
--format-tagged-templates Format GraphQL in tagged templates
|
|
1370
|
+
--help, -h Show this help message
|
|
1366
1371
|
|
|
1367
1372
|
Examples:
|
|
1368
1373
|
soda-gql format # Use config include/exclude
|
|
@@ -1377,6 +1382,7 @@ const formatCommand = async (argv) => {
|
|
|
1377
1382
|
const args = parsed.value;
|
|
1378
1383
|
const isCheckMode = args.check === true;
|
|
1379
1384
|
const injectFragmentKeys = args["inject-fragment-keys"] === true;
|
|
1385
|
+
const formatTaggedTemplates = args["format-tagged-templates"] === true;
|
|
1380
1386
|
const explicitPatterns = args._ ?? [];
|
|
1381
1387
|
let targetPatterns;
|
|
1382
1388
|
let excludePatterns = [];
|
|
@@ -1414,7 +1420,8 @@ const formatCommand = async (argv) => {
|
|
|
1414
1420
|
if (isCheckMode) {
|
|
1415
1421
|
const result = formatter.needsFormat({
|
|
1416
1422
|
sourceCode,
|
|
1417
|
-
filePath
|
|
1423
|
+
filePath,
|
|
1424
|
+
formatTaggedTemplates
|
|
1418
1425
|
});
|
|
1419
1426
|
if (result.isErr()) {
|
|
1420
1427
|
errors++;
|
|
@@ -1428,16 +1435,20 @@ const formatCommand = async (argv) => {
|
|
|
1428
1435
|
const result = formatter.format({
|
|
1429
1436
|
sourceCode,
|
|
1430
1437
|
filePath,
|
|
1431
|
-
injectFragmentKeys
|
|
1438
|
+
injectFragmentKeys,
|
|
1439
|
+
formatTaggedTemplates
|
|
1432
1440
|
});
|
|
1433
1441
|
if (result.isErr()) {
|
|
1434
1442
|
errors++;
|
|
1435
1443
|
continue;
|
|
1436
1444
|
}
|
|
1437
|
-
if (result.value.modified) {
|
|
1445
|
+
if (result.value.modified) try {
|
|
1438
1446
|
await (0, node_fs_promises.writeFile)(filePath, result.value.sourceCode, "utf-8");
|
|
1439
1447
|
modified++;
|
|
1440
|
-
}
|
|
1448
|
+
} catch {
|
|
1449
|
+
errors++;
|
|
1450
|
+
}
|
|
1451
|
+
else unchanged++;
|
|
1441
1452
|
}
|
|
1442
1453
|
}
|
|
1443
1454
|
const data = {
|