@soda-gql/cli 0.12.4 → 0.12.6
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 +7 -10
- package/dist/index.cjs.map +1 -1
- package/package.json +9 -8
package/dist/index.cjs
CHANGED
|
@@ -352,8 +352,7 @@ 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()
|
|
356
|
-
"format-tagged-templates": zod.z.boolean().optional()
|
|
355
|
+
"inject-fragment-keys": zod.z.boolean().optional()
|
|
357
356
|
});
|
|
358
357
|
const InitArgsSchema = zod.z.object({ force: zod.z.boolean().optional() });
|
|
359
358
|
const TypegenArgsSchema = zod.z.object({
|
|
@@ -1329,7 +1328,9 @@ const formatResultMessage = (data) => {
|
|
|
1329
1328
|
const files = data.unformatted.map((f) => ` ${f}`).join("\n");
|
|
1330
1329
|
return `${data.unformatted.length} file(s) need formatting:\n${files}`;
|
|
1331
1330
|
}
|
|
1332
|
-
|
|
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;
|
|
1333
1334
|
}
|
|
1334
1335
|
const parts = [];
|
|
1335
1336
|
if (data.modified > 0) parts.push(`${data.modified} formatted`);
|
|
@@ -1366,7 +1367,6 @@ Options:
|
|
|
1366
1367
|
--config <path> Path to soda-gql.config.ts (auto-detected if omitted)
|
|
1367
1368
|
--check Check if files need formatting (exit 1 if unformatted)
|
|
1368
1369
|
--inject-fragment-keys Inject unique keys into anonymous fragments
|
|
1369
|
-
--format-tagged-templates Format GraphQL in tagged templates
|
|
1370
1370
|
--help, -h Show this help message
|
|
1371
1371
|
|
|
1372
1372
|
Examples:
|
|
@@ -1382,7 +1382,6 @@ const formatCommand = async (argv) => {
|
|
|
1382
1382
|
const args = parsed.value;
|
|
1383
1383
|
const isCheckMode = args.check === true;
|
|
1384
1384
|
const injectFragmentKeys = args["inject-fragment-keys"] === true;
|
|
1385
|
-
const formatTaggedTemplates = args["format-tagged-templates"] === true;
|
|
1386
1385
|
const explicitPatterns = args._ ?? [];
|
|
1387
1386
|
let targetPatterns;
|
|
1388
1387
|
let excludePatterns = [];
|
|
@@ -1420,8 +1419,7 @@ const formatCommand = async (argv) => {
|
|
|
1420
1419
|
if (isCheckMode) {
|
|
1421
1420
|
const result = formatter.needsFormat({
|
|
1422
1421
|
sourceCode,
|
|
1423
|
-
filePath
|
|
1424
|
-
formatTaggedTemplates
|
|
1422
|
+
filePath
|
|
1425
1423
|
});
|
|
1426
1424
|
if (result.isErr()) {
|
|
1427
1425
|
errors++;
|
|
@@ -1435,8 +1433,7 @@ const formatCommand = async (argv) => {
|
|
|
1435
1433
|
const result = formatter.format({
|
|
1436
1434
|
sourceCode,
|
|
1437
1435
|
filePath,
|
|
1438
|
-
injectFragmentKeys
|
|
1439
|
-
formatTaggedTemplates
|
|
1436
|
+
injectFragmentKeys
|
|
1440
1437
|
});
|
|
1441
1438
|
if (result.isErr()) {
|
|
1442
1439
|
errors++;
|
|
@@ -1458,7 +1455,7 @@ const formatCommand = async (argv) => {
|
|
|
1458
1455
|
unchanged,
|
|
1459
1456
|
errors,
|
|
1460
1457
|
unformatted,
|
|
1461
|
-
hasFormattingIssues: isCheckMode
|
|
1458
|
+
hasFormattingIssues: isCheckMode ? unformatted.length > 0 || errors > 0 : errors > 0
|
|
1462
1459
|
};
|
|
1463
1460
|
return (0, neverthrow.ok)({
|
|
1464
1461
|
message: formatResultMessage(data),
|