@xylabs/ts-scripts-yarn3 7.4.10 → 7.4.12

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.
Files changed (40) hide show
  1. package/dist/actions/deplint/checkPackage/checkPackage.mjs +115 -16
  2. package/dist/actions/deplint/checkPackage/checkPackage.mjs.map +1 -1
  3. package/dist/actions/deplint/checkPackage/getUnusedDependencies.mjs +2 -1
  4. package/dist/actions/deplint/checkPackage/getUnusedDependencies.mjs.map +1 -1
  5. package/dist/actions/deplint/checkPackage/getUnusedDevDependencies.mjs +114 -20
  6. package/dist/actions/deplint/checkPackage/getUnusedDevDependencies.mjs.map +1 -1
  7. package/dist/actions/deplint/checkPackage/getUnusedPeerDependencies.mjs +2 -1
  8. package/dist/actions/deplint/checkPackage/getUnusedPeerDependencies.mjs.map +1 -1
  9. package/dist/actions/deplint/checkPackage/index.mjs +115 -16
  10. package/dist/actions/deplint/checkPackage/index.mjs.map +1 -1
  11. package/dist/actions/deplint/deplint.mjs +166 -38
  12. package/dist/actions/deplint/deplint.mjs.map +1 -1
  13. package/dist/actions/deplint/getCliReferencedPackagesFromFiles.mjs +140 -0
  14. package/dist/actions/deplint/getCliReferencedPackagesFromFiles.mjs.map +1 -0
  15. package/dist/actions/deplint/getScriptReferencedPackages.mjs +3 -1
  16. package/dist/actions/deplint/getScriptReferencedPackages.mjs.map +1 -1
  17. package/dist/actions/deplint/index.mjs +166 -38
  18. package/dist/actions/deplint/index.mjs.map +1 -1
  19. package/dist/actions/index.mjs +441 -188
  20. package/dist/actions/index.mjs.map +1 -1
  21. package/dist/actions/readme-gen.mjs +173 -0
  22. package/dist/actions/readme-gen.mjs.map +1 -0
  23. package/dist/bin/xy.mjs +432 -130
  24. package/dist/bin/xy.mjs.map +1 -1
  25. package/dist/index.d.ts +39 -2
  26. package/dist/index.mjs +490 -207
  27. package/dist/index.mjs.map +1 -1
  28. package/dist/lib/generateReadmeFiles.mjs +160 -0
  29. package/dist/lib/generateReadmeFiles.mjs.map +1 -0
  30. package/dist/lib/index.mjs +145 -14
  31. package/dist/lib/index.mjs.map +1 -1
  32. package/dist/xy/index.mjs +432 -130
  33. package/dist/xy/index.mjs.map +1 -1
  34. package/dist/xy/xy.mjs +432 -130
  35. package/dist/xy/xy.mjs.map +1 -1
  36. package/dist/xy/xyCommonCommands.mjs +210 -42
  37. package/dist/xy/xyCommonCommands.mjs.map +1 -1
  38. package/dist/xy/xyLintCommands.mjs +205 -71
  39. package/dist/xy/xyLintCommands.mjs.map +1 -1
  40. package/package.json +2 -2
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 chalk28 from "chalk";
4
+ import chalk30 from "chalk";
5
5
 
6
6
  // src/actions/build.ts
7
- import chalk7 from "chalk";
7
+ import chalk9 from "chalk";
8
8
 
9
9
  // src/lib/checkResult.ts
10
10
  import chalk from "chalk";
@@ -326,10 +326,161 @@ var generateIgnoreFiles = (filename3, pkg) => {
326
326
  return succeeded ? 0 : 1;
327
327
  };
328
328
 
