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