@xylabs/ts-scripts-yarn3 7.4.9 → 7.4.11
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/actions/claude-commands.mjs +99 -0
- package/dist/actions/claude-commands.mjs.map +1 -0
- package/dist/actions/claude-rules.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/checkPackage.mjs +115 -16
- package/dist/actions/deplint/checkPackage/checkPackage.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/getUnusedDependencies.mjs +2 -1
- package/dist/actions/deplint/checkPackage/getUnusedDependencies.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/getUnusedDevDependencies.mjs +114 -20
- package/dist/actions/deplint/checkPackage/getUnusedDevDependencies.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/getUnusedPeerDependencies.mjs +2 -1
- package/dist/actions/deplint/checkPackage/getUnusedPeerDependencies.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/index.mjs +115 -16
- package/dist/actions/deplint/checkPackage/index.mjs.map +1 -1
- package/dist/actions/deplint/deplint.mjs +166 -38
- package/dist/actions/deplint/deplint.mjs.map +1 -1
- package/dist/actions/deplint/getCliReferencedPackagesFromFiles.mjs +140 -0
- package/dist/actions/deplint/getCliReferencedPackagesFromFiles.mjs.map +1 -0
- package/dist/actions/deplint/getScriptReferencedPackages.mjs +3 -1
- package/dist/actions/deplint/getScriptReferencedPackages.mjs.map +1 -1
- package/dist/actions/deplint/index.mjs +166 -38
- package/dist/actions/deplint/index.mjs.map +1 -1
- package/dist/actions/index.mjs +368 -180
- package/dist/actions/index.mjs.map +1 -1
- package/dist/bin/xy.mjs +356 -134
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.d.ts +27 -2
- package/dist/index.mjs +398 -194
- package/dist/index.mjs.map +1 -1
- package/dist/lib/claudeMdTemplate.mjs +12 -0
- package/dist/lib/claudeMdTemplate.mjs.map +1 -1
- package/dist/lib/index.mjs +12 -0
- package/dist/lib/index.mjs.map +1 -1
- package/dist/xy/index.mjs +356 -134
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/xy.mjs +356 -134
- package/dist/xy/xy.mjs.map +1 -1
- package/dist/xy/xyCommonCommands.mjs +122 -34
- package/dist/xy/xyCommonCommands.mjs.map +1 -1
- package/dist/xy/xyLintCommands.mjs +205 -71
- package/dist/xy/xyLintCommands.mjs.map +1 -1
- package/package.json +2 -2
- package/templates/commands/xylabs-build.md +5 -0
- package/templates/commands/xylabs-clean.md +5 -0
- package/templates/commands/xylabs-compile.md +5 -0
- package/templates/commands/xylabs-cycle.md +5 -0
- package/templates/commands/xylabs-deplint.md +5 -0
- package/templates/commands/xylabs-deploy-major.md +7 -0
- package/templates/commands/xylabs-deploy-minor.md +7 -0
- package/templates/commands/xylabs-deploy.md +7 -0
- package/templates/commands/xylabs-fix.md +5 -0
- package/templates/commands/xylabs-knip.md +5 -0
- package/templates/commands/xylabs-lint.md +5 -0
- package/templates/commands/xylabs-publint.md +5 -0
- package/templates/commands/xylabs-rebuild.md +5 -0
- package/templates/commands/xylabs-test.md +5 -0
package/dist/bin/xy.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/xy/xy.ts
|
|
4
|
-
import
|
|
4
|
+
import chalk29 from "chalk";
|
|
5
5
|
|
|
6
6
|
// src/actions/build.ts
|
|
7
|
-
import
|
|
7
|
+
import chalk8 from "chalk";
|
|
8
8
|
|
|
9
9
|
// src/lib/checkResult.ts
|
|
10
10
|
import chalk from "chalk";
|
|
@@ -27,6 +27,7 @@ var require2 = createRequire(import.meta.url);
|
|
|
27
27
|
var packageRoot = PATH.dirname(require2.resolve("@xylabs/ts-scripts-yarn3/package.json"));
|
|
28
28
|
var templatesDir = PATH.resolve(packageRoot, "templates");
|
|
29
29
|
var XYLABS_RULES_PREFIX = "xylabs-";
|
|
30
|
+
var XYLABS_COMMANDS_PREFIX = "xylabs-";
|
|
30
31
|
var claudeMdRuleTemplates = () => {
|
|
31
32
|
const rulesDir = PATH.resolve(templatesDir, "rules");
|
|
32
33
|
const files = readdirSync(rulesDir).filter((f) => f.startsWith(XYLABS_RULES_PREFIX) && f.endsWith(".md"));
|
|
@@ -36,6 +37,15 @@ var claudeMdRuleTemplates = () => {
|
|
|
36
37
|
}
|
|
37
38
|
return result;
|
|
38
39
|
};
|
|
40
|
+
var claudeCommandTemplates = () => {
|
|
41
|
+
const commandsDir = PATH.resolve(templatesDir, "commands");
|
|
42
|
+
const files = readdirSync(commandsDir).filter((f) => f.startsWith(XYLABS_COMMANDS_PREFIX) && f.endsWith(".md"));
|
|
43
|
+
const result = {};
|
|
44
|
+
for (const file of files) {
|
|
45
|
+
result[file] = readFileSync(PATH.resolve(commandsDir, file), "utf8");
|
|
46
|
+
}
|
|
47
|
+
return result;
|
|
48
|
+
};
|
|
39
49
|
var claudeMdProjectTemplate = () => readFileSync(PATH.resolve(templatesDir, "CLAUDE-project.md"), "utf8");
|
|
40
50
|
|
|
41
51
|
// src/lib/deleteGlob.ts
|
|
@@ -316,10 +326,31 @@ var generateIgnoreFiles = (filename3, pkg) => {
|
|
|
316
326
|
return succeeded ? 0 : 1;
|
|
317
327
|
};
|
|
318
328
|
|
|
329
|
+
// src/lib/loadConfig.ts
|
|
330
|
+
import chalk5 from "chalk";
|
|
331
|
+
import { cosmiconfig } from "cosmiconfig";
|
|
332
|
+
import { TypeScriptLoader } from "cosmiconfig-typescript-loader";
|
|
333
|
+
import deepmerge from "deepmerge";
|
|
334
|
+
var config;
|
|
335
|
+
var loadConfig = async (params) => {
|
|
336
|
+
if (config === void 0) {
|
|
337
|
+
const cosmicConfigResult = await cosmiconfig("xy", { cache: true, loaders: { ".ts": TypeScriptLoader() } }).search();
|
|
338
|
+
config = cosmicConfigResult?.config;
|
|
339
|
+
const configFilePath = cosmicConfigResult?.filepath;
|
|
340
|
+
if (configFilePath !== void 0) {
|
|
341
|
+
console.log(chalk5.green(`Loaded config from ${configFilePath}`));
|
|
342
|
+
if (config.verbose) {
|
|
343
|
+
console.log(chalk5.gray(`${JSON.stringify(config, null, 2)}`));
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
return deepmerge(config, params ?? {});
|
|
348
|
+
};
|
|
349
|
+
|
|
319
350
|
// src/lib/parsedPackageJSON.ts
|
|
320
351
|
import { readFileSync as readFileSync3 } from "fs";
|
|
321
|
-
var parsedPackageJSON = (
|
|
322
|
-
const pathToPackageJSON =
|
|
352
|
+
var parsedPackageJSON = (path8) => {
|
|
353
|
+
const pathToPackageJSON = path8 ?? process.env.npm_package_json ?? "";
|
|
323
354
|
const packageJSON = readFileSync3(pathToPackageJSON).toString();
|
|
324
355
|
return JSON.parse(packageJSON);
|
|
325
356
|
};
|
|
@@ -327,22 +358,22 @@ var parsedPackageJSON = (path7) => {
|
|
|
327
358
|
// src/lib/runSteps.ts
|
|
328
359
|
import { spawnSync as spawnSync3 } from "child_process";
|
|
329
360
|
import { existsSync as existsSync2 } from "fs";
|
|
330
|
-
import
|
|
361
|
+
import chalk6 from "chalk";
|
|
331
362
|
var runSteps = (name, steps, exitOnFail = true, messages) => {
|
|
332
363
|
return safeExit(() => {
|
|
333
364
|
const pkgName = process.env.npm_package_name;
|
|
334
|
-
console.log(
|
|
365
|
+
console.log(chalk6.green(`${name} [${pkgName}]`));
|
|
335
366
|
let totalStatus = 0;
|
|
336
|
-
for (const [i, [command, args,
|
|
367
|
+
for (const [i, [command, args, config2]] of steps.entries()) {
|
|
337
368
|
if (messages?.[i]) {
|
|
338
|
-
console.log(
|
|
369
|
+
console.log(chalk6.gray(messages?.[i]));
|
|
339
370
|
}
|
|
340
371
|
const argList = Array.isArray(args) ? args : args.split(" ");
|
|
341
372
|
if (command === "node" && !existsSync2(argList[0])) {
|
|
342
373
|
throw new Error(`File not found [${argList[0]}]`);
|
|
343
374
|
}
|
|
344
375
|
const status = spawnSync3(command, Array.isArray(args) ? args : args.split(" "), {
|
|
345
|
-
...
|
|
376
|
+
...config2,
|
|
346
377
|
encoding: "utf8",
|
|
347
378
|
env: { FORCE_COLOR: "3", ...process.env },
|
|
348
379
|
shell: true,
|
|
@@ -358,27 +389,27 @@ var runSteps = (name, steps, exitOnFail = true, messages) => {
|
|
|
358
389
|
// src/lib/runStepsAsync.ts
|
|
359
390
|
import { spawn } from "child_process";
|
|
360
391
|
import { existsSync as existsSync3 } from "fs";
|
|
361
|
-
import
|
|
392
|
+
import chalk7 from "chalk";
|
|
362
393
|
var runStepAsync = (name, step, exitOnFail = true, message) => {
|
|
363
394
|
return new Promise((resolve) => {
|
|
364
|
-
const [command, args,
|
|
395
|
+
const [command, args, config2] = step;
|
|
365
396
|
if (message) {
|
|
366
|
-
console.log(
|
|
397
|
+
console.log(chalk7.gray(message));
|
|
367
398
|
}
|
|
368
399
|
const argList = Array.isArray(args) ? args : args.split(" ");
|
|
369
400
|
if (command === "node" && !existsSync3(argList[0])) {
|
|
370
401
|
throw new Error(`File not found [${argList[0]}]`);
|
|
371
402
|
}
|
|
372
403
|
spawn(command, Array.isArray(args) ? args : args.split(" "), {
|
|
373
|
-
...
|
|
404
|
+
...config2,
|
|
374
405
|
env: { FORCE_COLOR: "3", ...process.env },
|
|
375
406
|
shell: true,
|
|
376
407
|
stdio: "inherit"
|
|
377
408
|
}).on("close", (code) => {
|
|
378
409
|
if (code) {
|
|
379
410
|
console.error(
|
|
380
|
-
|
|
381
|
-
`Command Exited With Non-Zero Result [${
|
|
411
|
+
chalk7.red(
|
|
412
|
+
`Command Exited With Non-Zero Result [${chalk7.gray(code)}] | ${chalk7.yellow(command)} ${chalk7.white(
|
|
382
413
|
Array.isArray(args) ? args.join(" ") : args
|
|
383
414
|
)}`
|
|
384
415
|
)
|
|
@@ -394,7 +425,7 @@ var runStepAsync = (name, step, exitOnFail = true, message) => {
|
|
|
394
425
|
var runStepsAsync = async (name, steps, exitOnFail = true, messages) => {
|
|
395
426
|
return await safeExitAsync(async () => {
|
|
396
427
|
const pkgName = process.env.npm_package_name;
|
|
397
|
-
console.log(
|
|
428
|
+
console.log(chalk7.green(`${name} [${pkgName}]`));
|
|
398
429
|
let result = 0;
|
|
399
430
|
for (const [i, step] of steps.entries()) {
|
|
400
431
|
result += await runStepAsync(name, step, exitOnFail, messages?.[i]);
|
|
@@ -418,7 +449,7 @@ var build = async ({
|
|
|
418
449
|
const targetOptions = target === void 0 ? [] : ["-t", target];
|
|
419
450
|
const jobsOptions = jobs === void 0 ? [] : ["-j", `${jobs}`];
|
|
420
451
|
if (jobs !== void 0) {
|
|
421
|
-
console.log(
|
|
452
|
+
console.log(chalk8.blue(`Jobs set to [${jobs}]`));
|
|
422
453
|
}
|
|
423
454
|
const result = await runStepsAsync(`Build${incremental ? "-Incremental" : ""} [${pkg ?? "All"}]`, [
|
|
424
455
|
["yarn", ["xy", "compile", ...pkgOptions, ...targetOptions, ...verboseOptions, ...jobsOptions, ...incrementalOptions, "--types", "tsup"]],
|
|
@@ -426,11 +457,11 @@ var build = async ({
|
|
|
426
457
|
["yarn", ["xy", "deplint", ...pkgOptions, ...verboseOptions, ...jobsOptions, ...incrementalOptions]],
|
|
427
458
|
["yarn", ["xy", "lint", ...pkgOptions, ...verboseOptions, ...incrementalOptions]]
|
|
428
459
|
]);
|
|
429
|
-
console.log(`${
|
|
460
|
+
console.log(`${chalk8.gray("Built in")} [${chalk8.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk8.gray("seconds")}`);
|
|
430
461
|
return result;
|
|
431
462
|
};
|
|
432
463
|
|
|
433
|
-
// src/actions/claude-
|
|
464
|
+
// src/actions/claude-commands.ts
|
|
434
465
|
import {
|
|
435
466
|
existsSync as existsSync4,
|
|
436
467
|
mkdirSync,
|
|
@@ -440,14 +471,14 @@ import {
|
|
|
440
471
|
writeFileSync as writeFileSync2
|
|
441
472
|
} from "fs";
|
|
442
473
|
import PATH2 from "path";
|
|
443
|
-
import
|
|
444
|
-
var
|
|
445
|
-
const templates =
|
|
474
|
+
import chalk9 from "chalk";
|
|
475
|
+
var syncCommandFiles = (commandsDir) => {
|
|
476
|
+
const templates = claudeCommandTemplates();
|
|
446
477
|
const templateNames = new Set(Object.keys(templates));
|
|
447
478
|
let updated = 0;
|
|
448
479
|
let created = 0;
|
|
449
480
|
for (const [filename3, content] of Object.entries(templates)) {
|
|
450
|
-
const targetPath = PATH2.resolve(
|
|
481
|
+
const targetPath = PATH2.resolve(commandsDir, filename3);
|
|
451
482
|
const existing = existsSync4(targetPath) ? readFileSync4(targetPath, "utf8") : void 0;
|
|
452
483
|
if (existing === content) continue;
|
|
453
484
|
writeFileSync2(targetPath, content, "utf8");
|
|
@@ -463,12 +494,82 @@ var syncRuleFiles = (rulesDir) => {
|
|
|
463
494
|
updated
|
|
464
495
|
};
|
|
465
496
|
};
|
|
497
|
+
var removeStaleCommands = (commandsDir, templateNames) => {
|
|
498
|
+
const existingCommands = readdirSync2(commandsDir).filter((f) => f.startsWith(XYLABS_COMMANDS_PREFIX) && f.endsWith(".md"));
|
|
499
|
+
let removed = 0;
|
|
500
|
+
for (const file of existingCommands) {
|
|
501
|
+
if (!templateNames.has(file)) {
|
|
502
|
+
unlinkSync(PATH2.resolve(commandsDir, file));
|
|
503
|
+
removed++;
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
return removed;
|
|
507
|
+
};
|
|
508
|
+
var logCommandsResult = (created, updated, removed) => {
|
|
509
|
+
if (created || updated || removed) {
|
|
510
|
+
const parts = [
|
|
511
|
+
created ? `${created} created` : "",
|
|
512
|
+
updated ? `${updated} updated` : "",
|
|
513
|
+
removed ? `${removed} removed` : ""
|
|
514
|
+
].filter(Boolean);
|
|
515
|
+
console.log(chalk9.green(`.claude/commands/${XYLABS_COMMANDS_PREFIX}*.md: ${parts.join(", ")}`));
|
|
516
|
+
} else {
|
|
517
|
+
console.log(chalk9.gray(`.claude/commands/${XYLABS_COMMANDS_PREFIX}*.md: already up to date`));
|
|
518
|
+
}
|
|
519
|
+
};
|
|
520
|
+
var claudeCommands = () => {
|
|
521
|
+
const cwd = INIT_CWD() ?? process.cwd();
|
|
522
|
+
const commandsDir = PATH2.resolve(cwd, ".claude", "commands");
|
|
523
|
+
mkdirSync(commandsDir, { recursive: true });
|
|
524
|
+
const {
|
|
525
|
+
created,
|
|
526
|
+
templateNames,
|
|
527
|
+
updated
|
|
528
|
+
} = syncCommandFiles(commandsDir);
|
|
529
|
+
const removed = removeStaleCommands(commandsDir, templateNames);
|
|
530
|
+
logCommandsResult(created, updated, removed);
|
|
531
|
+
return 0;
|
|
532
|
+
};
|
|
533
|
+
|
|
534
|
+
// src/actions/claude-rules.ts
|
|
535
|
+
import {
|
|
536
|
+
existsSync as existsSync5,
|
|
537
|
+
mkdirSync as mkdirSync2,
|
|
538
|
+
readdirSync as readdirSync3,
|
|
539
|
+
readFileSync as readFileSync5,
|
|
540
|
+
unlinkSync as unlinkSync2,
|
|
541
|
+
writeFileSync as writeFileSync3
|
|
542
|
+
} from "fs";
|
|
543
|
+
import PATH3 from "path";
|
|
544
|
+
import chalk10 from "chalk";
|
|
545
|
+
var syncRuleFiles = (rulesDir) => {
|
|
546
|
+
const templates = claudeMdRuleTemplates();
|
|
547
|
+
const templateNames = new Set(Object.keys(templates));
|
|
548
|
+
let updated = 0;
|
|
549
|
+
let created = 0;
|
|
550
|
+
for (const [filename3, content] of Object.entries(templates)) {
|
|
551
|
+
const targetPath = PATH3.resolve(rulesDir, filename3);
|
|
552
|
+
const existing = existsSync5(targetPath) ? readFileSync5(targetPath, "utf8") : void 0;
|
|
553
|
+
if (existing === content) continue;
|
|
554
|
+
writeFileSync3(targetPath, content, "utf8");
|
|
555
|
+
if (existing) {
|
|
556
|
+
updated++;
|
|
557
|
+
} else {
|
|
558
|
+
created++;
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
return {
|
|
562
|
+
created,
|
|
563
|
+
templateNames,
|
|
564
|
+
updated
|
|
565
|
+
};
|
|
566
|
+
};
|
|
466
567
|
var removeStaleRules = (rulesDir, templateNames) => {
|
|
467
|
-
const existingRules =
|
|
568
|
+
const existingRules = readdirSync3(rulesDir).filter((f) => f.startsWith(XYLABS_RULES_PREFIX) && f.endsWith(".md"));
|
|
468
569
|
let removed = 0;
|
|
469
570
|
for (const file of existingRules) {
|
|
470
571
|
if (!templateNames.has(file)) {
|
|
471
|
-
|
|
572
|
+
unlinkSync2(PATH3.resolve(rulesDir, file));
|
|
472
573
|
removed++;
|
|
473
574
|
}
|
|
474
575
|
}
|
|
@@ -481,27 +582,27 @@ var logRulesResult = (created, updated, removed) => {
|
|
|
481
582
|
updated ? `${updated} updated` : "",
|
|
482
583
|
removed ? `${removed} removed` : ""
|
|
483
584
|
].filter(Boolean);
|
|
484
|
-
console.log(
|
|
585
|
+
console.log(chalk10.green(`.claude/rules/${XYLABS_RULES_PREFIX}*.md: ${parts.join(", ")}`));
|
|
485
586
|
} else {
|
|
486
|
-
console.log(
|
|
587
|
+
console.log(chalk10.gray(`.claude/rules/${XYLABS_RULES_PREFIX}*.md: already up to date`));
|
|
487
588
|
}
|
|
488
589
|
};
|
|
489
590
|
var ensureProjectClaudeMd = (cwd, force) => {
|
|
490
|
-
const projectPath =
|
|
491
|
-
if (!
|
|
492
|
-
if (force &&
|
|
493
|
-
console.log(
|
|
591
|
+
const projectPath = PATH3.resolve(cwd, "CLAUDE.md");
|
|
592
|
+
if (!existsSync5(projectPath) || force) {
|
|
593
|
+
if (force && existsSync5(projectPath)) {
|
|
594
|
+
console.log(chalk10.yellow("Overwriting existing CLAUDE.md"));
|
|
494
595
|
}
|
|
495
|
-
|
|
496
|
-
console.log(
|
|
596
|
+
writeFileSync3(projectPath, claudeMdProjectTemplate(), "utf8");
|
|
597
|
+
console.log(chalk10.green("Generated CLAUDE.md"));
|
|
497
598
|
} else {
|
|
498
|
-
console.log(
|
|
599
|
+
console.log(chalk10.gray("CLAUDE.md already exists (skipped)"));
|
|
499
600
|
}
|
|
500
601
|
};
|
|
501
602
|
var claudeRules = ({ force } = {}) => {
|
|
502
603
|
const cwd = INIT_CWD() ?? process.cwd();
|
|
503
|
-
const rulesDir =
|
|
504
|
-
|
|
604
|
+
const rulesDir = PATH3.resolve(cwd, ".claude", "rules");
|
|
605
|
+
mkdirSync2(rulesDir, { recursive: true });
|
|
505
606
|
const {
|
|
506
607
|
created,
|
|
507
608
|
templateNames,
|
|
@@ -527,16 +628,16 @@ var cleanAll = ({ verbose }) => {
|
|
|
527
628
|
|
|
528
629
|
// src/actions/clean-docs.ts
|
|
529
630
|
import path from "path";
|
|
530
|
-
import
|
|
631
|
+
import chalk11 from "chalk";
|
|
531
632
|
var cleanDocs = () => {
|
|
532
633
|
const pkgName = process.env.npm_package_name;
|
|
533
|
-
console.log(
|
|
634
|
+
console.log(chalk11.green(`Cleaning Docs [${pkgName}]`));
|
|
534
635
|
for (const { location } of yarnWorkspaces()) deleteGlob(path.join(location, "docs"));
|
|
535
636
|
return 0;
|
|
536
637
|
};
|
|
537
638
|
|
|
538
639
|
// src/actions/compile.ts
|
|
539
|
-
import
|
|
640
|
+
import chalk12 from "chalk";
|
|
540
641
|
var compile = ({
|
|
541
642
|
verbose,
|
|
542
643
|
target,
|
|
@@ -577,7 +678,7 @@ var compileAll = ({
|
|
|
577
678
|
const incrementalOptions = incremental ? ["--since", "-Ap", "--topological-dev"] : ["--parallel", "-Ap", "--topological-dev"];
|
|
578
679
|
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
579
680
|
if (jobs) {
|
|
580
|
-
console.log(
|
|
681
|
+
console.log(chalk12.blue(`Jobs set to [${jobs}]`));
|
|
581
682
|
}
|
|
582
683
|
const result = runSteps(`Compile${incremental ? "-Incremental" : ""} [All]`, [
|
|
583
684
|
["yarn", [
|
|
@@ -591,13 +692,13 @@ var compileAll = ({
|
|
|
591
692
|
...targetOptions
|
|
592
693
|
]]
|
|
593
694
|
]);
|
|
594
|
-
console.log(`${
|
|
695
|
+
console.log(`${chalk12.gray("Compiled in")} [${chalk12.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk12.gray("seconds")}`);
|
|
595
696
|
return result;
|
|
596
697
|
};
|
|
597
698
|
|
|
598
699
|
// src/actions/copy-assets.ts
|
|
599
700
|
import path2 from "path/posix";
|
|
600
|
-
import
|
|
701
|
+
import chalk13 from "chalk";
|
|
601
702
|
import cpy from "cpy";
|
|
602
703
|
var copyPackageTargetAssets = async (target, name, location) => {
|
|
603
704
|
try {
|
|
@@ -620,7 +721,7 @@ var copyPackageTargetAssets = async (target, name, location) => {
|
|
|
620
721
|
};
|
|
621
722
|
var copyTargetAssets = async (target, pkg) => {
|
|
622
723
|
const workspaces = yarnWorkspaces();
|
|
623
|
-
console.log(
|
|
724
|
+
console.log(chalk13.green(`Copying Assets [${target.toUpperCase()}]`));
|
|
624
725
|
const workspaceList = workspaces.filter(({ name }) => {
|
|
625
726
|
return pkg === void 0 || name === pkg;
|
|
626
727
|
});
|
|
@@ -704,7 +805,7 @@ var dead = () => {
|
|
|
704
805
|
};
|
|
705
806
|
|
|
706
807
|
// src/actions/deplint/deplint.ts
|
|
707
|
-
import
|
|
808
|
+
import chalk19 from "chalk";
|
|
708
809
|
|
|
709
810
|
// src/actions/deplint/findFiles.ts
|
|
710
811
|
import fs2 from "fs";
|
|
@@ -880,11 +981,11 @@ function getExternalImportsFromFiles({
|
|
|
880
981
|
const allImportPaths = {};
|
|
881
982
|
const distImportPaths = {};
|
|
882
983
|
const distTypeImportPaths = {};
|
|
883
|
-
for (const
|
|
984
|
+
for (const path8 of allFiles) getImportsFromFile(path8, allImportPaths, allImportPaths).flat();
|
|
884
985
|
const distTypeFiles = distFiles.filter(isDeclarationFile);
|
|
885
986
|
const distCodeFiles = distFiles.filter((file) => !isDeclarationFile(file));
|
|
886
|
-
for (const
|
|
887
|
-
for (const
|
|
987
|
+
for (const path8 of distCodeFiles) getImportsFromFile(path8, distImportPaths, distImportPaths).flat();
|
|
988
|
+
for (const path8 of distTypeFiles) getImportsFromFile(path8, distTypeImportPaths, distTypeImportPaths).flat();
|
|
888
989
|
const allImports = Object.keys(allImportPaths);
|
|
889
990
|
const distImports = Object.keys(distImportPaths);
|
|
890
991
|
const externalAllImports = removeInternalImports(allImports);
|
|
@@ -906,12 +1007,12 @@ function getExternalImportsFromFiles({
|
|
|
906
1007
|
|
|
907
1008
|
// src/actions/deplint/checkPackage/getUnlistedDependencies.ts
|
|
908
1009
|
import { builtinModules } from "module";
|
|
909
|
-
import
|
|
1010
|
+
import chalk14 from "chalk";
|
|
910
1011
|
function isListedOrBuiltin(imp, name, dependencies, peerDependencies) {
|
|
911
1012
|
return dependencies.includes(imp) || imp === name || dependencies.includes(`@types/${imp}`) || peerDependencies.includes(imp) || peerDependencies.includes(`@types/${imp}`) || builtinModules.includes(imp) || builtinModules.includes(`@types/${imp}`);
|
|
912
1013
|
}
|
|
913
1014
|
function logMissing(name, imp, importPaths) {
|
|
914
|
-
console.log(`[${
|
|
1015
|
+
console.log(`[${chalk14.blue(name)}] Missing dependency in package.json: ${chalk14.red(imp)}`);
|
|
915
1016
|
if (importPaths[imp]) {
|
|
916
1017
|
console.log(` ${importPaths[imp].join("\n ")}`);
|
|
917
1018
|
}
|
|
@@ -936,7 +1037,7 @@ function getUnlistedDependencies({ name, location }, { dependencies, peerDepende
|
|
|
936
1037
|
}
|
|
937
1038
|
if (unlistedDependencies > 0) {
|
|
938
1039
|
const packageLocation = `${location}/package.json`;
|
|
939
|
-
console.log(` ${
|
|
1040
|
+
console.log(` ${chalk14.yellow(packageLocation)}
|
|
940
1041
|
`);
|
|
941
1042
|
}
|
|
942
1043
|
return unlistedDependencies;
|
|
@@ -944,7 +1045,7 @@ function getUnlistedDependencies({ name, location }, { dependencies, peerDepende
|
|
|
944
1045
|
|
|
945
1046
|
// src/actions/deplint/checkPackage/getUnlistedDevDependencies.ts
|
|
946
1047
|
import { builtinModules as builtinModules2 } from "module";
|
|
947
|
-
import
|
|
1048
|
+
import chalk15 from "chalk";
|
|
948
1049
|
function getUnlistedDevDependencies({ name, location }, {
|
|
949
1050
|
devDependencies,
|
|
950
1051
|
dependencies,
|
|
@@ -958,7 +1059,7 @@ function getUnlistedDevDependencies({ name, location }, {
|
|
|
958
1059
|
for (const imp of externalAllImports) {
|
|
959
1060
|
if (!distImports.includes(imp) && imp !== name && !dependencies.includes(imp) && !dependencies.includes(`@types/${imp}`) && !peerDependencies.includes(imp) && !peerDependencies.includes(`@types/${imp}`) && !devDependencies.includes(imp) && !devDependencies.includes(`@types/${imp}`) && !builtinModules2.includes(imp)) {
|
|
960
1061
|
unlistedDevDependencies++;
|
|
961
|
-
console.log(`[${
|
|
1062
|
+
console.log(`[${chalk15.blue(name)}] Missing devDependency in package.json: ${chalk15.red(imp)}`);
|
|
962
1063
|
if (allImportPaths[imp]) {
|
|
963
1064
|
console.log(` ${allImportPaths[imp].join("\n ")}`);
|
|
964
1065
|
}
|
|
@@ -966,40 +1067,50 @@ function getUnlistedDevDependencies({ name, location }, {
|
|
|
966
1067
|
}
|
|
967
1068
|
if (unlistedDevDependencies > 0) {
|
|
968
1069
|
const packageLocation = `${location}/package.json`;
|
|
969
|
-
console.log(` ${
|
|
1070
|
+
console.log(` ${chalk15.yellow(packageLocation)}
|
|
970
1071
|
`);
|
|
971
1072
|
}
|
|
972
1073
|
return unlistedDevDependencies;
|
|
973
1074
|
}
|
|
974
1075
|
|
|
975
1076
|
// src/actions/deplint/checkPackage/getUnusedDependencies.ts
|
|
976
|
-
import
|
|
1077
|
+
import chalk16 from "chalk";
|
|
977
1078
|
function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
978
1079
|
externalDistImports,
|
|
979
1080
|
externalDistTypeImports,
|
|
980
1081
|
externalAllImports
|
|
981
|
-
}) {
|
|
1082
|
+
}, exclude) {
|
|
982
1083
|
let unusedDependencies = 0;
|
|
983
1084
|
for (const dep of dependencies) {
|
|
1085
|
+
if (exclude?.has(dep)) continue;
|
|
984
1086
|
if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
|
|
985
1087
|
unusedDependencies++;
|
|
986
1088
|
if (externalAllImports.includes(dep)) {
|
|
987
|
-
console.log(`[${
|
|
1089
|
+
console.log(`[${chalk16.blue(name)}] dependency should be devDependency in package.json: ${chalk16.red(dep)}`);
|
|
988
1090
|
} else {
|
|
989
|
-
console.log(`[${
|
|
1091
|
+
console.log(`[${chalk16.blue(name)}] Unused dependency in package.json: ${chalk16.red(dep)}`);
|
|
990
1092
|
}
|
|
991
1093
|
}
|
|
992
1094
|
}
|
|
993
1095
|
if (unusedDependencies > 0) {
|
|
994
1096
|
const packageLocation = `${location}/package.json`;
|
|
995
|
-
console.log(` ${
|
|
1097
|
+
console.log(` ${chalk16.yellow(packageLocation)}
|
|
996
1098
|
`);
|
|
997
1099
|
}
|
|
998
1100
|
return unusedDependencies;
|
|
999
1101
|
}
|
|
1000
1102
|
|
|
1001
1103
|
// src/actions/deplint/checkPackage/getUnusedDevDependencies.ts
|
|
1002
|
-
import
|
|
1104
|
+
import chalk17 from "chalk";
|
|
1105
|
+
|
|
1106
|
+
// src/actions/deplint/getCliReferencedPackagesFromFiles.ts
|
|
1107
|
+
import fs8 from "fs";
|
|
1108
|
+
import path7 from "path";
|
|
1109
|
+
import ts2 from "typescript";
|
|
1110
|
+
|
|
1111
|
+
// src/actions/deplint/getScriptReferencedPackages.ts
|
|
1112
|
+
import fs7 from "fs";
|
|
1113
|
+
import path6 from "path";
|
|
1003
1114
|
|
|
1004
1115
|
// src/actions/deplint/getRequiredPeerDependencies.ts
|
|
1005
1116
|
import fs6 from "fs";
|
|
@@ -1034,8 +1145,6 @@ function getRequiredPeerDependencies(location, allDeps) {
|
|
|
1034
1145
|
}
|
|
1035
1146
|
|
|
1036
1147
|
// src/actions/deplint/getScriptReferencedPackages.ts
|
|
1037
|
-
import fs7 from "fs";
|
|
1038
|
-
import path6 from "path";
|
|
1039
1148
|
function getBinNames(location, dep) {
|
|
1040
1149
|
const depPkgPath = findDepPackageJson(location, dep);
|
|
1041
1150
|
if (!depPkgPath) return [];
|
|
@@ -1085,15 +1194,101 @@ function getScriptReferencedPackages(location, allDeps) {
|
|
|
1085
1194
|
return referenced;
|
|
1086
1195
|
}
|
|
1087
1196
|
|
|
1197
|
+
// src/actions/deplint/getCliReferencedPackagesFromFiles.ts
|
|
1198
|
+
var shellCommandFunctions = /* @__PURE__ */ new Set(["execSync", "exec"]);
|
|
1199
|
+
var directExecFunctions = /* @__PURE__ */ new Set(["spawn", "spawnSync", "execFile", "execFileSync"]);
|
|
1200
|
+
var allExecFunctions = /* @__PURE__ */ new Set([...shellCommandFunctions, ...directExecFunctions]);
|
|
1201
|
+
function getCommandTokensFromFile(filePath) {
|
|
1202
|
+
const tokens = /* @__PURE__ */ new Set();
|
|
1203
|
+
let sourceCode;
|
|
1204
|
+
try {
|
|
1205
|
+
sourceCode = fs8.readFileSync(filePath, "utf8");
|
|
1206
|
+
} catch {
|
|
1207
|
+
return tokens;
|
|
1208
|
+
}
|
|
1209
|
+
const isMjsFile = filePath.endsWith(".mjs");
|
|
1210
|
+
const sourceFile = ts2.createSourceFile(
|
|
1211
|
+
path7.basename(filePath),
|
|
1212
|
+
sourceCode,
|
|
1213
|
+
ts2.ScriptTarget.Latest,
|
|
1214
|
+
true,
|
|
1215
|
+
isMjsFile ? ts2.ScriptKind.JS : void 0
|
|
1216
|
+
);
|
|
1217
|
+
function visit(node) {
|
|
1218
|
+
if (ts2.isCallExpression(node) && node.arguments.length > 0) {
|
|
1219
|
+
const fnName = getFunctionName(node.expression);
|
|
1220
|
+
if (fnName && allExecFunctions.has(fnName)) {
|
|
1221
|
+
const firstArg = node.arguments[0];
|
|
1222
|
+
if (ts2.isStringLiteral(firstArg) || ts2.isNoSubstitutionTemplateLiteral(firstArg)) {
|
|
1223
|
+
const value = firstArg.text;
|
|
1224
|
+
if (shellCommandFunctions.has(fnName)) {
|
|
1225
|
+
for (const token of tokenizeScript(value)) {
|
|
1226
|
+
tokens.add(token);
|
|
1227
|
+
}
|
|
1228
|
+
} else {
|
|
1229
|
+
tokens.add(value);
|
|
1230
|
+
}
|
|
1231
|
+
} else if (ts2.isTemplateExpression(firstArg)) {
|
|
1232
|
+
const head = firstArg.head.text;
|
|
1233
|
+
if (head) {
|
|
1234
|
+
for (const token of tokenizeScript(head)) {
|
|
1235
|
+
tokens.add(token);
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
}
|
|
1240
|
+
}
|
|
1241
|
+
ts2.forEachChild(node, visit);
|
|
1242
|
+
}
|
|
1243
|
+
visit(sourceFile);
|
|
1244
|
+
return tokens;
|
|
1245
|
+
}
|
|
1246
|
+
function getFunctionName(expr) {
|
|
1247
|
+
if (ts2.isIdentifier(expr)) {
|
|
1248
|
+
return expr.text;
|
|
1249
|
+
}
|
|
1250
|
+
if (ts2.isPropertyAccessExpression(expr) && ts2.isIdentifier(expr.name)) {
|
|
1251
|
+
return expr.name.text;
|
|
1252
|
+
}
|
|
1253
|
+
return void 0;
|
|
1254
|
+
}
|
|
1255
|
+
function getCliReferencedPackagesFromFiles(allFiles, location, allDeps) {
|
|
1256
|
+
const allTokens = /* @__PURE__ */ new Set();
|
|
1257
|
+
for (const file of allFiles) {
|
|
1258
|
+
for (const token of getCommandTokensFromFile(file)) {
|
|
1259
|
+
allTokens.add(token);
|
|
1260
|
+
}
|
|
1261
|
+
}
|
|
1262
|
+
if (allTokens.size === 0) return /* @__PURE__ */ new Set();
|
|
1263
|
+
const binToPackage = /* @__PURE__ */ new Map();
|
|
1264
|
+
for (const dep of allDeps) {
|
|
1265
|
+
for (const bin of getBinNames(location, dep)) {
|
|
1266
|
+
binToPackage.set(bin, dep);
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
const referenced = /* @__PURE__ */ new Set();
|
|
1270
|
+
for (const token of allTokens) {
|
|
1271
|
+
const baseName = getBasePackageName(token);
|
|
1272
|
+
if (allDeps.includes(baseName)) {
|
|
1273
|
+
referenced.add(baseName);
|
|
1274
|
+
}
|
|
1275
|
+
const pkg = binToPackage.get(token);
|
|
1276
|
+
if (pkg) {
|
|
1277
|
+
referenced.add(pkg);
|
|
1278
|
+
}
|
|
1279
|
+
}
|
|
1280
|
+
return referenced;
|
|
1281
|
+
}
|
|
1282
|
+
|
|
1088
1283
|
// src/actions/deplint/implicitDevDependencies.ts
|
|
1089
|
-
import
|
|
1284
|
+
import fs9 from "fs";
|
|
1090
1285
|
var hasFileWithExtension = (files, extensions) => files.some((f) => extensions.some((ext) => f.endsWith(ext)));
|
|
1091
1286
|
var tsExtensions = [".ts", ".tsx", ".mts", ".cts"];
|
|
1092
1287
|
var hasTypescriptFiles = ({ allFiles }) => hasFileWithExtension(allFiles, tsExtensions);
|
|
1093
1288
|
var decoratorPattern = /^\s*@[a-zA-Z]\w*/m;
|
|
1094
1289
|
var hasDecorators = ({ allFiles }) => allFiles.filter((f) => tsExtensions.some((ext) => f.endsWith(ext))).some((file) => {
|
|
1095
1290
|
try {
|
|
1096
|
-
const content =
|
|
1291
|
+
const content = fs9.readFileSync(file, "utf8");
|
|
1097
1292
|
return decoratorPattern.test(content);
|
|
1098
1293
|
} catch {
|
|
1099
1294
|
return false;
|
|
@@ -1106,7 +1301,7 @@ function hasImportPlugin({ location, allDependencies }) {
|
|
|
1106
1301
|
const pkgPath = findDepPackageJson(location, dep);
|
|
1107
1302
|
if (!pkgPath) continue;
|
|
1108
1303
|
try {
|
|
1109
|
-
const pkg = JSON.parse(
|
|
1304
|
+
const pkg = JSON.parse(fs9.readFileSync(pkgPath, "utf8"));
|
|
1110
1305
|
const transitiveDeps = [
|
|
1111
1306
|
...Object.keys(pkg.dependencies ?? {}),
|
|
1112
1307
|
...Object.keys(pkg.peerDependencies ?? {})
|
|
@@ -1158,10 +1353,11 @@ var allExternalImports = ({
|
|
|
1158
1353
|
...externalDistTypeImports
|
|
1159
1354
|
]);
|
|
1160
1355
|
};
|
|
1161
|
-
function isDevDepUsed(dep, allImports, implicitDeps, requiredPeers, scriptRefs) {
|
|
1356
|
+
function isDevDepUsed(dep, allImports, implicitDeps, requiredPeers, scriptRefs, cliRefs) {
|
|
1162
1357
|
if (implicitDeps.has(dep)) return true;
|
|
1163
1358
|
if (requiredPeers.has(dep)) return true;
|
|
1164
1359
|
if (scriptRefs.has(dep)) return true;
|
|
1360
|
+
if (cliRefs.has(dep)) return true;
|
|
1165
1361
|
if (dep.startsWith("@types/")) {
|
|
1166
1362
|
const baseName = dep.replace(/^@types\//, "");
|
|
1167
1363
|
return allImports.has(baseName) || allImports.has(dep) || implicitDeps.has(baseName);
|
|
@@ -1172,7 +1368,7 @@ function getUnusedDevDependencies({ name, location }, {
|
|
|
1172
1368
|
devDependencies,
|
|
1173
1369
|
dependencies,
|
|
1174
1370
|
peerDependencies
|
|
1175
|
-
}, sourceParams, fileContext) {
|
|
1371
|
+
}, sourceParams, fileContext, exclude) {
|
|
1176
1372
|
const allImports = allExternalImports(sourceParams);
|
|
1177
1373
|
const allDeps = [...dependencies, ...devDependencies, ...peerDependencies];
|
|
1178
1374
|
const implicitDeps = getImplicitDevDependencies({
|
|
@@ -1182,39 +1378,42 @@ function getUnusedDevDependencies({ name, location }, {
|
|
|
1182
1378
|
});
|
|
1183
1379
|
const requiredPeers = getRequiredPeerDependencies(location, allDeps);
|
|
1184
1380
|
const scriptRefs = getScriptReferencedPackages(location, allDeps);
|
|
1381
|
+
const cliRefs = getCliReferencedPackagesFromFiles(fileContext.allFiles, location, allDeps);
|
|
1185
1382
|
let unusedDevDependencies = 0;
|
|
1186
1383
|
for (const dep of devDependencies) {
|
|
1384
|
+
if (exclude?.has(dep)) continue;
|
|
1187
1385
|
if (dependencies.includes(dep) || peerDependencies.includes(dep)) continue;
|
|
1188
|
-
if (!isDevDepUsed(dep, allImports, implicitDeps, requiredPeers, scriptRefs)) {
|
|
1386
|
+
if (!isDevDepUsed(dep, allImports, implicitDeps, requiredPeers, scriptRefs, cliRefs)) {
|
|
1189
1387
|
unusedDevDependencies++;
|
|
1190
|
-
console.log(`[${
|
|
1388
|
+
console.log(`[${chalk17.blue(name)}] Unused devDependency in package.json: ${chalk17.red(dep)}`);
|
|
1191
1389
|
}
|
|
1192
1390
|
}
|
|
1193
1391
|
if (unusedDevDependencies > 0) {
|
|
1194
1392
|
const packageLocation = `${location}/package.json`;
|
|
1195
|
-
console.log(` ${
|
|
1393
|
+
console.log(` ${chalk17.yellow(packageLocation)}
|
|
1196
1394
|
`);
|
|
1197
1395
|
}
|
|
1198
1396
|
return unusedDevDependencies;
|
|
1199
1397
|
}
|
|
1200
1398
|
|
|
1201
1399
|
// src/actions/deplint/checkPackage/getUnusedPeerDependencies.ts
|
|
1202
|
-
import
|
|
1203
|
-
function getUnusedPeerDependencies({ name, location }, { peerDependencies, dependencies }, { externalDistImports, externalDistTypeImports }) {
|
|
1400
|
+
import chalk18 from "chalk";
|
|
1401
|
+
function getUnusedPeerDependencies({ name, location }, { peerDependencies, dependencies }, { externalDistImports, externalDistTypeImports }, exclude) {
|
|
1204
1402
|
let unusedDependencies = 0;
|
|
1205
1403
|
for (const dep of peerDependencies) {
|
|
1404
|
+
if (exclude?.has(dep)) continue;
|
|
1206
1405
|
if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
|
|
1207
1406
|
unusedDependencies++;
|
|
1208
1407
|
if (dependencies.includes(dep)) {
|
|
1209
|
-
console.log(`[${
|
|
1408
|
+
console.log(`[${chalk18.blue(name)}] Unused peerDependency [already a dependency] in package.json: ${chalk18.red(dep)}`);
|
|
1210
1409
|
} else {
|
|
1211
|
-
console.log(`[${
|
|
1410
|
+
console.log(`[${chalk18.blue(name)}] Unused peerDependency in package.json: ${chalk18.red(dep)}`);
|
|
1212
1411
|
}
|
|
1213
1412
|
}
|
|
1214
1413
|
}
|
|
1215
1414
|
if (unusedDependencies > 0) {
|
|
1216
1415
|
const packageLocation = `${location}/package.json`;
|
|
1217
|
-
console.log(` ${
|
|
1416
|
+
console.log(` ${chalk18.yellow(packageLocation)}
|
|
1218
1417
|
`);
|
|
1219
1418
|
}
|
|
1220
1419
|
return unusedDependencies;
|
|
@@ -1239,6 +1438,7 @@ function checkPackage({
|
|
|
1239
1438
|
location,
|
|
1240
1439
|
deps = false,
|
|
1241
1440
|
devDeps = false,
|
|
1441
|
+
exclude,
|
|
1242
1442
|
peerDeps = false,
|
|
1243
1443
|
verbose = false
|
|
1244
1444
|
}) {
|
|
@@ -1257,23 +1457,29 @@ function checkPackage({
|
|
|
1257
1457
|
});
|
|
1258
1458
|
const packageParams = getDependenciesFromPackageJson(`${location}/package.json`);
|
|
1259
1459
|
const unlistedDependencies = checkDeps ? getUnlistedDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
1260
|
-
const unusedDependencies = checkDeps ? getUnusedDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
1460
|
+
const unusedDependencies = checkDeps ? getUnusedDependencies({ name, location }, packageParams, sourceParams, exclude) : 0;
|
|
1261
1461
|
const unlistedDevDependencies = checkDevDeps ? getUnlistedDevDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
1262
1462
|
const fileContext = { allFiles, distFiles };
|
|
1263
|
-
const unusedDevDependencies = checkDevDeps ? getUnusedDevDependencies({ name, location }, packageParams, sourceParams, fileContext) : 0;
|
|
1264
|
-
const unusedPeerDependencies = checkPeerDeps ? getUnusedPeerDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
1463
|
+
const unusedDevDependencies = checkDevDeps ? getUnusedDevDependencies({ name, location }, packageParams, sourceParams, fileContext, exclude) : 0;
|
|
1464
|
+
const unusedPeerDependencies = checkPeerDeps ? getUnusedPeerDependencies({ name, location }, packageParams, sourceParams, exclude) : 0;
|
|
1265
1465
|
const totalErrors = unlistedDependencies + unlistedDevDependencies + unusedDependencies + unusedDevDependencies + unusedPeerDependencies;
|
|
1266
1466
|
return totalErrors;
|
|
1267
1467
|
}
|
|
1268
1468
|
|
|
1269
1469
|
// src/actions/deplint/deplint.ts
|
|
1270
|
-
var deplint = ({
|
|
1470
|
+
var deplint = async ({
|
|
1271
1471
|
pkg,
|
|
1272
1472
|
deps,
|
|
1273
1473
|
devDeps,
|
|
1274
1474
|
peerDeps,
|
|
1275
|
-
verbose
|
|
1475
|
+
verbose,
|
|
1476
|
+
cliExclude
|
|
1276
1477
|
}) => {
|
|
1478
|
+
const config2 = await loadConfig();
|
|
1479
|
+
const exclude = /* @__PURE__ */ new Set([
|
|
1480
|
+
...config2.deplint?.exclude ?? [],
|
|
1481
|
+
...cliExclude ?? []
|
|
1482
|
+
]);
|
|
1277
1483
|
let totalErrors = 0;
|
|
1278
1484
|
if (pkg === void 0) {
|
|
1279
1485
|
const workspaces = yarnWorkspaces();
|
|
@@ -1283,6 +1489,7 @@ var deplint = ({
|
|
|
1283
1489
|
...workspace,
|
|
1284
1490
|
deps,
|
|
1285
1491
|
devDeps,
|
|
1492
|
+
exclude,
|
|
1286
1493
|
peerDeps,
|
|
1287
1494
|
verbose
|
|
1288
1495
|
});
|
|
@@ -1295,24 +1502,25 @@ var deplint = ({
|
|
|
1295
1502
|
location,
|
|
1296
1503
|
devDeps,
|
|
1297
1504
|
deps,
|
|
1505
|
+
exclude,
|
|
1298
1506
|
peerDeps,
|
|
1299
1507
|
verbose
|
|
1300
1508
|
});
|
|
1301
1509
|
}
|
|
1302
1510
|
if (totalErrors > 0) {
|
|
1303
|
-
console.warn(`Deplint: Found ${
|
|
1511
|
+
console.warn(`Deplint: Found ${chalk19.red(totalErrors)} dependency problems. ${chalk19.red("\u2716")}`);
|
|
1304
1512
|
} else {
|
|
1305
|
-
console.info(`Deplint: Found no dependency problems. ${
|
|
1513
|
+
console.info(`Deplint: Found no dependency problems. ${chalk19.green("\u2714")}`);
|
|
1306
1514
|
}
|
|
1307
1515
|
return 0;
|
|
1308
1516
|
};
|
|
1309
1517
|
|
|
1310
1518
|
// src/actions/deploy.ts
|
|
1311
|
-
import { readFileSync as
|
|
1519
|
+
import { readFileSync as readFileSync6 } from "fs";
|
|
1312
1520
|
var privatePackageExcludeList = () => {
|
|
1313
1521
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1314
1522
|
workspace,
|
|
1315
|
-
JSON.parse(
|
|
1523
|
+
JSON.parse(readFileSync6(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
1316
1524
|
]);
|
|
1317
1525
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
1318
1526
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
@@ -1332,11 +1540,11 @@ var deploy = () => {
|
|
|
1332
1540
|
};
|
|
1333
1541
|
|
|
1334
1542
|
// src/actions/deploy-major.ts
|
|
1335
|
-
import { readFileSync as
|
|
1543
|
+
import { readFileSync as readFileSync7 } from "fs";
|
|
1336
1544
|
var privatePackageExcludeList2 = () => {
|
|
1337
1545
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1338
1546
|
workspace,
|
|
1339
|
-
JSON.parse(
|
|
1547
|
+
JSON.parse(readFileSync7(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
1340
1548
|
]);
|
|
1341
1549
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
1342
1550
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
@@ -1356,11 +1564,11 @@ var deployMajor = () => {
|
|
|
1356
1564
|
};
|
|
1357
1565
|
|
|
1358
1566
|
// src/actions/deploy-minor.ts
|
|
1359
|
-
import { readFileSync as
|
|
1567
|
+
import { readFileSync as readFileSync8 } from "fs";
|
|
1360
1568
|
var privatePackageExcludeList3 = () => {
|
|
1361
1569
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1362
1570
|
workspace,
|
|
1363
|
-
JSON.parse(
|
|
1571
|
+
JSON.parse(readFileSync8(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
1364
1572
|
]);
|
|
1365
1573
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
1366
1574
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
@@ -1380,11 +1588,11 @@ var deployMinor = () => {
|
|
|
1380
1588
|
};
|
|
1381
1589
|
|
|
1382
1590
|
// src/actions/deploy-next.ts
|
|
1383
|
-
import { readFileSync as
|
|
1591
|
+
import { readFileSync as readFileSync9 } from "fs";
|
|
1384
1592
|
var privatePackageExcludeList4 = () => {
|
|
1385
1593
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1386
1594
|
workspace,
|
|
1387
|
-
JSON.parse(
|
|
1595
|
+
JSON.parse(readFileSync9(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
1388
1596
|
]);
|
|
1389
1597
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
1390
1598
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
@@ -1404,22 +1612,22 @@ var deployNext = () => {
|
|
|
1404
1612
|
};
|
|
1405
1613
|
|
|
1406
1614
|
// src/actions/dupdeps.ts
|
|
1407
|
-
import
|
|
1615
|
+
import chalk20 from "chalk";
|
|
1408
1616
|
var dupdeps = () => {
|
|
1409
|
-
console.log(
|
|
1617
|
+
console.log(chalk20.green("Checking all Dependencies for Duplicates"));
|
|
1410
1618
|
const allDependencies = parsedPackageJSON()?.dependencies;
|
|
1411
1619
|
const dependencies = Object.entries(allDependencies).map(([k]) => k);
|
|
1412
1620
|
return detectDuplicateDependencies(dependencies);
|
|
1413
1621
|
};
|
|
1414
1622
|
|
|
1415
1623
|
// src/actions/lint.ts
|
|
1416
|
-
import
|
|
1624
|
+
import chalk21 from "chalk";
|
|
1417
1625
|
var lintPackage = ({
|
|
1418
1626
|
pkg,
|
|
1419
1627
|
fix: fix2,
|
|
1420
1628
|
verbose
|
|
1421
1629
|
}) => {
|
|
1422
|
-
console.log(
|
|
1630
|
+
console.log(chalk21.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
1423
1631
|
const start = Date.now();
|
|
1424
1632
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
1425
1633
|
["yarn", [
|
|
@@ -1429,7 +1637,7 @@ var lintPackage = ({
|
|
|
1429
1637
|
fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
|
|
1430
1638
|
]]
|
|
1431
1639
|
]);
|
|
1432
|
-
console.log(
|
|
1640
|
+
console.log(chalk21.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk21.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk21.gray("seconds")}`));
|
|
1433
1641
|
return result;
|
|
1434
1642
|
};
|
|
1435
1643
|
var lint = ({
|
|
@@ -1449,13 +1657,13 @@ var lint = ({
|
|
|
1449
1657
|
});
|
|
1450
1658
|
};
|
|
1451
1659
|
var lintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
1452
|
-
console.log(
|
|
1660
|
+
console.log(chalk21.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
1453
1661
|
const start = Date.now();
|
|
1454
1662
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
1455
1663
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
1456
1664
|
["yarn", ["eslint", "--cache", "--cache-location", ".eslintcache", "--cache-strategy", "content", ...fixOptions]]
|
|
1457
1665
|
]);
|
|
1458
|
-
console.log(
|
|
1666
|
+
console.log(chalk21.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk21.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk21.gray("seconds")}`));
|
|
1459
1667
|
return result;
|
|
1460
1668
|
};
|
|
1461
1669
|
|
|
@@ -1483,7 +1691,7 @@ var filename = ".gitignore";
|
|
|
1483
1691
|
var gitignoreGen = (pkg) => generateIgnoreFiles(filename, pkg);
|
|
1484
1692
|
|
|
1485
1693
|
// src/actions/gitlint.ts
|
|
1486
|
-
import
|
|
1694
|
+
import chalk22 from "chalk";
|
|
1487
1695
|
import ParseGitConfig from "parse-git-config";
|
|
1488
1696
|
var gitlint = () => {
|
|
1489
1697
|
console.log(`
|
|
@@ -1494,7 +1702,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1494
1702
|
const errors = 0;
|
|
1495
1703
|
const gitConfig = ParseGitConfig.sync();
|
|
1496
1704
|
const warn = (message) => {
|
|
1497
|
-
console.warn(
|
|
1705
|
+
console.warn(chalk22.yellow(`Warning: ${message}`));
|
|
1498
1706
|
warnings++;
|
|
1499
1707
|
};
|
|
1500
1708
|
if (gitConfig.core.ignorecase) {
|
|
@@ -1514,13 +1722,13 @@ Gitlint Start [${process.cwd()}]
|
|
|
1514
1722
|
}
|
|
1515
1723
|
const resultMessages = [];
|
|
1516
1724
|
if (valid > 0) {
|
|
1517
|
-
resultMessages.push(
|
|
1725
|
+
resultMessages.push(chalk22.green(`Passed: ${valid}`));
|
|
1518
1726
|
}
|
|
1519
1727
|
if (warnings > 0) {
|
|
1520
|
-
resultMessages.push(
|
|
1728
|
+
resultMessages.push(chalk22.yellow(`Warnings: ${warnings}`));
|
|
1521
1729
|
}
|
|
1522
1730
|
if (errors > 0) {
|
|
1523
|
-
resultMessages.push(
|
|
1731
|
+
resultMessages.push(chalk22.red(` Errors: ${errors}`));
|
|
1524
1732
|
}
|
|
1525
1733
|
console.warn(`Gitlint Finish [ ${resultMessages.join(" | ")} ]
|
|
1526
1734
|
`);
|
|
@@ -1529,7 +1737,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
1529
1737
|
|
|
1530
1738
|
// src/actions/gitlint-fix.ts
|
|
1531
1739
|
import { execSync as execSync2 } from "child_process";
|
|
1532
|
-
import
|
|
1740
|
+
import chalk23 from "chalk";
|
|
1533
1741
|
import ParseGitConfig2 from "parse-git-config";
|
|
1534
1742
|
var gitlintFix = () => {
|
|
1535
1743
|
console.log(`
|
|
@@ -1538,15 +1746,15 @@ Gitlint Fix Start [${process.cwd()}]
|
|
|
1538
1746
|
const gitConfig = ParseGitConfig2.sync();
|
|
1539
1747
|
if (gitConfig.core.ignorecase) {
|
|
1540
1748
|
execSync2("git config core.ignorecase false", { stdio: "inherit" });
|
|
1541
|
-
console.warn(
|
|
1749
|
+
console.warn(chalk23.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
|
|
1542
1750
|
}
|
|
1543
1751
|
if (gitConfig.core.autocrlf !== false) {
|
|
1544
1752
|
execSync2("git config core.autocrlf false", { stdio: "inherit" });
|
|
1545
|
-
console.warn(
|
|
1753
|
+
console.warn(chalk23.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
|
|
1546
1754
|
}
|
|
1547
1755
|
if (gitConfig.core.eol !== "lf") {
|
|
1548
1756
|
execSync2("git config core.eol lf", { stdio: "inherit" });
|
|
1549
|
-
console.warn(
|
|
1757
|
+
console.warn(chalk23.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
|
|
1550
1758
|
}
|
|
1551
1759
|
return 1;
|
|
1552
1760
|
};
|
|
@@ -1557,7 +1765,7 @@ var knip = () => {
|
|
|
1557
1765
|
};
|
|
1558
1766
|
|
|
1559
1767
|
// src/actions/license.ts
|
|
1560
|
-
import
|
|
1768
|
+
import chalk24 from "chalk";
|
|
1561
1769
|
import { init } from "license-checker";
|
|
1562
1770
|
var license = async (pkg) => {
|
|
1563
1771
|
const workspaces = yarnWorkspaces();
|
|
@@ -1582,18 +1790,18 @@ var license = async (pkg) => {
|
|
|
1582
1790
|
"LGPL-3.0-or-later",
|
|
1583
1791
|
"Python-2.0"
|
|
1584
1792
|
]);
|
|
1585
|
-
console.log(
|
|
1793
|
+
console.log(chalk24.green("License Checker"));
|
|
1586
1794
|
return (await Promise.all(
|
|
1587
1795
|
workspaceList.map(({ location, name }) => {
|
|
1588
1796
|
return new Promise((resolve) => {
|
|
1589
1797
|
init({ production: true, start: location }, (error, packages) => {
|
|
1590
1798
|
if (error) {
|
|
1591
|
-
console.error(
|
|
1592
|
-
console.error(
|
|
1799
|
+
console.error(chalk24.red(`License Checker [${name}] Error`));
|
|
1800
|
+
console.error(chalk24.gray(error));
|
|
1593
1801
|
console.log("\n");
|
|
1594
1802
|
resolve(1);
|
|
1595
1803
|
} else {
|
|
1596
|
-
console.log(
|
|
1804
|
+
console.log(chalk24.green(`License Checker [${name}]`));
|
|
1597
1805
|
let count = 0;
|
|
1598
1806
|
for (const [name2, info] of Object.entries(packages)) {
|
|
1599
1807
|
const licenses = Array.isArray(info.licenses) ? info.licenses : [info.licenses];
|
|
@@ -1609,7 +1817,7 @@ var license = async (pkg) => {
|
|
|
1609
1817
|
}
|
|
1610
1818
|
if (!orLicenseFound) {
|
|
1611
1819
|
count++;
|
|
1612
|
-
console.warn(
|
|
1820
|
+
console.warn(chalk24.yellow(`${name2}: Package License not allowed [${license2}]`));
|
|
1613
1821
|
}
|
|
1614
1822
|
}
|
|
1615
1823
|
}
|
|
@@ -1653,7 +1861,7 @@ var rebuild = ({ target }) => {
|
|
|
1653
1861
|
};
|
|
1654
1862
|
|
|
1655
1863
|
// src/actions/recompile.ts
|
|
1656
|
-
import
|
|
1864
|
+
import chalk25 from "chalk";
|
|
1657
1865
|
var recompile = async ({
|
|
1658
1866
|
verbose,
|
|
1659
1867
|
target,
|
|
@@ -1689,7 +1897,7 @@ var recompileAll = async ({
|
|
|
1689
1897
|
const incrementalOptions = incremental ? ["--since", "-Apt", "--topological-dev"] : ["--parallel", "-Apt", "--topological-dev"];
|
|
1690
1898
|
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
1691
1899
|
if (jobs) {
|
|
1692
|
-
console.log(
|
|
1900
|
+
console.log(chalk25.blue(`Jobs set to [${jobs}]`));
|
|
1693
1901
|
}
|
|
1694
1902
|
const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
|
|
1695
1903
|
[
|
|
@@ -1720,7 +1928,7 @@ var recompileAll = async ({
|
|
|
1720
1928
|
]
|
|
1721
1929
|
]);
|
|
1722
1930
|
console.log(
|
|
1723
|
-
`${
|
|
1931
|
+
`${chalk25.gray("Recompiled in")} [${chalk25.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk25.gray("seconds")}`
|
|
1724
1932
|
);
|
|
1725
1933
|
return result;
|
|
1726
1934
|
};
|
|
@@ -1751,13 +1959,13 @@ var reinstall = () => {
|
|
|
1751
1959
|
};
|
|
1752
1960
|
|
|
1753
1961
|
// src/actions/relint.ts
|
|
1754
|
-
import
|
|
1962
|
+
import chalk26 from "chalk";
|
|
1755
1963
|
var relintPackage = ({
|
|
1756
1964
|
pkg,
|
|
1757
1965
|
fix: fix2,
|
|
1758
1966
|
verbose
|
|
1759
1967
|
}) => {
|
|
1760
|
-
console.log(
|
|
1968
|
+
console.log(chalk26.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
1761
1969
|
const start = Date.now();
|
|
1762
1970
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
1763
1971
|
["yarn", [
|
|
@@ -1767,7 +1975,7 @@ var relintPackage = ({
|
|
|
1767
1975
|
fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
|
|
1768
1976
|
]]
|
|
1769
1977
|
]);
|
|
1770
|
-
console.log(
|
|
1978
|
+
console.log(chalk26.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk26.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk26.gray("seconds")}`));
|
|
1771
1979
|
return result;
|
|
1772
1980
|
};
|
|
1773
1981
|
var relint = ({
|
|
@@ -1787,13 +1995,13 @@ var relint = ({
|
|
|
1787
1995
|
});
|
|
1788
1996
|
};
|
|
1789
1997
|
var relintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
1790
|
-
console.log(
|
|
1998
|
+
console.log(chalk26.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
1791
1999
|
const start = Date.now();
|
|
1792
2000
|
const fixOptions = fix2 ? ["--fix"] : [];
|
|
1793
2001
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
1794
2002
|
["yarn", ["eslint", ...fixOptions]]
|
|
1795
2003
|
]);
|
|
1796
|
-
console.log(
|
|
2004
|
+
console.log(chalk26.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk26.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk26.gray("seconds")}`));
|
|
1797
2005
|
return result;
|
|
1798
2006
|
};
|
|
1799
2007
|
|
|
@@ -1811,10 +2019,10 @@ var sonar = () => {
|
|
|
1811
2019
|
};
|
|
1812
2020
|
|
|
1813
2021
|
// src/actions/statics.ts
|
|
1814
|
-
import
|
|
2022
|
+
import chalk27 from "chalk";
|
|
1815
2023
|
var DefaultDependencies = ["axios", "@xylabs/pixel", "react", "graphql", "react-router", "@mui/material", "@mui/system"];
|
|
1816
2024
|
var statics = () => {
|
|
1817
|
-
console.log(
|
|
2025
|
+
console.log(chalk27.green("Check Required Static Dependencies"));
|
|
1818
2026
|
const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
|
|
1819
2027
|
return detectDuplicateDependencies(statics2, DefaultDependencies);
|
|
1820
2028
|
};
|
|
@@ -1968,6 +2176,14 @@ var packagePositionalParam = (yargs2) => {
|
|
|
1968
2176
|
// src/xy/xyCommonCommands.ts
|
|
1969
2177
|
var xyCommonCommands = (args) => {
|
|
1970
2178
|
return args.command(
|
|
2179
|
+
"claude-commands",
|
|
2180
|
+
"Claude Commands - Sync XY Labs standard Claude slash commands to .claude/commands/",
|
|
2181
|
+
(yargs2) => yargs2,
|
|
2182
|
+
(argv) => {
|
|
2183
|
+
if (argv.verbose) console.log("Claude Commands");
|
|
2184
|
+
process.exitCode = claudeCommands();
|
|
2185
|
+
}
|
|
2186
|
+
).command(
|
|
1971
2187
|
"claude-rules",
|
|
1972
2188
|
"Claude Rules - Sync XY Labs standard Claude rules to .claude/rules/",
|
|
1973
2189
|
(yargs2) => {
|
|
@@ -2229,7 +2445,7 @@ var xyInstallCommands = (args) => {
|
|
|
2229
2445
|
};
|
|
2230
2446
|
|
|
2231
2447
|
// src/xy/xyLintCommands.ts
|
|
2232
|
-
import
|
|
2448
|
+
import chalk28 from "chalk";
|
|
2233
2449
|
var xyLintCommands = (args) => {
|
|
2234
2450
|
return args.command(
|
|
2235
2451
|
"cycle [package]",
|
|
@@ -2241,7 +2457,7 @@ var xyLintCommands = (args) => {
|
|
|
2241
2457
|
const start = Date.now();
|
|
2242
2458
|
if (argv.verbose) console.log("Cycle");
|
|
2243
2459
|
process.exitCode = await cycle({ pkg: argv.package });
|
|
2244
|
-
console.log(
|
|
2460
|
+
console.log(chalk28.blue(`Finished in ${Date.now() - start}ms`));
|
|
2245
2461
|
}
|
|
2246
2462
|
).command(
|
|
2247
2463
|
"lint [package]",
|
|
@@ -2271,7 +2487,7 @@ var xyLintCommands = (args) => {
|
|
|
2271
2487
|
cache: argv.cache,
|
|
2272
2488
|
verbose: !!argv.verbose
|
|
2273
2489
|
});
|
|
2274
|
-
console.log(
|
|
2490
|
+
console.log(chalk28.blue(`Finished in ${Date.now() - start}ms`));
|
|
2275
2491
|
}
|
|
2276
2492
|
).command(
|
|
2277
2493
|
"deplint [package]",
|
|
@@ -2292,19 +2508,25 @@ var xyLintCommands = (args) => {
|
|
|
2292
2508
|
default: false,
|
|
2293
2509
|
description: "Check peerDependencies",
|
|
2294
2510
|
type: "boolean"
|
|
2511
|
+
}).option("exclude", {
|
|
2512
|
+
alias: "e",
|
|
2513
|
+
description: "Package names to exclude from unused checks (comma-separated or repeated)",
|
|
2514
|
+
type: "array"
|
|
2295
2515
|
});
|
|
2296
2516
|
},
|
|
2297
|
-
(argv) => {
|
|
2517
|
+
async (argv) => {
|
|
2298
2518
|
if (argv.verbose) console.log("Deplint");
|
|
2299
2519
|
const start = Date.now();
|
|
2300
|
-
|
|
2520
|
+
const cliExclude = argv.exclude?.flatMap((v) => String(v).split(",")).map((v) => v.trim()).filter(Boolean);
|
|
2521
|
+
process.exitCode = await deplint({
|
|
2522
|
+
cliExclude,
|
|
2301
2523
|
pkg: argv.package,
|
|
2302
2524
|
deps: !!argv.deps,
|
|
2303
2525
|
devDeps: !!argv.devDeps,
|
|
2304
2526
|
peerDeps: !!argv.peerDeps,
|
|
2305
2527
|
verbose: !!argv.verbose
|
|
2306
2528
|
});
|
|
2307
|
-
console.log(
|
|
2529
|
+
console.log(chalk28.blue(`Finished in ${Date.now() - start}ms`));
|
|
2308
2530
|
}
|
|
2309
2531
|
).command(
|
|
2310
2532
|
"fix [package]",
|
|
@@ -2316,7 +2538,7 @@ var xyLintCommands = (args) => {
|
|
|
2316
2538
|
const start = Date.now();
|
|
2317
2539
|
if (argv.verbose) console.log("Fix");
|
|
2318
2540
|
process.exitCode = fix();
|
|
2319
|
-
console.log(
|
|
2541
|
+
console.log(chalk28.blue(`Finished in ${Date.now() - start}ms`));
|
|
2320
2542
|
}
|
|
2321
2543
|
).command(
|
|
2322
2544
|
"relint [package]",
|
|
@@ -2328,7 +2550,7 @@ var xyLintCommands = (args) => {
|
|
|
2328
2550
|
if (argv.verbose) console.log("Relinting");
|
|
2329
2551
|
const start = Date.now();
|
|
2330
2552
|
process.exitCode = relint();
|
|
2331
|
-
console.log(
|
|
2553
|
+
console.log(chalk28.blue(`Finished in ${Date.now() - start}ms`));
|
|
2332
2554
|
}
|
|
2333
2555
|
).command(
|
|
2334
2556
|
"publint [package]",
|
|
@@ -2340,7 +2562,7 @@ var xyLintCommands = (args) => {
|
|
|
2340
2562
|
if (argv.verbose) console.log("Publint");
|
|
2341
2563
|
const start = Date.now();
|
|
2342
2564
|
process.exitCode = await publint({ pkg: argv.package, verbose: !!argv.verbose });
|
|
2343
|
-
console.log(
|
|
2565
|
+
console.log(chalk28.blue(`Finished in ${Date.now() - start}ms`));
|
|
2344
2566
|
}
|
|
2345
2567
|
).command(
|
|
2346
2568
|
"knip",
|
|
@@ -2352,7 +2574,7 @@ var xyLintCommands = (args) => {
|
|
|
2352
2574
|
if (argv.verbose) console.log("Knip");
|
|
2353
2575
|
const start = Date.now();
|
|
2354
2576
|
process.exitCode = knip();
|
|
2355
|
-
console.log(
|
|
2577
|
+
console.log(chalk28.blue(`Knip finished in ${Date.now() - start}ms`));
|
|
2356
2578
|
}
|
|
2357
2579
|
).command(
|
|
2358
2580
|
"sonar",
|
|
@@ -2364,7 +2586,7 @@ var xyLintCommands = (args) => {
|
|
|
2364
2586
|
const start = Date.now();
|
|
2365
2587
|
if (argv.verbose) console.log("Sonar Check");
|
|
2366
2588
|
process.exitCode = sonar();
|
|
2367
|
-
console.log(
|
|
2589
|
+
console.log(chalk28.blue(`Finished in ${Date.now() - start}ms`));
|
|
2368
2590
|
}
|
|
2369
2591
|
);
|
|
2370
2592
|
};
|
|
@@ -2400,8 +2622,8 @@ var xyParseOptions = () => {
|
|
|
2400
2622
|
var xy = async () => {
|
|
2401
2623
|
const options = xyParseOptions();
|
|
2402
2624
|
return await xyBuildCommands(xyCommonCommands(xyInstallCommands(xyDeployCommands(xyLintCommands(options))))).demandCommand(1).command("*", "", () => {
|
|
2403
|
-
console.error(
|
|
2404
|
-
console.log(
|
|
2625
|
+
console.error(chalk29.yellow(`Command not found [${chalk29.magenta(process.argv[2])}]`));
|
|
2626
|
+
console.log(chalk29.gray("Try 'yarn xy --help' for list of commands"));
|
|
2405
2627
|
}).version().help().argv;
|
|
2406
2628
|
};
|
|
2407
2629
|
|