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