329
+ // src/lib/generateReadmeFiles.ts
330
+ import { execSync as execSync2 } from "child_process";
331
+ import FS from "fs";
332
+ import { readFile, writeFile } from "fs/promises";
333
+ import PATH2 from "path";
334
+ import chalk5 from "chalk";
335
+ function fillTemplate(template, data) {
336
+ const additionalData = { ...data, safeName: data.name.replaceAll("/", "__").replaceAll("@", "") };
337
+ return template.replaceAll(/\{\{(.*?)\}\}/g, (_, key) => additionalData[key.trim()] ?? "");
338
+ }
339
+ function generateTypedoc(packageLocation, entryPoints) {
340
+ const tempDir = PATH2.join(packageLocation, ".temp-typedoc");
341
+ try {
342
+ if (!FS.existsSync(tempDir)) {
343
+ FS.mkdirSync(tempDir, { recursive: true });
344
+ }
345
+ const typedocConfig = {
346
+ disableSources: true,
347
+ entryPointStrategy: "expand",
348
+ entryPoints: entryPoints.map((ep) => PATH2.resolve(packageLocation, ep)),
349
+ excludeExternals: true,
350
+ excludeInternal: true,
351
+ excludePrivate: true,
352
+ githubPages: false,
353
+ hideBreadcrumbs: true,
354
+ hideGenerator: true,
355
+ hidePageTitle: true,
356
+ out: tempDir,
357
+ plugin: ["typedoc-plugin-markdown"],
358
+ readme: "none",
359
+ skipErrorChecking: true,
360
+ sort: ["source-order"],
361
+ theme: "markdown",
362
+ useCodeBlocks: true
363
+ };
364
+ const typedocJsonPath = PATH2.join(tempDir, "typedoc.json");
365
+ FS.writeFileSync(typedocJsonPath, JSON.stringify(typedocConfig, null, 2));
366
+ try {
367
+ execSync2(`npx typedoc --options ${typedocJsonPath}`, {
368
+ cwd: process.cwd(),
369
+ stdio: ["ignore", "pipe", "pipe"]
370
+ });
371
+ } catch {
372
+ return "";
373
+ }
374
+ return consolidateMarkdown(tempDir);
375
+ } catch {
376
+ return "";
377
+ } finally {
378
+ try {
379
+ FS.rmSync(tempDir, { force: true, recursive: true });
380
+ } catch {
381
+ }
382
+ }
383
+ }
384
+ function consolidateMarkdown(tempDir) {
385
+ let consolidated = "## Reference\n\n";
386
+ const mainReadmePath = PATH2.join(tempDir, "README.md");
387
+ if (FS.existsSync(mainReadmePath)) {
388
+ const mainContent = FS.readFileSync(mainReadmePath, "utf8").replace(/^---(.|\n)*?---\n/, "").replace(/^# .+\n/, "").replaceAll(/\]\((.+?)\.md\)/g, "](#$1)");
389
+ consolidated += mainContent + "\n\n";
390
+ }
391
+ consolidated += processDirectory(tempDir);
392
+ return consolidated.replaceAll(/\n\n\n+/g, "\n\n").replaceAll(/^#### /gm, "### ").replaceAll(/^##### /gm, "#### ").replaceAll(/^###### /gm, "##### ");
393
+ }
394
+ function processDirectory(dir, level = 0) {
395
+ const indent = " ".repeat(level);
396
+ let content = "";
397
+ try {
398
+ const items = FS.readdirSync(dir, { withFileTypes: true });
399
+ for (const item of items) {
400
+ if (item.isDirectory()) continue;
401
+ if (item.name === "README.md" || !item.name.endsWith(".md")) continue;
402
+ const fileContent = FS.readFileSync(PATH2.join(dir, item.name), "utf8").replace(/^---(.|\n)*?---\n/, "");
403
+ const moduleName = item.name.replace(".md", "");
404
+ content += `
405
+
406
+ ${indent}### <a id="${moduleName}"></a>${moduleName}
407
+
408
+ `;
409
+ content += fileContent.replace(/^# .+\n/, "").replaceAll(/\]\((.+?)\.md\)/g, "](#$1)");
410
+ }
411
+ for (const item of items) {
412
+ if (!item.isDirectory()) continue;
413
+ if (item.name === "spec" || item.name.includes(".spec")) continue;
414
+ content += `
415
+
416
+ ${indent}### ${item.name}
417
+ `;
418
+ content += processDirectory(PATH2.join(dir, item.name), level + 1);
419
+ }
420
+ } catch {
421
+ }
422
+ return content;
423
+ }
424
+ async function generateReadmeFiles({
425
+ pkg,
426
+ templatePath,
427
+ typedoc = false,
428
+ verbose
429
+ }) {
430
+ console.log(chalk5.green("Generate README Files"));
431
+ const cwd = INIT_CWD() ?? ".";
432
+ const resolvedTemplatePath = templatePath ?? PATH2.join(cwd, "scripts", "README.template.md");
433
+ let template;
434
+ try {
435
+ template = await readFile(resolvedTemplatePath, "utf8");
436
+ } catch {
437
+ console.error(chalk5.red(`Template not found: ${resolvedTemplatePath}`));
438
+ return 1;
439
+ }
440
+ const workspaces = pkg ? [yarnWorkspace(pkg)] : yarnWorkspaces();
441
+ let failed = false;
442
+ for (const { location, name } of workspaces) {
443
+ try {
444
+ const pkgJsonPath = PATH2.join(location, "package.json");
445
+ const pkgJson = JSON.parse(await readFile(pkgJsonPath, "utf8"));
446
+ const typedocContent = typedoc ? generateTypedoc(location, ["src/index*.ts"]) : "";
447
+ const readmeContent = fillTemplate(template, { ...pkgJson, typedoc: typedocContent });
448
+ await writeFile(PATH2.join(location, "README.md"), readmeContent);
449
+ if (verbose) console.log(chalk5.green(` ${name}`));
450
+ } catch (ex) {
451
+ const error = ex;
452
+ console.warn(chalk5.yellow(` Skipped ${location}: ${error.message}`));
453
+ failed = true;
454
+ }
455
+ }
456
+ return failed ? 1 : 0;
457
+ }
458
+
459
+ // src/lib/loadConfig.ts
460
+ import chalk6 from "chalk";
461
+ import { cosmiconfig } from "cosmiconfig";
462
+ import { TypeScriptLoader } from "cosmiconfig-typescript-loader";
463
+ import deepmerge from "deepmerge";
464
+ var config;
465
+ var loadConfig = async (params) => {
466
+ if (config === void 0) {
467
+ const cosmicConfigResult = await cosmiconfig("xy", { cache: true, loaders: { ".ts": TypeScriptLoader() } }).search();
468
+ config = cosmicConfigResult?.config;
469
+ const configFilePath = cosmicConfigResult?.filepath;
470
+ if (configFilePath !== void 0) {
471
+ console.log(chalk6.green(`Loaded config from ${configFilePath}`));
472
+ if (config.verbose) {
473
+ console.log(chalk6.gray(`${JSON.stringify(config, null, 2)}`));
474
+ }
475
+ }
476
+ }
477
+ return deepmerge(config, params ?? {});
478
+ };
479
+
329
480
  // src/lib/parsedPackageJSON.ts
330
481
  import { readFileSync as readFileSync3 } from "fs";
331
- var parsedPackageJSON = (path7) => {
332
- const pathToPackageJSON = path7 ?? process.env.npm_package_json ?? "";
482
+ var parsedPackageJSON = (path8) => {
483
+ const pathToPackageJSON = path8 ?? process.env.npm_package_json ?? "";
333
484
  const packageJSON = readFileSync3(pathToPackageJSON).toString();
334
485
  return JSON.parse(packageJSON);
335
486
  };
@@ -337,22 +488,22 @@ var parsedPackageJSON = (path7) => {
337
488
  // src/lib/runSteps.ts
338
489
  import { spawnSync as spawnSync3 } from "child_process";
339
490
  import { existsSync as existsSync2 } from "fs";
340
- import chalk5 from "chalk";
491
+ import chalk7 from "chalk";
341
492
  var runSteps = (name, steps, exitOnFail = true, messages) => {
342
493
  return safeExit(() => {
343
494
  const pkgName = process.env.npm_package_name;
344
- console.log(chalk5.green(`${name} [${pkgName}]`));
495
+ console.log(chalk7.green(`${name} [${pkgName}]`));
345
496
  let totalStatus = 0;
346
- for (const [i, [command, args, config]] of steps.entries()) {
497
+ for (const [i, [command, args, config2]] of steps.entries()) {
347
498
  if (messages?.[i]) {
348
- console.log(chalk5.gray(messages?.[i]));
499
+ console.log(chalk7.gray(messages?.[i]));
349
500
  }
350
501
  const argList = Array.isArray(args) ? args : args.split(" ");
351
502
  if (command === "node" && !existsSync2(argList[0])) {
352
503
  throw new Error(`File not found [${argList[0]}]`);
353
504
  }
354
505
  const status = spawnSync3(command, Array.isArray(args) ? args : args.split(" "), {
355
- ...config,
506
+ ...config2,
356
507
  encoding: "utf8",
357
508
  env: { FORCE_COLOR: "3", ...process.env },
358
509
  shell: true,
@@ -368,27 +519,27 @@ var runSteps = (name, steps, exitOnFail = true, messages) => {
368
519
  // src/lib/runStepsAsync.ts
369
520
  import { spawn } from "child_process";
370
521
  import { existsSync as existsSync3 } from "fs";
371
- import chalk6 from "chalk";
522
+ import chalk8 from "chalk";
372
523
  var runStepAsync = (name, step, exitOnFail = true, message) => {
373
524
  return new Promise((resolve) => {
374
- const [command, args, config] = step;
525
+ const [command, args, config2] = step;
375
526
  if (message) {
376
- console.log(chalk6.gray(message));
527
+ console.log(chalk8.gray(message));
377
528
  }
378
529
  const argList = Array.isArray(args) ? args : args.split(" ");
379
530
  if (command === "node" && !existsSync3(argList[0])) {
380
531
  throw new Error(`File not found [${argList[0]}]`);
381
532
  }
382
533
  spawn(command, Array.isArray(args) ? args : args.split(" "), {
383
- ...config,
534
+ ...config2,
384
535
  env: { FORCE_COLOR: "3", ...process.env },
385
536
  shell: true,
386
537
  stdio: "inherit"
387
538
  }).on("close", (code) => {
388
539
  if (code) {
389
540
  console.error(
390
- chalk6.red(
391
- `Command Exited With Non-Zero Result [${chalk6.gray(code)}] | ${chalk6.yellow(command)} ${chalk6.white(
541
+ chalk8.red(
542
+ `Command Exited With Non-Zero Result [${chalk8.gray(code)}] | ${chalk8.yellow(command)} ${chalk8.white(
392
543
  Array.isArray(args) ? args.join(" ") : args
393
544
  )}`
394
545
  )
@@ -404,7 +555,7 @@ var runStepAsync = (name, step, exitOnFail = true, message) => {
404
555
  var runStepsAsync = async (name, steps, exitOnFail = true, messages) => {
405
556
  return await safeExitAsync(async () => {
406
557
  const pkgName = process.env.npm_package_name;
407
- console.log(chalk6.green(`${name} [${pkgName}]`));
558
+ console.log(chalk8.green(`${name} [${pkgName}]`));
408
559
  let result = 0;
409
560
  for (const [i, step] of steps.entries()) {
410
561
  result += await runStepAsync(name, step, exitOnFail, messages?.[i]);
@@ -428,7 +579,7 @@ var build = async ({
428
579
  const targetOptions = target === void 0 ? [] : ["-t", target];
429
580
  const jobsOptions = jobs === void 0 ? [] : ["-j", `${jobs}`];
430
581
  if (jobs !== void 0) {
431
- console.log(chalk7.blue(`Jobs set to [${jobs}]`));
582
+ console.log(chalk9.blue(`Jobs set to [${jobs}]`));
432
583
  }
433
584
  const result = await runStepsAsync(`Build${incremental ? "-Incremental" : ""} [${pkg ?? "All"}]`, [
434
585
  ["yarn", ["xy", "compile", ...pkgOptions, ...targetOptions, ...verboseOptions, ...jobsOptions, ...incrementalOptions, "--types", "tsup"]],
@@ -436,7 +587,7 @@ var build = async ({
436
587
  ["yarn", ["xy", "deplint", ...pkgOptions, ...verboseOptions, ...jobsOptions, ...incrementalOptions]],
437
588
  ["yarn", ["xy", "lint", ...pkgOptions, ...verboseOptions, ...incrementalOptions]]
438
589
  ]);
439
- console.log(`${chalk7.gray("Built in")} [${chalk7.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk7.gray("seconds")}`);
590
+ console.log(`${chalk9.gray("Built in")} [${chalk9.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk9.gray("seconds")}`);
440
591
  return result;
441
592
  };
442
593
 
@@ -449,15 +600,15 @@ import {
449
600
  unlinkSync,
450
601
  writeFileSync as writeFileSync2
451
602
  } from "fs";
452
- import PATH2 from "path";
453
- import chalk8 from "chalk";
603
+ import PATH3 from "path";
604
+ import chalk10 from "chalk";
454
605
  var syncCommandFiles = (commandsDir) => {
455
606
  const templates = claudeCommandTemplates();
456
607
  const templateNames = new Set(Object.keys(templates));
457
608
  let updated = 0;
458
609
  let created = 0;
459
610
  for (const [filename3, content] of Object.entries(templates)) {
460
- const targetPath = PATH2.resolve(commandsDir, filename3);
611
+ const targetPath = PATH3.resolve(commandsDir, filename3);
461
612
  const existing = existsSync4(targetPath) ? readFileSync4(targetPath, "utf8") : void 0;
462
613
  if (existing === content) continue;
463
614
  writeFileSync2(targetPath, content, "utf8");
@@ -478,7 +629,7 @@ var removeStaleCommands = (commandsDir, templateNames) => {
478
629
  let removed = 0;
479
630
  for (const file of existingCommands) {
480
631
  if (!templateNames.has(file)) {
481
- unlinkSync(PATH2.resolve(commandsDir, file));
632
+ unlinkSync(PATH3.resolve(commandsDir, file));
482
633
  removed++;
483
634
  }
484
635
  }
@@ -491,14 +642,14 @@ var logCommandsResult = (created, updated, removed) => {
491
642
  updated ? `${updated} updated` : "",
492
643
  removed ? `${removed} removed` : ""
493
644
  ].filter(Boolean);
494
- console.log(chalk8.green(`.claude/commands/${XYLABS_COMMANDS_PREFIX}*.md: ${parts.join(", ")}`));
645
+ console.log(chalk10.green(`.claude/commands/${XYLABS_COMMANDS_PREFIX}*.md: ${parts.join(", ")}`));
495
646
  } else {
496
- console.log(chalk8.gray(`.claude/commands/${XYLABS_COMMANDS_PREFIX}*.md: already up to date`));
647
+ console.log(chalk10.gray(`.claude/commands/${XYLABS_COMMANDS_PREFIX}*.md: already up to date`));
497
648
  }
498
649
  };
499
650
  var claudeCommands = () => {
500
651
  const cwd = INIT_CWD() ?? process.cwd();
501
- const commandsDir = PATH2.resolve(cwd, ".claude", "commands");
652
+ const commandsDir = PATH3.resolve(cwd, ".claude", "commands");
502
653
  mkdirSync(commandsDir, { recursive: true });
503
654
  const {
504
655
  created,
@@ -519,15 +670,15 @@ import {
519
670
  unlinkSync as unlinkSync2,
520
671
  writeFileSync as writeFileSync3
521
672
  } from "fs";
522
- import PATH3 from "path";
523
- import chalk9 from "chalk";
673
+ import PATH4 from "path";
674
+ import chalk11 from "chalk";
524
675
  var syncRuleFiles = (rulesDir) => {
525
676
  const templates = claudeMdRuleTemplates();
526
677
  const templateNames = new Set(Object.keys(templates));
527
678
  let updated = 0;
528
679
  let created = 0;
529
680
  for (const [filename3, content] of Object.entries(templates)) {
530
- const targetPath = PATH3.resolve(rulesDir, filename3);
681
+ const targetPath = PATH4.resolve(rulesDir, filename3);
531
682
  const existing = existsSync5(targetPath) ? readFileSync5(targetPath, "utf8") : void 0;
532
683
  if (existing === content) continue;
533
684
  writeFileSync3(targetPath, content, "utf8");
@@ -548,7 +699,7 @@ var removeStaleRules = (rulesDir, templateNames) => {
548
699
  let removed = 0;
549
700
  for (const file of existingRules) {
550
701
  if (!templateNames.has(file)) {
551
- unlinkSync2(PATH3.resolve(rulesDir, file));
702
+ unlinkSync2(PATH4.resolve(rulesDir, file));
552
703
  removed++;
553
704
  }
554
705
  }
@@ -561,26 +712,26 @@ var logRulesResult = (created, updated, removed) => {
561
712
  updated ? `${updated} updated` : "",
562
713
  removed ? `${removed} removed` : ""
563
714
  ].filter(Boolean);
564
- console.log(chalk9.green(`.claude/rules/${XYLABS_RULES_PREFIX}*.md: ${parts.join(", ")}`));
715
+ console.log(chalk11.green(`.claude/rules/${XYLABS_RULES_PREFIX}*.md: ${parts.join(", ")}`));
565
716
  } else {
566
- console.log(chalk9.gray(`.claude/rules/${XYLABS_RULES_PREFIX}*.md: already up to date`));
717
+ console.log(chalk11.gray(`.claude/rules/${XYLABS_RULES_PREFIX}*.md: already up to date`));
567
718
  }
568
719
  };
569
720
  var ensureProjectClaudeMd = (cwd, force) => {
570
- const projectPath = PATH3.resolve(cwd, "CLAUDE.md");
721
+ const projectPath = PATH4.resolve(cwd, "CLAUDE.md");
571
722
  if (!existsSync5(projectPath) || force) {
572
723
  if (force && existsSync5(projectPath)) {
573
- console.log(chalk9.yellow("Overwriting existing CLAUDE.md"));
724
+ console.log(chalk11.yellow("Overwriting existing CLAUDE.md"));
574
725
  }
575
726
  writeFileSync3(projectPath, claudeMdProjectTemplate(), "utf8");
576
- console.log(chalk9.green("Generated CLAUDE.md"));
727
+ console.log(chalk11.green("Generated CLAUDE.md"));
577
728
  } else {
578
- console.log(chalk9.gray("CLAUDE.md already exists (skipped)"));
729
+ console.log(chalk11.gray("CLAUDE.md already exists (skipped)"));
579
730
  }
580
731
  };
581
732
  var claudeRules = ({ force } = {}) => {
582
733
  const cwd = INIT_CWD() ?? process.cwd();
583
- const rulesDir = PATH3.resolve(cwd, ".claude", "rules");
734
+ const rulesDir = PATH4.resolve(cwd, ".claude", "rules");
584
735
  mkdirSync2(rulesDir, { recursive: true });
585
736
  const {
586
737
  created,
@@ -607,16 +758,16 @@ var cleanAll = ({ verbose }) => {
607
758
 
608
759
  // src/actions/clean-docs.ts
609
760
  import path from "path";
610
- import chalk10 from "chalk";
761
+ import chalk12 from "chalk";
611
762
  var cleanDocs = () => {
612
763
  const pkgName = process.env.npm_package_name;
613
- console.log(chalk10.green(`Cleaning Docs [${pkgName}]`));
764
+ console.log(chalk12.green(`Cleaning Docs [${pkgName}]`));
614
765
  for (const { location } of yarnWorkspaces()) deleteGlob(path.join(location, "docs"));
615
766
  return 0;
616
767
  };
617
768
 
618
769
  // src/actions/compile.ts
619
- import chalk11 from "chalk";
770
+ import chalk13 from "chalk";
620
771
  var compile = ({
621
772
  verbose,
622
773
  target,
@@ -657,7 +808,7 @@ var compileAll = ({
657
808
  const incrementalOptions = incremental ? ["--since", "-Ap", "--topological-dev"] : ["--parallel", "-Ap", "--topological-dev"];
658
809
  const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
659
810
  if (jobs) {
660
- console.log(chalk11.blue(`Jobs set to [${jobs}]`));
811
+ console.log(chalk13.blue(`Jobs set to [${jobs}]`));
661
812
  }
662
813
  const result = runSteps(`Compile${incremental ? "-Incremental" : ""} [All]`, [
663
814
  ["yarn", [
@@ -671,13 +822,13 @@ var compileAll = ({
671
822
  ...targetOptions
672
823
  ]]
673
824
  ]);
674
- console.log(`${chalk11.gray("Compiled in")} [${chalk11.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk11.gray("seconds")}`);
825
+ console.log(`${chalk13.gray("Compiled in")} [${chalk13.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk13.gray("seconds")}`);
675
826
  return result;
676
827
  };
677
828
 
678
829
  // src/actions/copy-assets.ts
679
830
  import path2 from "path/posix";
680
- import chalk12 from "chalk";
831
+ import chalk14 from "chalk";
681
832
  import cpy from "cpy";
682
833
  var copyPackageTargetAssets = async (target, name, location) => {
683
834
  try {
@@ -700,7 +851,7 @@ var copyPackageTargetAssets = async (target, name, location) => {
700
851
  };
701
852
  var copyTargetAssets = async (target, pkg) => {
702
853
  const workspaces = yarnWorkspaces();
703
- console.log(chalk12.green(`Copying Assets [${target.toUpperCase()}]`));
854
+ console.log(chalk14.green(`Copying Assets [${target.toUpperCase()}]`));
704
855
  const workspaceList = workspaces.filter(({ name }) => {
705
856
  return pkg === void 0 || name === pkg;
706
857
  });
@@ -784,7 +935,7 @@ var dead = () => {
784
935
  };
785
936
 
786
937
  // src/actions/deplint/deplint.ts
787
- import chalk18 from "chalk";
938
+ import chalk20 from "chalk";
788
939
 
789
940
  // src/actions/deplint/findFiles.ts
790
941
  import fs2 from "fs";
@@ -960,11 +1111,11 @@ function getExternalImportsFromFiles({
960
1111
  const allImportPaths = {};
961
1112
  const distImportPaths = {};
962
1113
  const distTypeImportPaths = {};
963
- for (const path7 of allFiles) getImportsFromFile(path7, allImportPaths, allImportPaths).flat();
1114
+ for (const path8 of allFiles) getImportsFromFile(path8, allImportPaths, allImportPaths).flat();
964
1115
  const distTypeFiles = distFiles.filter(isDeclarationFile);
965
1116
  const distCodeFiles = distFiles.filter((file) => !isDeclarationFile(file));
966
- for (const path7 of distCodeFiles) getImportsFromFile(path7, distImportPaths, distImportPaths).flat();
967
- for (const path7 of distTypeFiles) getImportsFromFile(path7, distTypeImportPaths, distTypeImportPaths).flat();
1117
+ for (const path8 of distCodeFiles) getImportsFromFile(path8, distImportPaths, distImportPaths).flat();
1118
+ for (const path8 of distTypeFiles) getImportsFromFile(path8, distTypeImportPaths, distTypeImportPaths).flat();
968
1119
  const allImports = Object.keys(allImportPaths);
969
1120
  const distImports = Object.keys(distImportPaths);
970
1121
  const externalAllImports = removeInternalImports(allImports);
@@ -986,12 +1137,12 @@ function getExternalImportsFromFiles({
986
1137
 
987
1138
  // src/actions/deplint/checkPackage/getUnlistedDependencies.ts
988
1139
  import { builtinModules } from "module";
989
- import chalk13 from "chalk";
1140
+ import chalk15 from "chalk";
990
1141
  function isListedOrBuiltin(imp, name, dependencies, peerDependencies) {
991
1142
  return dependencies.includes(imp) || imp === name || dependencies.includes(`@types/${imp}`) || peerDependencies.includes(imp) || peerDependencies.includes(`@types/${imp}`) || builtinModules.includes(imp) || builtinModules.includes(`@types/${imp}`);
992
1143
  }
993
1144
  function logMissing(name, imp, importPaths) {
994
- console.log(`[${chalk13.blue(name)}] Missing dependency in package.json: ${chalk13.red(imp)}`);
1145
+ console.log(`[${chalk15.blue(name)}] Missing dependency in package.json: ${chalk15.red(imp)}`);
995
1146
  if (importPaths[imp]) {
996
1147
  console.log(` ${importPaths[imp].join("\n ")}`);
997
1148
  }
@@ -1016,7 +1167,7 @@ function getUnlistedDependencies({ name, location }, { dependencies, peerDepende
1016
1167
  }
1017
1168
  if (unlistedDependencies > 0) {
1018
1169
  const packageLocation = `${location}/package.json`;
1019
- console.log(` ${chalk13.yellow(packageLocation)}
1170
+ console.log(` ${chalk15.yellow(packageLocation)}
1020
1171
  `);
1021
1172
  }
1022
1173
  return unlistedDependencies;
@@ -1024,7 +1175,7 @@ function getUnlistedDependencies({ name, location }, { dependencies, peerDepende
1024
1175
 
1025
1176
  // src/actions/deplint/checkPackage/getUnlistedDevDependencies.ts
1026
1177
  import { builtinModules as builtinModules2 } from "module";
1027
- import chalk14 from "chalk";
1178
+ import chalk16 from "chalk";
1028
1179
  function getUnlistedDevDependencies({ name, location }, {
1029
1180
  devDependencies,
1030
1181
  dependencies,
@@ -1038,7 +1189,7 @@ function getUnlistedDevDependencies({ name, location }, {
1038
1189
  for (const imp of externalAllImports) {
1039
1190
  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)) {
1040
1191
  unlistedDevDependencies++;
1041
- console.log(`[${chalk14.blue(name)}] Missing devDependency in package.json: ${chalk14.red(imp)}`);
1192
+ console.log(`[${chalk16.blue(name)}] Missing devDependency in package.json: ${chalk16.red(imp)}`);
1042
1193
  if (allImportPaths[imp]) {
1043
1194
  console.log(` ${allImportPaths[imp].join("\n ")}`);
1044
1195
  }
@@ -1046,40 +1197,50 @@ function getUnlistedDevDependencies({ name, location }, {
1046
1197
  }
1047
1198
  if (unlistedDevDependencies > 0) {
1048
1199
  const packageLocation = `${location}/package.json`;
1049
- console.log(` ${chalk14.yellow(packageLocation)}
1200
+ console.log(` ${chalk16.yellow(packageLocation)}
1050
1201
  `);
1051
1202
  }
1052
1203
  return unlistedDevDependencies;
1053
1204
  }
1054
1205
 
1055
1206
  // src/actions/deplint/checkPackage/getUnusedDependencies.ts
1056
- import chalk15 from "chalk";
1207
+ import chalk17 from "chalk";
1057
1208
  function getUnusedDependencies({ name, location }, { dependencies }, {
1058
1209
  externalDistImports,
1059
1210
  externalDistTypeImports,
1060
1211
  externalAllImports
1061
- }) {
1212
+ }, exclude) {
1062
1213
  let unusedDependencies = 0;
1063
1214
  for (const dep of dependencies) {
1215
+ if (exclude?.has(dep)) continue;
1064
1216
  if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
1065
1217
  unusedDependencies++;
1066
1218
  if (externalAllImports.includes(dep)) {
1067
- console.log(`[${chalk15.blue(name)}] dependency should be devDependency in package.json: ${chalk15.red(dep)}`);
1219
+ console.log(`[${chalk17.blue(name)}] dependency should be devDependency in package.json: ${chalk17.red(dep)}`);
1068
1220
  } else {
1069
- console.log(`[${chalk15.blue(name)}] Unused dependency in package.json: ${chalk15.red(dep)}`);
1221
+ console.log(`[${chalk17.blue(name)}] Unused dependency in package.json: ${chalk17.red(dep)}`);
1070
1222
  }
1071
1223
  }
1072
1224
  }
1073
1225
  if (unusedDependencies > 0) {
1074
1226
  const packageLocation = `${location}/package.json`;
1075
- console.log(` ${chalk15.yellow(packageLocation)}
1227
+ console.log(` ${chalk17.yellow(packageLocation)}
1076
1228
  `);
1077
1229
  }
1078
1230
  return unusedDependencies;
1079
1231
  }
1080
1232
 
1081
1233
  // src/actions/deplint/checkPackage/getUnusedDevDependencies.ts
1082
- import chalk16 from "chalk";
1234
+ import chalk18 from "chalk";
1235
+
1236
+ // src/actions/deplint/getCliReferencedPackagesFromFiles.ts
1237
+ import fs8 from "fs";
1238
+ import path7 from "path";
1239
+ import ts2 from "typescript";
1240
+
1241
+ // src/actions/deplint/getScriptReferencedPackages.ts
1242
+ import fs7 from "fs";
1243
+ import path6 from "path";
1083
1244
 
1084
1245
  // src/actions/deplint/getRequiredPeerDependencies.ts
1085
1246
  import fs6 from "fs";
@@ -1114,8 +1275,6 @@ function getRequiredPeerDependencies(location, allDeps) {
1114
1275
  }
1115
1276
 
1116
1277
  // src/actions/deplint/getScriptReferencedPackages.ts
1117
- import fs7 from "fs";
1118
- import path6 from "path";
1119
1278
  function getBinNames(location, dep) {
1120
1279
  const depPkgPath = findDepPackageJson(location, dep);
1121
1280
  if (!depPkgPath) return [];
@@ -1165,15 +1324,101 @@ function getScriptReferencedPackages(location, allDeps) {
1165
1324
  return referenced;
1166
1325
  }
1167
1326
 
1327
+ // src/actions/deplint/getCliReferencedPackagesFromFiles.ts
1328
+ var shellCommandFunctions = /* @__PURE__ */ new Set(["execSync", "exec"]);
1329
+ var directExecFunctions = /* @__PURE__ */ new Set(["spawn", "spawnSync", "execFile", "execFileSync"]);
1330
+ var allExecFunctions = /* @__PURE__ */ new Set([...shellCommandFunctions, ...directExecFunctions]);
1331
+ function getCommandTokensFromFile(filePath) {
1332
+ const tokens = /* @__PURE__ */ new Set();
1333
+ let sourceCode;
1334
+ try {
1335
+ sourceCode = fs8.readFileSync(filePath, "utf8");
1336
+ } catch {
1337
+ return tokens;
1338
+ }
1339
+ const isMjsFile = filePath.endsWith(".mjs");
1340
+ const sourceFile = ts2.createSourceFile(
1341
+ path7.basename(filePath),
1342
+ sourceCode,
1343
+ ts2.ScriptTarget.Latest,
1344
+ true,
1345
+ isMjsFile ? ts2.ScriptKind.JS : void 0
1346
+ );
1347
+ function visit(node) {
1348
+ if (ts2.isCallExpression(node) && node.arguments.length > 0) {
1349
+ const fnName = getFunctionName(node.expression);
1350
+ if (fnName && allExecFunctions.has(fnName)) {
1351
+ const firstArg = node.arguments[0];
1352
+ if (ts2.isStringLiteral(firstArg) || ts2.isNoSubstitutionTemplateLiteral(firstArg)) {
1353
+ const value = firstArg.text;
1354
+ if (shellCommandFunctions.has(fnName)) {
1355
+ for (const token of tokenizeScript(value)) {
1356
+ tokens.add(token);
1357
+ }
1358
+ } else {
1359
+ tokens.add(value);
1360
+ }
1361
+ } else if (ts2.isTemplateExpression(firstArg)) {
1362
+ const head = firstArg.head.text;
1363
+ if (head) {
1364
+ for (const token of tokenizeScript(head)) {
1365
+ tokens.add(token);
1366
+ }
1367
+ }
1368
+ }
1369
+ }
1370
+ }
1371
+ ts2.forEachChild(node, visit);
1372
+ }
1373
+ visit(sourceFile);
1374
+ return tokens;
1375
+ }
1376
+ function getFunctionName(expr) {
1377
+ if (ts2.isIdentifier(expr)) {
1378
+ return expr.text;
1379
+ }
1380
+ if (ts2.isPropertyAccessExpression(expr) && ts2.isIdentifier(expr.name)) {
1381
+ return expr.name.text;
1382
+ }
1383
+ return void 0;
1384
+ }
1385
+ function getCliReferencedPackagesFromFiles(allFiles, location, allDeps) {
1386
+ const allTokens = /* @__PURE__ */ new Set();
1387
+ for (const file of allFiles) {
1388
+ for (const token of getCommandTokensFromFile(file)) {
1389
+ allTokens.add(token);
1390
+ }
1391
+ }
1392
+ if (allTokens.size === 0) return /* @__PURE__ */ new Set();
1393
+ const binToPackage = /* @__PURE__ */ new Map();
1394
+ for (const dep of allDeps) {
1395
+ for (const bin of getBinNames(location, dep)) {
1396
+ binToPackage.set(bin, dep);
1397
+ }
1398
+ }
1399
+ const referenced = /* @__PURE__ */ new Set();
1400
+ for (const token of allTokens) {
1401
+ const baseName = getBasePackageName(token);
1402
+ if (allDeps.includes(baseName)) {
1403
+ referenced.add(baseName);
1404
+ }
1405
+ const pkg = binToPackage.get(token);
1406
+ if (pkg) {
1407
+ referenced.add(pkg);
1408
+ }
1409
+ }
1410
+ return referenced;
1411
+ }
1412
+
1168
1413
  // src/actions/deplint/implicitDevDependencies.ts
1169
- import fs8 from "fs";
1414
+ import fs9 from "fs";
1170
1415
  var hasFileWithExtension = (files, extensions) => files.some((f) => extensions.some((ext) => f.endsWith(ext)));
1171
1416
  var tsExtensions = [".ts", ".tsx", ".mts", ".cts"];
1172
1417
  var hasTypescriptFiles = ({ allFiles }) => hasFileWithExtension(allFiles, tsExtensions);
1173
1418
  var decoratorPattern = /^\s*@[a-zA-Z]\w*/m;
1174
1419
  var hasDecorators = ({ allFiles }) => allFiles.filter((f) => tsExtensions.some((ext) => f.endsWith(ext))).some((file) => {
1175
1420
  try {
1176
- const content = fs8.readFileSync(file, "utf8");
1421
+ const content = fs9.readFileSync(file, "utf8");
1177
1422
  return decoratorPattern.test(content);
1178
1423
  } catch {
1179
1424
  return false;
@@ -1186,7 +1431,7 @@ function hasImportPlugin({ location, allDependencies }) {
1186
1431
  const pkgPath = findDepPackageJson(location, dep);
1187
1432
  if (!pkgPath) continue;
1188
1433
  try {
1189
- const pkg = JSON.parse(fs8.readFileSync(pkgPath, "utf8"));
1434
+ const pkg = JSON.parse(fs9.readFileSync(pkgPath, "utf8"));
1190
1435
  const transitiveDeps = [
1191
1436
  ...Object.keys(pkg.dependencies ?? {}),
1192
1437
  ...Object.keys(pkg.peerDependencies ?? {})
@@ -1238,10 +1483,11 @@ var allExternalImports = ({
1238
1483
  ...externalDistTypeImports
1239
1484
  ]);
1240
1485
  };
1241
- function isDevDepUsed(dep, allImports, implicitDeps, requiredPeers, scriptRefs) {
1486
+ function isDevDepUsed(dep, allImports, implicitDeps, requiredPeers, scriptRefs, cliRefs) {
1242
1487
  if (implicitDeps.has(dep)) return true;
1243
1488
  if (requiredPeers.has(dep)) return true;
1244
1489
  if (scriptRefs.has(dep)) return true;
1490
+ if (cliRefs.has(dep)) return true;
1245
1491
  if (dep.startsWith("@types/")) {
1246
1492
  const baseName = dep.replace(/^@types\//, "");
1247
1493
  return allImports.has(baseName) || allImports.has(dep) || implicitDeps.has(baseName);
@@ -1252,7 +1498,7 @@ function getUnusedDevDependencies({ name, location }, {
1252
1498
  devDependencies,
1253
1499
  dependencies,
1254
1500
  peerDependencies
1255
- }, sourceParams, fileContext) {
1501
+ }, sourceParams, fileContext, exclude) {
1256
1502
  const allImports = allExternalImports(sourceParams);
1257
1503
  const allDeps = [...dependencies, ...devDependencies, ...peerDependencies];
1258
1504
  const implicitDeps = getImplicitDevDependencies({
@@ -1262,39 +1508,42 @@ function getUnusedDevDependencies({ name, location }, {
1262
1508
  });
1263
1509
  const requiredPeers = getRequiredPeerDependencies(location, allDeps);
1264
1510
  const scriptRefs = getScriptReferencedPackages(location, allDeps);
1511
+ const cliRefs = getCliReferencedPackagesFromFiles(fileContext.allFiles, location, allDeps);
1265
1512
  let unusedDevDependencies = 0;
1266
1513
  for (const dep of devDependencies) {
1514
+ if (exclude?.has(dep)) continue;
1267
1515
  if (dependencies.includes(dep) || peerDependencies.includes(dep)) continue;
1268
- if (!isDevDepUsed(dep, allImports, implicitDeps, requiredPeers, scriptRefs)) {
1516
+ if (!isDevDepUsed(dep, allImports, implicitDeps, requiredPeers, scriptRefs, cliRefs)) {
1269
1517
  unusedDevDependencies++;
1270
- console.log(`[${chalk16.blue(name)}] Unused devDependency in package.json: ${chalk16.red(dep)}`);
1518
+ console.log(`[${chalk18.blue(name)}] Unused devDependency in package.json: ${chalk18.red(dep)}`);
1271
1519
  }
1272
1520
  }
1273
1521
  if (unusedDevDependencies > 0) {
1274
1522
  const packageLocation = `${location}/package.json`;
1275
- console.log(` ${chalk16.yellow(packageLocation)}
1523
+ console.log(` ${chalk18.yellow(packageLocation)}
1276
1524
  `);
1277
1525
  }
1278
1526
  return unusedDevDependencies;
1279
1527
  }
1280
1528
 
1281
1529
  // src/actions/deplint/checkPackage/getUnusedPeerDependencies.ts
1282
- import chalk17 from "chalk";
1283
- function getUnusedPeerDependencies({ name, location }, { peerDependencies, dependencies }, { externalDistImports, externalDistTypeImports }) {
1530
+ import chalk19 from "chalk";
1531
+ function getUnusedPeerDependencies({ name, location }, { peerDependencies, dependencies }, { externalDistImports, externalDistTypeImports }, exclude) {
1284
1532
  let unusedDependencies = 0;
1285
1533
  for (const dep of peerDependencies) {
1534
+ if (exclude?.has(dep)) continue;
1286
1535
  if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
1287
1536
  unusedDependencies++;
1288
1537
  if (dependencies.includes(dep)) {
1289
- console.log(`[${chalk17.blue(name)}] Unused peerDependency [already a dependency] in package.json: ${chalk17.red(dep)}`);
1538
+ console.log(`[${chalk19.blue(name)}] Unused peerDependency [already a dependency] in package.json: ${chalk19.red(dep)}`);
1290
1539
  } else {
1291
- console.log(`[${chalk17.blue(name)}] Unused peerDependency in package.json: ${chalk17.red(dep)}`);
1540
+ console.log(`[${chalk19.blue(name)}] Unused peerDependency in package.json: ${chalk19.red(dep)}`);
1292
1541
  }
1293
1542
  }
1294
1543
  }
1295
1544
  if (unusedDependencies > 0) {
1296
1545
  const packageLocation = `${location}/package.json`;
1297
- console.log(` ${chalk17.yellow(packageLocation)}
1546
+ console.log(` ${chalk19.yellow(packageLocation)}
1298
1547
  `);
1299
1548
  }
1300
1549
  return unusedDependencies;
@@ -1319,6 +1568,7 @@ function checkPackage({
1319
1568
  location,
1320
1569
  deps = false,
1321
1570
  devDeps = false,
1571
+ exclude,
1322
1572
  peerDeps = false,
1323
1573
  verbose = false
1324
1574
  }) {
@@ -1337,23 +1587,29 @@ function checkPackage({
1337
1587
  });
1338
1588
  const packageParams = getDependenciesFromPackageJson(`${location}/package.json`);
1339
1589
  const unlistedDependencies = checkDeps ? getUnlistedDependencies({ name, location }, packageParams, sourceParams) : 0;
1340
- const unusedDependencies = checkDeps ? getUnusedDependencies({ name, location }, packageParams, sourceParams) : 0;
1590
+ const unusedDependencies = checkDeps ? getUnusedDependencies({ name, location }, packageParams, sourceParams, exclude) : 0;
1341
1591
  const unlistedDevDependencies = checkDevDeps ? getUnlistedDevDependencies({ name, location }, packageParams, sourceParams) : 0;
1342
1592
  const fileContext = { allFiles, distFiles };
1343
- const unusedDevDependencies = checkDevDeps ? getUnusedDevDependencies({ name, location }, packageParams, sourceParams, fileContext) : 0;
1344
- const unusedPeerDependencies = checkPeerDeps ? getUnusedPeerDependencies({ name, location }, packageParams, sourceParams) : 0;
1593
+ const unusedDevDependencies = checkDevDeps ? getUnusedDevDependencies({ name, location }, packageParams, sourceParams, fileContext, exclude) : 0;
1594
+ const unusedPeerDependencies = checkPeerDeps ? getUnusedPeerDependencies({ name, location }, packageParams, sourceParams, exclude) : 0;
1345
1595
  const totalErrors = unlistedDependencies + unlistedDevDependencies + unusedDependencies + unusedDevDependencies + unusedPeerDependencies;
1346
1596
  return totalErrors;
1347
1597
  }
1348
1598
 
1349
1599
  // src/actions/deplint/deplint.ts
1350
- var deplint = ({
1600
+ var deplint = async ({
1351
1601
  pkg,
1352
1602
  deps,
1353
1603
  devDeps,
1354
1604
  peerDeps,
1355
- verbose
1605
+ verbose,
1606
+ cliExclude
1356
1607
  }) => {
1608
+ const config2 = await loadConfig();
1609
+ const exclude = /* @__PURE__ */ new Set([
1610
+ ...config2.deplint?.exclude ?? [],
1611
+ ...cliExclude ?? []
1612
+ ]);
1357
1613
  let totalErrors = 0;
1358
1614
  if (pkg === void 0) {
1359
1615
  const workspaces = yarnWorkspaces();
@@ -1363,6 +1619,7 @@ var deplint = ({
1363
1619
  ...workspace,
1364
1620
  deps,
1365
1621
  devDeps,
1622
+ exclude,
1366
1623
  peerDeps,
1367
1624
  verbose
1368
1625
  });
@@ -1375,14 +1632,15 @@ var deplint = ({
1375
1632
  location,
1376
1633
  devDeps,
1377
1634
  deps,
1635
+ exclude,
1378
1636
  peerDeps,
1379
1637
  verbose
1380
1638
  });
1381
1639
  }
1382
1640
  if (totalErrors > 0) {
1383
- console.warn(`Deplint: Found ${chalk18.red(totalErrors)} dependency problems. ${chalk18.red("\u2716")}`);
1641
+ console.warn(`Deplint: Found ${chalk20.red(totalErrors)} dependency problems. ${chalk20.red("\u2716")}`);
1384
1642
  } else {
1385
- console.info(`Deplint: Found no dependency problems. ${chalk18.green("\u2714")}`);
1643
+ console.info(`Deplint: Found no dependency problems. ${chalk20.green("\u2714")}`);
1386
1644
  }
1387
1645
  return 0;
1388
1646
  };
@@ -1484,22 +1742,22 @@ var deployNext = () => {
1484
1742
  };
1485
1743
 
1486
1744
  // src/actions/dupdeps.ts
1487
- import chalk19 from "chalk";
1745
+ import chalk21 from "chalk";
1488
1746
  var dupdeps = () => {
1489
- console.log(chalk19.green("Checking all Dependencies for Duplicates"));
1747
+ console.log(chalk21.green("Checking all Dependencies for Duplicates"));
1490
1748
  const allDependencies = parsedPackageJSON()?.dependencies;
1491
1749
  const dependencies = Object.entries(allDependencies).map(([k]) => k);
1492
1750
  return detectDuplicateDependencies(dependencies);
1493
1751
  };
1494
1752
 
1495
1753
  // src/actions/lint.ts
1496
- import chalk20 from "chalk";
1754
+ import chalk22 from "chalk";
1497
1755
  var lintPackage = ({
1498
1756
  pkg,
1499
1757
  fix: fix2,
1500
1758
  verbose
1501
1759
  }) => {
1502
- console.log(chalk20.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
1760
+ console.log(chalk22.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
1503
1761
  const start = Date.now();
1504
1762
  const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
1505
1763
  ["yarn", [
@@ -1509,7 +1767,7 @@ var lintPackage = ({
1509
1767
  fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
1510
1768
  ]]
1511
1769
  ]);
1512
- console.log(chalk20.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk20.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk20.gray("seconds")}`));
1770
+ console.log(chalk22.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk22.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk22.gray("seconds")}`));
1513
1771
  return result;
1514
1772
  };
1515
1773
  var lint = ({
@@ -1529,13 +1787,13 @@ var lint = ({
1529
1787
  });
1530
1788
  };
1531
1789
  var lintAllPackages = ({ fix: fix2 = false } = {}) => {
1532
- console.log(chalk20.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
1790
+ console.log(chalk22.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
1533
1791
  const start = Date.now();
1534
1792
  const fixOptions = fix2 ? ["--fix"] : [];
1535
1793
  const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
1536
1794
  ["yarn", ["eslint", "--cache", "--cache-location", ".eslintcache", "--cache-strategy", "content", ...fixOptions]]
1537
1795
  ]);
1538
- console.log(chalk20.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk20.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk20.gray("seconds")}`));
1796
+ console.log(chalk22.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk22.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk22.gray("seconds")}`));
1539
1797
  return result;
1540
1798
  };
1541
1799
 
@@ -1563,7 +1821,7 @@ var filename = ".gitignore";
1563
1821
  var gitignoreGen = (pkg) => generateIgnoreFiles(filename, pkg);
1564
1822
 
1565
1823
  // src/actions/gitlint.ts
1566
- import chalk21 from "chalk";
1824
+ import chalk23 from "chalk";
1567
1825
  import ParseGitConfig from "parse-git-config";
1568
1826
  var gitlint = () => {
1569
1827
  console.log(`
@@ -1574,7 +1832,7 @@ Gitlint Start [${process.cwd()}]
1574
1832
  const errors = 0;
1575
1833
  const gitConfig = ParseGitConfig.sync();
1576
1834
  const warn = (message) => {
1577
- console.warn(chalk21.yellow(`Warning: ${message}`));
1835
+ console.warn(chalk23.yellow(`Warning: ${message}`));
1578
1836
  warnings++;
1579
1837
  };
1580
1838
  if (gitConfig.core.ignorecase) {
@@ -1594,13 +1852,13 @@ Gitlint Start [${process.cwd()}]
1594
1852
  }
1595
1853
  const resultMessages = [];
1596
1854
  if (valid > 0) {
1597
- resultMessages.push(chalk21.green(`Passed: ${valid}`));
1855
+ resultMessages.push(chalk23.green(`Passed: ${valid}`));
1598
1856
  }
1599
1857
  if (warnings > 0) {
1600
- resultMessages.push(chalk21.yellow(`Warnings: ${warnings}`));
1858
+ resultMessages.push(chalk23.yellow(`Warnings: ${warnings}`));
1601
1859
  }
1602
1860
  if (errors > 0) {
1603
- resultMessages.push(chalk21.red(` Errors: ${errors}`));
1861
+ resultMessages.push(chalk23.red(` Errors: ${errors}`));
1604
1862
  }
1605
1863
  console.warn(`Gitlint Finish [ ${resultMessages.join(" | ")} ]
1606
1864
  `);
@@ -1608,8 +1866,8 @@ Gitlint Start [${process.cwd()}]
1608
1866
  };
1609
1867
 
1610
1868
  // src/actions/gitlint-fix.ts
1611
- import { execSync as execSync2 } from "child_process";
1612
- import chalk22 from "chalk";
1869
+ import { execSync as execSync3 } from "child_process";
1870
+ import chalk24 from "chalk";
1613
1871
  import ParseGitConfig2 from "parse-git-config";
1614
1872
  var gitlintFix = () => {
1615
1873
  console.log(`
@@ -1617,16 +1875,16 @@ Gitlint Fix Start [${process.cwd()}]
1617
1875
  `);
1618
1876
  const gitConfig = ParseGitConfig2.sync();
1619
1877
  if (gitConfig.core.ignorecase) {
1620
- execSync2("git config core.ignorecase false", { stdio: "inherit" });
1621
- console.warn(chalk22.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
1878
+ execSync3("git config core.ignorecase false", { stdio: "inherit" });
1879
+ console.warn(chalk24.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
1622
1880
  }
1623
1881
  if (gitConfig.core.autocrlf !== false) {
1624
- execSync2("git config core.autocrlf false", { stdio: "inherit" });
1625
- console.warn(chalk22.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
1882
+ execSync3("git config core.autocrlf false", { stdio: "inherit" });
1883
+ console.warn(chalk24.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
1626
1884
  }
1627
1885
  if (gitConfig.core.eol !== "lf") {
1628
- execSync2("git config core.eol lf", { stdio: "inherit" });
1629
- console.warn(chalk22.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
1886
+ execSync3("git config core.eol lf", { stdio: "inherit" });
1887
+ console.warn(chalk24.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
1630
1888
  }
1631
1889
  return 1;
1632
1890
  };
@@ -1637,7 +1895,7 @@ var knip = () => {
1637
1895
  };
1638
1896
 
1639
1897
  // src/actions/license.ts
1640
- import chalk23 from "chalk";
1898
+ import chalk25 from "chalk";
1641
1899
  import { init } from "license-checker";
1642
1900
  var license = async (pkg) => {
1643
1901
  const workspaces = yarnWorkspaces();
@@ -1662,18 +1920,18 @@ var license = async (pkg) => {
1662
1920
  "LGPL-3.0-or-later",
1663
1921
  "Python-2.0"
1664
1922
  ]);
1665
- console.log(chalk23.green("License Checker"));
1923
+ console.log(chalk25.green("License Checker"));
1666
1924
  return (await Promise.all(
1667
1925
  workspaceList.map(({ location, name }) => {
1668
1926
  return new Promise((resolve) => {
1669
1927
  init({ production: true, start: location }, (error, packages) => {
1670
1928
  if (error) {
1671
- console.error(chalk23.red(`License Checker [${name}] Error`));
1672
- console.error(chalk23.gray(error));
1929
+ console.error(chalk25.red(`License Checker [${name}] Error`));
1930
+ console.error(chalk25.gray(error));
1673
1931
  console.log("\n");
1674
1932
  resolve(1);
1675
1933
  } else {
1676
- console.log(chalk23.green(`License Checker [${name}]`));
1934
+ console.log(chalk25.green(`License Checker [${name}]`));
1677
1935
  let count = 0;
1678
1936
  for (const [name2, info] of Object.entries(packages)) {
1679
1937
  const licenses = Array.isArray(info.licenses) ? info.licenses : [info.licenses];
@@ -1689,7 +1947,7 @@ var license = async (pkg) => {
1689
1947
  }
1690
1948
  if (!orLicenseFound) {
1691
1949
  count++;
1692
- console.warn(chalk23.yellow(`${name2}: Package License not allowed [${license2}]`));
1950
+ console.warn(chalk25.yellow(`${name2}: Package License not allowed [${license2}]`));
1693
1951
  }
1694
1952
  }
1695
1953
  }
@@ -1724,6 +1982,21 @@ var publish = () => {
1724
1982
  return runSteps("Publish", [["npm", ["publish", "--workspaces"]]]);
1725
1983
  };
1726
1984
 
1985
+ // src/actions/readme-gen.ts
1986
+ async function readmeGen({
1987
+ pkg,
1988
+ templatePath,
1989
+ typedoc,
1990
+ verbose
1991
+ }) {
1992
+ return await generateReadmeFiles({
1993
+ pkg,
1994
+ templatePath,
1995
+ typedoc,
1996
+ verbose
1997
+ });
1998
+ }
1999
+
1727
2000
  // src/actions/rebuild.ts
1728
2001
  var rebuild = ({ target }) => {
1729
2002
  return runSteps("Rebuild", [
@@ -1733,7 +2006,7 @@ var rebuild = ({ target }) => {
1733
2006
  };
1734
2007
 
1735
2008
  // src/actions/recompile.ts
1736
- import chalk24 from "chalk";
2009
+ import chalk26 from "chalk";
1737
2010
  var recompile = async ({
1738
2011
  verbose,
1739
2012
  target,
@@ -1769,7 +2042,7 @@ var recompileAll = async ({
1769
2042
  const incrementalOptions = incremental ? ["--since", "-Apt", "--topological-dev"] : ["--parallel", "-Apt", "--topological-dev"];
1770
2043
  const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
1771
2044
  if (jobs) {
1772
- console.log(chalk24.blue(`Jobs set to [${jobs}]`));
2045
+ console.log(chalk26.blue(`Jobs set to [${jobs}]`));
1773
2046
  }
1774
2047
  const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
1775
2048
  [
@@ -1800,7 +2073,7 @@ var recompileAll = async ({
1800
2073
  ]
1801
2074
  ]);
1802
2075
  console.log(
1803
- `${chalk24.gray("Recompiled in")} [${chalk24.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk24.gray("seconds")}`
2076
+ `${chalk26.gray("Recompiled in")} [${chalk26.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk26.gray("seconds")}`
1804
2077
  );
1805
2078
  return result;
1806
2079
  };
@@ -1831,13 +2104,13 @@ var reinstall = () => {
1831
2104
  };
1832
2105
 
1833
2106
  // src/actions/relint.ts
1834
- import chalk25 from "chalk";
2107
+ import chalk27 from "chalk";
1835
2108
  var relintPackage = ({
1836
2109
  pkg,
1837
2110
  fix: fix2,
1838
2111
  verbose
1839
2112
  }) => {
1840
- console.log(chalk25.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
2113
+ console.log(chalk27.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
1841
2114
  const start = Date.now();
1842
2115
  const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
1843
2116
  ["yarn", [
@@ -1847,7 +2120,7 @@ var relintPackage = ({
1847
2120
  fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
1848
2121
  ]]
1849
2122
  ]);
1850
- console.log(chalk25.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk25.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk25.gray("seconds")}`));
2123
+ console.log(chalk27.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk27.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk27.gray("seconds")}`));
1851
2124
  return result;
1852
2125
  };
1853
2126
  var relint = ({
@@ -1867,13 +2140,13 @@ var relint = ({
1867
2140
  });
1868
2141
  };
1869
2142
  var relintAllPackages = ({ fix: fix2 = false } = {}) => {
1870
- console.log(chalk25.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
2143
+ console.log(chalk27.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
1871
2144
  const start = Date.now();
1872
2145
  const fixOptions = fix2 ? ["--fix"] : [];
1873
2146
  const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
1874
2147
  ["yarn", ["eslint", ...fixOptions]]
1875
2148
  ]);
1876
- console.log(chalk25.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk25.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk25.gray("seconds")}`));
2149
+ console.log(chalk27.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk27.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk27.gray("seconds")}`));
1877
2150
  return result;
1878
2151
  };
1879
2152
 
@@ -1891,10 +2164,10 @@ var sonar = () => {
1891
2164
  };
1892
2165
 
1893
2166
  // src/actions/statics.ts
1894
- import chalk26 from "chalk";
2167
+ import chalk28 from "chalk";
1895
2168
  var DefaultDependencies = ["axios", "@xylabs/pixel", "react", "graphql", "react-router", "@mui/material", "@mui/system"];
1896
2169
  var statics = () => {
1897
- console.log(chalk26.green("Check Required Static Dependencies"));
2170
+ console.log(chalk28.green("Check Required Static Dependencies"));
1898
2171
  const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
1899
2172
  return detectDuplicateDependencies(statics2, DefaultDependencies);
1900
2173
  };
@@ -2138,6 +2411,29 @@ var xyCommonCommands = (args) => {
2138
2411
  if (argv.verbose) console.log("NpmIgnore Gen");
2139
2412
  process.exitCode = npmignoreGen();
2140
2413
  }
2414
+ ).command(
2415
+ "readme-gen [package]",
2416
+ "Readme Gen - Generate README.md files from template",
2417
+ (yargs2) => {
2418
+ return packagePositionalParam(yargs2).option("template", {
2419
+ alias: "t",
2420
+ description: "Path to README.template.md",
2421
+ type: "string"
2422
+ }).option("typedoc", {
2423
+ default: false,
2424
+ description: "Generate TypeDoc reference sections",
2425
+ type: "boolean"
2426
+ });
2427
+ },
2428
+ async (argv) => {
2429
+ if (argv.verbose) console.log("Readme Gen");
2430
+ process.exitCode = await readmeGen({
2431
+ pkg: argv.package,
2432
+ templatePath: argv.template,
2433
+ typedoc: argv.typedoc,
2434
+ verbose: !!argv.verbose
2435
+ });
2436
+ }
2141
2437
  ).command(
2142
2438
  "retest",
2143
2439
  "Re-Test - Run Jest Tests with cleaned cache",
@@ -2317,7 +2613,7 @@ var xyInstallCommands = (args) => {
2317
2613
  };
2318
2614
 
2319
2615
  // src/xy/xyLintCommands.ts
2320
- import chalk27 from "chalk";
2616
+ import chalk29 from "chalk";
2321
2617
  var xyLintCommands = (args) => {
2322
2618
  return args.command(
2323
2619
  "cycle [package]",
@@ -2329,7 +2625,7 @@ var xyLintCommands = (args) => {
2329
2625
  const start = Date.now();
2330
2626
  if (argv.verbose) console.log("Cycle");
2331
2627
  process.exitCode = await cycle({ pkg: argv.package });
2332
- console.log(chalk27.blue(`Finished in ${Date.now() - start}ms`));
2628
+ console.log(chalk29.blue(`Finished in ${Date.now() - start}ms`));
2333
2629
  }
2334
2630
  ).command(
2335
2631
  "lint [package]",
@@ -2359,7 +2655,7 @@ var xyLintCommands = (args) => {
2359
2655
  cache: argv.cache,
2360
2656
  verbose: !!argv.verbose
2361
2657
  });
2362
- console.log(chalk27.blue(`Finished in ${Date.now() - start}ms`));
2658
+ console.log(chalk29.blue(`Finished in ${Date.now() - start}ms`));
2363
2659
  }
2364
2660
  ).command(
2365
2661
  "deplint [package]",
@@ -2380,19 +2676,25 @@ var xyLintCommands = (args) => {
2380
2676
  default: false,
2381
2677
  description: "Check peerDependencies",
2382
2678
  type: "boolean"
2679
+ }).option("exclude", {
2680
+ alias: "e",
2681
+ description: "Package names to exclude from unused checks (comma-separated or repeated)",
2682
+ type: "array"
2383
2683
  });
2384
2684
  },
2385
- (argv) => {
2685
+ async (argv) => {
2386
2686
  if (argv.verbose) console.log("Deplint");
2387
2687
  const start = Date.now();
2388
- process.exitCode = deplint({
2688
+ const cliExclude = argv.exclude?.flatMap((v) => String(v).split(",")).map((v) => v.trim()).filter(Boolean);
2689
+ process.exitCode = await deplint({
2690
+ cliExclude,
2389
2691
  pkg: argv.package,
2390
2692
  deps: !!argv.deps,
2391
2693
  devDeps: !!argv.devDeps,
2392
2694
  peerDeps: !!argv.peerDeps,
2393
2695
  verbose: !!argv.verbose
2394
2696
  });
2395
- console.log(chalk27.blue(`Finished in ${Date.now() - start}ms`));
2697
+ console.log(chalk29.blue(`Finished in ${Date.now() - start}ms`));
2396
2698
  }
2397
2699
  ).command(
2398
2700
  "fix [package]",
@@ -2404,7 +2706,7 @@ var xyLintCommands = (args) => {
2404
2706
  const start = Date.now();
2405
2707
  if (argv.verbose) console.log("Fix");
2406
2708
  process.exitCode = fix();
2407
- console.log(chalk27.blue(`Finished in ${Date.now() - start}ms`));
2709
+ console.log(chalk29.blue(`Finished in ${Date.now() - start}ms`));
2408
2710
  }
2409
2711
  ).command(
2410
2712
  "relint [package]",
@@ -2416,7 +2718,7 @@ var xyLintCommands = (args) => {
2416
2718
  if (argv.verbose) console.log("Relinting");
2417
2719
  const start = Date.now();
2418
2720
  process.exitCode = relint();
2419
- console.log(chalk27.blue(`Finished in ${Date.now() - start}ms`));
2721
+ console.log(chalk29.blue(`Finished in ${Date.now() - start}ms`));
2420
2722
  }
2421
2723
  ).command(
2422
2724
  "publint [package]",
@@ -2428,7 +2730,7 @@ var xyLintCommands = (args) => {
2428
2730
  if (argv.verbose) console.log("Publint");
2429
2731
  const start = Date.now();
2430
2732
  process.exitCode = await publint({ pkg: argv.package, verbose: !!argv.verbose });
2431
- console.log(chalk27.blue(`Finished in ${Date.now() - start}ms`));
2733
+ console.log(chalk29.blue(`Finished in ${Date.now() - start}ms`));
2432
2734
  }
2433
2735
  ).command(
2434
2736
  "knip",
@@ -2440,7 +2742,7 @@ var xyLintCommands = (args) => {
2440
2742
  if (argv.verbose) console.log("Knip");
2441
2743
  const start = Date.now();
2442
2744
  process.exitCode = knip();
2443
- console.log(chalk27.blue(`Knip finished in ${Date.now() - start}ms`));
2745
+ console.log(chalk29.blue(`Knip finished in ${Date.now() - start}ms`));
2444
2746
  }
2445
2747
  ).command(
2446
2748
  "sonar",
@@ -2452,7 +2754,7 @@ var xyLintCommands = (args) => {
2452
2754
  const start = Date.now();
2453
2755
  if (argv.verbose) console.log("Sonar Check");
2454
2756
  process.exitCode = sonar();
2455
- console.log(chalk27.blue(`Finished in ${Date.now() - start}ms`));
2757
+ console.log(chalk29.blue(`Finished in ${Date.now() - start}ms`));
2456
2758
  }
2457
2759
  );
2458
2760
  };
@@ -2488,8 +2790,8 @@ var xyParseOptions = () => {
2488
2790
  var xy = async () => {
2489
2791
  const options = xyParseOptions();
2490
2792
  return await xyBuildCommands(xyCommonCommands(xyInstallCommands(xyDeployCommands(xyLintCommands(options))))).demandCommand(1).command("*", "", () => {
2491
- console.error(chalk28.yellow(`Command not found [${chalk28.magenta(process.argv[2])}]`));
2492
- console.log(chalk28.gray("Try 'yarn xy --help' for list of commands"));
2793
+ console.error(chalk30.yellow(`Command not found [${chalk30.magenta(process.argv[2])}]`));
2794
+ console.log(chalk30.gray("Try 'yarn xy --help' for list of commands"));
2493
2795
  }).version().help().argv;
2494
2796
  };
2495
2797