@xylabs/ts-scripts-yarn3 7.4.26 → 7.4.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bin/xy.mjs CHANGED
@@ -2448,14 +2448,241 @@ var license = async (pkg) => {
2448
2448
  )).reduce((prev, value) => prev || value, 0);
2449
2449
  };
2450
2450
 
2451
+ // src/actions/lintlint.ts
2452
+ import { readFileSync as readFileSync14, writeFileSync as writeFileSync6 } from "fs";
2453
+ import PATH10 from "path";
2454
+ import chalk31 from "chalk";
2455
+ import { findUp } from "find-up";
2456
+ function parseRuleValue(value) {
2457
+ if (typeof value === "string") {
2458
+ return { level: value };
2459
+ }
2460
+ if (typeof value === "number") {
2461
+ return { level: String(value) };
2462
+ }
2463
+ if (Array.isArray(value) && value.length > 0) {
2464
+ return {
2465
+ level: String(value[0]),
2466
+ options: value.length > 1 ? value.slice(1) : void 0
2467
+ };
2468
+ }
2469
+ return void 0;
2470
+ }
2471
+ function normalizeLevel(level) {
2472
+ if (level === "0" || level === "off") return "off";
2473
+ if (level === "1" || level === "warn") return "warn";
2474
+ if (level === "2" || level === "error") return "error";
2475
+ return level;
2476
+ }
2477
+ function rulesMatch(a, b) {
2478
+ if (normalizeLevel(a.level) !== normalizeLevel(b.level)) return false;
2479
+ return JSON.stringify(a.options) === JSON.stringify(b.options);
2480
+ }
2481
+ function formatRule(entry) {
2482
+ if (entry.options) {
2483
+ return JSON.stringify([entry.level, ...entry.options]);
2484
+ }
2485
+ return JSON.stringify([entry.level]);
2486
+ }
2487
+ function mergeRulesFromBlocks(blocks) {
2488
+ const merged = /* @__PURE__ */ new Map();
2489
+ for (const block of blocks) {
2490
+ if (!block.rules) continue;
2491
+ for (const [name, value] of Object.entries(block.rules)) {
2492
+ const parsed = parseRuleValue(value);
2493
+ if (parsed) merged.set(name, parsed);
2494
+ }
2495
+ }
2496
+ return merged;
2497
+ }
2498
+ function detectSharedPackage(source) {
2499
+ if (source.includes("@xylabs/eslint-config-react-flat")) return "@xylabs/eslint-config-react-flat";
2500
+ if (source.includes("@xylabs/eslint-config-flat")) return "@xylabs/eslint-config-flat";
2501
+ return void 0;
2502
+ }
2503
+ function extractLocalRuleBlocks(source) {
2504
+ const blocks = [];
2505
+ const ruleBlockRegex = /\{\s*(?:files\s*:\s*\[.*?\]\s*,\s*)?rules\s*:\s*\{([^}]*(?:\{[^}]*\}[^}]*)*)\}/g;
2506
+ let match;
2507
+ while ((match = ruleBlockRegex.exec(source)) !== null) {
2508
+ blocks.push(match[1]);
2509
+ }
2510
+ return blocks;
2511
+ }
2512
+ function extractRulesFromSourceBlocks(blocks) {
2513
+ const rules2 = /* @__PURE__ */ new Map();
2514
+ for (const block of blocks) {
2515
+ const ruleRegex = /['"]([^'"]+)['"]\s*:\s*(\[[\s\S]*?\](?=\s*,|\s*$))/gm;
2516
+ let match;
2517
+ while ((match = ruleRegex.exec(block)) !== null) {
2518
+ rules2.set(match[1], match[2]);
2519
+ }
2520
+ }
2521
+ return rules2;
2522
+ }
2523
+ async function resolveSharedConfig(configDir, sharedPkg) {
2524
+ try {
2525
+ const sharedModule = await import(sharedPkg);
2526
+ const config2 = sharedModule.config ?? sharedModule.default;
2527
+ if (Array.isArray(config2)) return config2;
2528
+ return [];
2529
+ } catch {
2530
+ const distPath = PATH10.resolve(configDir, "node_modules", sharedPkg, "dist", "node", "index.mjs");
2531
+ try {
2532
+ const sharedModule = await import(distPath);
2533
+ const config2 = sharedModule.config ?? sharedModule.default;
2534
+ if (Array.isArray(config2)) return config2;
2535
+ } catch {
2536
+ const neutralPath = PATH10.resolve(configDir, "node_modules", sharedPkg, "dist", "neutral", "index.mjs");
2537
+ const sharedModule = await import(neutralPath);
2538
+ const config2 = sharedModule.config ?? sharedModule.default;
2539
+ if (Array.isArray(config2)) return config2;
2540
+ }
2541
+ return [];
2542
+ }
2543
+ }
2544
+ async function loadSharedRules(configDir, sharedPkg, verbose) {
2545
+ const sharedBlocks = await resolveSharedConfig(configDir, sharedPkg);
2546
+ const sharedRules = mergeRulesFromBlocks(sharedBlocks);
2547
+ if (verbose) {
2548
+ console.log(chalk31.gray(`Shared config defines ${sharedRules.size} rules`));
2549
+ }
2550
+ if (sharedRules.size === 0) {
2551
+ console.error(chalk31.red("Could not load rules from shared config. Is it installed and built?"));
2552
+ return void 0;
2553
+ }
2554
+ return sharedRules;
2555
+ }
2556
+ async function loadLocalRules(eslintConfigPath, source, verbose) {
2557
+ const localModule = await import(eslintConfigPath);
2558
+ const localConfig = localModule.default ?? localModule;
2559
+ const localBlocks = Array.isArray(localConfig) ? localConfig : [localConfig];
2560
+ const resolved = mergeRulesFromBlocks(localBlocks);
2561
+ const localRuleBlocks = extractLocalRuleBlocks(source);
2562
+ const explicit = extractRulesFromSourceBlocks(localRuleBlocks);
2563
+ if (verbose) {
2564
+ console.log(chalk31.gray(`Local config has ${explicit.size} explicit rule setting(s)`));
2565
+ }
2566
+ return { explicit, resolved };
2567
+ }
2568
+ function compareRules(explicitRuleNames, allResolvedRules, sharedRules) {
2569
+ const redundant = [];
2570
+ const overrides = [];
2571
+ const additions = [];
2572
+ for (const ruleName of explicitRuleNames.keys()) {
2573
+ const resolvedEntry = allResolvedRules.get(ruleName);
2574
+ const sharedEntry = sharedRules.get(ruleName);
2575
+ if (!resolvedEntry) continue;
2576
+ if (!sharedEntry) {
2577
+ additions.push({ local: resolvedEntry, rule: ruleName });
2578
+ } else if (rulesMatch(resolvedEntry, sharedEntry)) {
2579
+ redundant.push({
2580
+ local: resolvedEntry,
2581
+ rule: ruleName,
2582
+ shared: sharedEntry
2583
+ });
2584
+ } else {
2585
+ overrides.push({
2586
+ local: resolvedEntry,
2587
+ rule: ruleName,
2588
+ shared: sharedEntry
2589
+ });
2590
+ }
2591
+ }
2592
+ return {
2593
+ additions,
2594
+ overrides,
2595
+ redundant
2596
+ };
2597
+ }
2598
+ function reportResults({
2599
+ additions,
2600
+ overrides,
2601
+ redundant
2602
+ }, verbose) {
2603
+ if (redundant.length > 0) {
2604
+ console.log(chalk31.yellow(`
2605
+ ${redundant.length} redundant rule(s) (same as shared config \u2014 can be removed):`));
2606
+ for (const { rule, local } of redundant) {
2607
+ console.log(chalk31.yellow(` ${rule}: ${formatRule(local)}`));
2608
+ }
2609
+ }
2610
+ if (overrides.length > 0) {
2611
+ console.log(chalk31.cyan(`
2612
+ ${overrides.length} rule override(s) (different from shared config):`));
2613
+ for (const {
2614
+ rule,
2615
+ local,
2616
+ shared
2617
+ } of overrides) {
2618
+ console.log(chalk31.cyan(` ${rule}:`));
2619
+ console.log(chalk31.gray(` shared: ${formatRule(shared)}`));
2620
+ console.log(chalk31.white(` local: ${formatRule(local)}`));
2621
+ }
2622
+ }
2623
+ if (additions.length > 0 && verbose) {
2624
+ console.log(chalk31.gray(`
2625
+ ${additions.length} local addition(s) (not in shared config):`));
2626
+ for (const { rule, local } of additions) {
2627
+ console.log(chalk31.gray(` ${rule}: ${formatRule(local)}`));
2628
+ }
2629
+ }
2630
+ if (redundant.length === 0 && overrides.length === 0) {
2631
+ console.log(chalk31.green("No redundant or overridden rules found"));
2632
+ }
2633
+ }
2634
+ function fixRedundantRules(eslintConfigPath, source, redundant) {
2635
+ let updated = source;
2636
+ for (const { rule } of redundant) {
2637
+ const escaped = rule.replaceAll("/", String.raw`\/`);
2638
+ const pattern = new RegExp(String.raw`[ \t]*['"]${escaped}['"]\s*:\s*\[[^\]]*\],?[ \t]*\n?`, "g");
2639
+ updated = updated.replace(pattern, "");
2640
+ }
2641
+ updated = updated.replaceAll(/\n{3,}/g, "\n\n");
2642
+ if (updated !== source) {
2643
+ writeFileSync6(eslintConfigPath, updated, "utf8");
2644
+ console.log(chalk31.green(`
2645
+ Fixed: removed ${redundant.length} redundant rule(s)`));
2646
+ }
2647
+ }
2648
+ async function lintlint({ fix: fix2, verbose } = {}) {
2649
+ const eslintConfigPath = await findUp("eslint.config.mjs");
2650
+ if (!eslintConfigPath) {
2651
+ console.error(chalk31.red("No eslint.config.mjs found"));
2652
+ return 1;
2653
+ }
2654
+ const configDir = PATH10.dirname(eslintConfigPath);
2655
+ if (verbose) {
2656
+ console.log(chalk31.gray(`Found config: ${eslintConfigPath}`));
2657
+ }
2658
+ const source = readFileSync14(eslintConfigPath, "utf8");
2659
+ const sharedPkg = detectSharedPackage(source);
2660
+ if (!sharedPkg) {
2661
+ console.log(chalk31.yellow("No @xylabs/eslint-config-flat or @xylabs/eslint-config-react-flat imports found"));
2662
+ return 0;
2663
+ }
2664
+ if (verbose) {
2665
+ console.log(chalk31.gray(`Shared package: ${sharedPkg}`));
2666
+ }
2667
+ const sharedRules = await loadSharedRules(configDir, sharedPkg, !!verbose);
2668
+ if (!sharedRules) return 1;
2669
+ const { explicit, resolved } = await loadLocalRules(eslintConfigPath, source, !!verbose);
2670
+ const results = compareRules(explicit, resolved, sharedRules);
2671
+ reportResults(results, !!verbose);
2672
+ if (results.redundant.length > 0 && fix2) {
2673
+ fixRedundantRules(eslintConfigPath, source, results.redundant);
2674
+ }
2675
+ return results.redundant.length > 0 && !fix2 ? 1 : 0;
2676
+ }
2677
+
2451
2678
  // src/actions/npmignore-gen.ts
2452
2679
  var filename = ".npmignore";
2453
2680
  var npmignoreGen = (pkg) => generateIgnoreFiles(filename, pkg);
2454
2681
 
2455
2682
  // src/actions/package-lint.ts
2456
- import { readFileSync as readFileSync14, writeFileSync as writeFileSync6 } from "fs";
2457
- import PATH10 from "path";
2458
- import chalk31 from "chalk";
2683
+ import { readFileSync as readFileSync15, writeFileSync as writeFileSync7 } from "fs";
2684
+ import PATH11 from "path";
2685
+ import chalk32 from "chalk";
2459
2686
  import picomatch from "picomatch";
2460
2687
  function emptyResult() {
2461
2688
  return {
@@ -2465,12 +2692,12 @@ function emptyResult() {
2465
2692
  };
2466
2693
  }
2467
2694
  function readRootPackageJson(cwd) {
2468
- const raw = readFileSync14(PATH10.resolve(cwd, "package.json"), "utf8");
2695
+ const raw = readFileSync15(PATH11.resolve(cwd, "package.json"), "utf8");
2469
2696
  return JSON.parse(raw);
2470
2697
  }
2471
2698
  function writeRootPackageJson(cwd, pkg) {
2472
- const path8 = PATH10.resolve(cwd, "package.json");
2473
- writeFileSync6(path8, `${JSON.stringify(pkg, null, 2)}
2699
+ const path8 = PATH11.resolve(cwd, "package.json");
2700
+ writeFileSync7(path8, `${JSON.stringify(pkg, null, 2)}
2474
2701
  `, "utf8");
2475
2702
  }
2476
2703
  function isMonorepo(pkg) {
@@ -2497,7 +2724,7 @@ function checkRootPrivate(pkg) {
2497
2724
  function fixRootPrivate(cwd, pkg) {
2498
2725
  pkg.private = true;
2499
2726
  writeRootPackageJson(cwd, pkg);
2500
- console.log(chalk31.green(' \u2714 Fixed: set "private": true in root package.json'));
2727
+ console.log(chalk32.green(' \u2714 Fixed: set "private": true in root package.json'));
2501
2728
  }
2502
2729
  function checkNoPublishConfigOnPrivate(pkg) {
2503
2730
  const result = emptyResult();
@@ -2509,7 +2736,7 @@ function checkNoPublishConfigOnPrivate(pkg) {
2509
2736
  function fixNoPublishConfigOnPrivate(cwd, pkg) {
2510
2737
  delete pkg.publishConfig;
2511
2738
  writeRootPackageJson(cwd, pkg);
2512
- console.log(chalk31.green(" \u2714 Fixed: removed publishConfig from private root package.json"));
2739
+ console.log(chalk32.green(" \u2714 Fixed: removed publishConfig from private root package.json"));
2513
2740
  }
2514
2741
  function checkDiscoverable(pkg, workspaces) {
2515
2742
  const result = emptyResult();
@@ -2528,22 +2755,22 @@ function logResults(label, result, fix2) {
2528
2755
  let errors = 0;
2529
2756
  let fixed = 0;
2530
2757
  for (const error of result.errors) {
2531
- console.log(chalk31.red(` \u2717 ${error}`));
2758
+ console.log(chalk32.red(` \u2717 ${error}`));
2532
2759
  errors++;
2533
2760
  }
2534
2761
  for (const fixable of result.fixable) {
2535
2762
  if (fix2) {
2536
2763
  fixed++;
2537
2764
  } else {
2538
- console.log(chalk31.red(` \u2717 ${fixable} (fixable)`));
2765
+ console.log(chalk32.red(` \u2717 ${fixable} (fixable)`));
2539
2766
  errors++;
2540
2767
  }
2541
2768
  }
2542
2769
  for (const warning of result.warnings) {
2543
- console.log(chalk31.yellow(` \u26A0 ${warning}`));
2770
+ console.log(chalk32.yellow(` \u26A0 ${warning}`));
2544
2771
  }
2545
2772
  if (errors === 0 && fixed === 0 && result.warnings.length === 0) {
2546
- console.log(chalk31.green(` \u2713 ${label}`));
2773
+ console.log(chalk32.green(` \u2713 ${label}`));
2547
2774
  }
2548
2775
  return { errors, fixed };
2549
2776
  }
@@ -2563,14 +2790,14 @@ function runChecks(entries, cwd, pkg, fix2) {
2563
2790
  }
2564
2791
  function logSummary(errors, fixed) {
2565
2792
  if (fixed > 0) {
2566
- console.log(chalk31.green(`
2793
+ console.log(chalk32.green(`
2567
2794
  Fixed ${fixed} issue(s)`));
2568
2795
  }
2569
2796
  if (errors > 0) {
2570
- console.log(chalk31.red(`
2797
+ console.log(chalk32.red(`
2571
2798
  ${errors} error(s) found`));
2572
2799
  } else if (fixed === 0) {
2573
- console.log(chalk31.green("\n All checks passed"));
2800
+ console.log(chalk32.green("\n All checks passed"));
2574
2801
  }
2575
2802
  }
2576
2803
  function packageLintMonorepo(fix2 = false) {
@@ -2579,14 +2806,14 @@ function packageLintMonorepo(fix2 = false) {
2579
2806
  try {
2580
2807
  pkg = readRootPackageJson(cwd);
2581
2808
  } catch {
2582
- console.error(chalk31.red("Could not read package.json"));
2809
+ console.error(chalk32.red("Could not read package.json"));
2583
2810
  return 1;
2584
2811
  }
2585
2812
  if (!isMonorepo(pkg)) {
2586
- console.log(chalk31.gray("Not a monorepo \u2014 skipping package-lint checks"));
2813
+ console.log(chalk32.gray("Not a monorepo \u2014 skipping package-lint checks"));
2587
2814
  return 0;
2588
2815
  }
2589
- console.log(chalk31.green("Package Lint"));
2816
+ console.log(chalk32.green("Package Lint"));
2590
2817
  const workspaces = yarnWorkspaces();
2591
2818
  const checks = [
2592
2819
  {
@@ -2660,7 +2887,7 @@ var rebuild = ({ target }) => {
2660
2887
  };
2661
2888
 
2662
2889
  // src/actions/recompile.ts
2663
- import chalk32 from "chalk";
2890
+ import chalk33 from "chalk";
2664
2891
  var recompile = async ({
2665
2892
  verbose,
2666
2893
  target,
@@ -2696,7 +2923,7 @@ var recompileAll = async ({
2696
2923
  const incrementalOptions = incremental ? ["--since", "-Apt", "--topological-dev"] : ["--parallel", "-Apt", "--topological-dev"];
2697
2924
  const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
2698
2925
  if (jobs) {
2699
- console.log(chalk32.blue(`Jobs set to [${jobs}]`));
2926
+ console.log(chalk33.blue(`Jobs set to [${jobs}]`));
2700
2927
  }
2701
2928
  const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
2702
2929
  [
@@ -2727,7 +2954,7 @@ var recompileAll = async ({
2727
2954
  ]
2728
2955
  ]);
2729
2956
  console.log(
2730
- `${chalk32.gray("Recompiled in")} [${chalk32.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk32.gray("seconds")}`
2957
+ `${chalk33.gray("Recompiled in")} [${chalk33.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk33.gray("seconds")}`
2731
2958
  );
2732
2959
  return result;
2733
2960
  };
@@ -2758,13 +2985,13 @@ var reinstall = () => {
2758
2985
  };
2759
2986
 
2760
2987
  // src/actions/relint.ts
2761
- import chalk33 from "chalk";
2988
+ import chalk34 from "chalk";
2762
2989
  var relintPackage = ({
2763
2990
  pkg,
2764
2991
  fix: fix2,
2765
2992
  verbose
2766
2993
  }) => {
2767
- console.log(chalk33.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
2994
+ console.log(chalk34.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
2768
2995
  const start = Date.now();
2769
2996
  const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
2770
2997
  ["yarn", [
@@ -2774,7 +3001,7 @@ var relintPackage = ({
2774
3001
  fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
2775
3002
  ]]
2776
3003
  ]);
2777
- console.log(chalk33.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk33.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk33.gray("seconds")}`));
3004
+ console.log(chalk34.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk34.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk34.gray("seconds")}`));
2778
3005
  return result;
2779
3006
  };
2780
3007
  var relint = ({
@@ -2794,21 +3021,31 @@ var relint = ({
2794
3021
  });
2795
3022
  };
2796
3023
  var relintAllPackages = ({ fix: fix2 = false } = {}) => {
2797
- console.log(chalk33.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
3024
+ console.log(chalk34.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
2798
3025
  const start = Date.now();
2799
3026
  const fixOptions = fix2 ? ["--fix"] : [];
2800
3027
  const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
2801
3028
  ["yarn", ["eslint", ...fixOptions]]
2802
3029
  ]);
2803
- console.log(chalk33.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk33.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk33.gray("seconds")}`));
3030
+ console.log(chalk34.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk34.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk34.gray("seconds")}`));
2804
3031
  return result;
2805
3032
  };
2806
3033
 
2807
3034
  // src/actions/retest.ts
2808
- var retest = () => {
2809
- return runSteps("Test", [
3035
+ function isWorkspace(target) {
3036
+ return yarnWorkspaces().some((ws) => ws.name === target);
3037
+ }
3038
+ var retest = ({ target } = {}) => {
3039
+ if (target && isWorkspace(target)) {
3040
+ return runSteps(`Re-Test [${target}]`, [
3041
+ ["yarn", ["workspace", target, "run", "vitest", "--clearCache"]],
3042
+ ["yarn", ["workspace", target, "run", "vitest", "."]]
3043
+ ]);
3044
+ }
3045
+ const path8 = target ?? ".";
3046
+ return runSteps("Re-Test", [
2810
3047
  ["yarn", ["vitest", "--clearCache"]],
2811
- ["yarn", ["vitest", "."]]
3048
+ ["yarn", ["vitest", path8]]
2812
3049
  ]);
2813
3050
  };
2814
3051
 
@@ -2818,17 +3055,24 @@ var sonar = () => {
2818
3055
  };
2819
3056
 
2820
3057
  // src/actions/statics.ts
2821
- import chalk34 from "chalk";
3058
+ import chalk35 from "chalk";
2822
3059
  var DefaultDependencies = ["axios", "@xylabs/pixel", "react", "graphql", "react-router", "@mui/material", "@mui/system"];
2823
3060
  var statics = () => {
2824
- console.log(chalk34.green("Check Required Static Dependencies"));
3061
+ console.log(chalk35.green("Check Required Static Dependencies"));
2825
3062
  const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
2826
3063
  return detectDuplicateDependencies(statics2, DefaultDependencies);
2827
3064
  };
2828
3065
 
2829
3066
  // src/actions/test.ts
2830
- var test = () => {
2831
- return runSteps("Test", [["yarn", ["vitest", "."]]]);
3067
+ function isWorkspace2(target) {
3068
+ return yarnWorkspaces().some((ws) => ws.name === target);
3069
+ }
3070
+ var test = ({ target } = {}) => {
3071
+ if (target && isWorkspace2(target)) {
3072
+ return runSteps(`Test [${target}]`, [["yarn", ["workspace", target, "run", "vitest", "."]]]);
3073
+ }
3074
+ const path8 = target ?? ".";
3075
+ return runSteps("Test", [["yarn", ["vitest", path8]]]);
2832
3076
  };
2833
3077
 
2834
3078
  // src/actions/up.ts
@@ -3220,21 +3464,27 @@ var readmeCommand = {
3220
3464
 
3221
3465
  // src/xy/common/retestCommand.ts
3222
3466
  var retestCommand = {
3223
- command: "retest",
3224
- describe: "Re-Test - Run Jest Tests with cleaned cache",
3467
+ command: "retest [target]",
3468
+ describe: "Re-Test - Run Vitest Tests with cleaned cache",
3469
+ builder: (yargs2) => {
3470
+ return yargs2.positional("target", { describe: "Package name or file/folder path to test" });
3471
+ },
3225
3472
  handler: (argv) => {
3226
- if (argv.verbose) console.log("Re-Testing");
3227
- process.exitCode = retest();
3473
+ if (argv.verbose) console.log(`Re-Testing: ${argv.target ?? "all"}`);
3474
+ process.exitCode = retest({ target: argv.target });
3228
3475
  }
3229
3476
  };
3230
3477
 
3231
3478
  // src/xy/common/testCommand.ts
3232
3479
  var testCommand = {
3233
- command: "test",
3234
- describe: "Test - Run Jest Tests",
3480
+ command: "test [target]",
3481
+ describe: "Test - Run Vitest Tests",
3482
+ builder: (yargs2) => {
3483
+ return yargs2.positional("target", { describe: "Package name or file/folder path to test" });
3484
+ },
3235
3485
  handler: (argv) => {
3236
- if (argv.verbose) console.log("Testing");
3237
- process.exitCode = test();
3486
+ if (argv.verbose) console.log(`Testing: ${argv.target ?? "all"}`);
3487
+ process.exitCode = test({ target: argv.target });
3238
3488
  }
3239
3489
  };
3240
3490
 
@@ -3402,7 +3652,7 @@ var xyInstallCommands = (args) => {
3402
3652
  };
3403
3653
 
3404
3654
  // src/xy/lint/cycleCommand.ts
3405
- import chalk35 from "chalk";
3655
+ import chalk36 from "chalk";
3406
3656
  var cycleCommand = {
3407
3657
  command: "cycle [package]",
3408
3658
  describe: "Cycle - Check for dependency cycles",
@@ -3413,12 +3663,12 @@ var cycleCommand = {
3413
3663
  const start = Date.now();
3414
3664
  if (argv.verbose) console.log("Cycle");
3415
3665
  process.exitCode = await cycle({ pkg: argv.package });
3416
- console.log(chalk35.blue(`Finished in ${Date.now() - start}ms`));
3666
+ console.log(chalk36.blue(`Finished in ${Date.now() - start}ms`));
3417
3667
  }
3418
3668
  };
3419
3669
 
3420
3670
  // src/xy/lint/deplintCommand.ts
3421
- import chalk36 from "chalk";
3671
+ import chalk37 from "chalk";
3422
3672
  var deplintCommand = {
3423
3673
  command: "deplint [package]",
3424
3674
  describe: "Deplint - Run Deplint",
@@ -3456,12 +3706,12 @@ var deplintCommand = {
3456
3706
  peerDeps: !!argv.peerDeps,
3457
3707
  verbose: !!argv.verbose
3458
3708
  });
3459
- console.log(chalk36.blue(`Finished in ${Date.now() - start}ms`));
3709
+ console.log(chalk37.blue(`Finished in ${Date.now() - start}ms`));
3460
3710
  }
3461
3711
  };
3462
3712
 
3463
3713
  // src/xy/lint/fixCommand.ts
3464
- import chalk37 from "chalk";
3714
+ import chalk38 from "chalk";
3465
3715
  var fixCommand = {
3466
3716
  command: "fix [package]",
3467
3717
  describe: "Fix - Run Eslint w/fix",
@@ -3472,12 +3722,12 @@ var fixCommand = {
3472
3722
  const start = Date.now();
3473
3723
  if (argv.verbose) console.log("Fix");
3474
3724
  process.exitCode = fix();
3475
- console.log(chalk37.blue(`Finished in ${Date.now() - start}ms`));
3725
+ console.log(chalk38.blue(`Finished in ${Date.now() - start}ms`));
3476
3726
  }
3477
3727
  };
3478
3728
 
3479
3729
  // src/xy/lint/knipCommand.ts
3480
- import chalk38 from "chalk";
3730
+ import chalk39 from "chalk";
3481
3731
  var knipCommand = {
3482
3732
  command: "knip",
3483
3733
  describe: "Knip - Run Knip",
@@ -3488,12 +3738,12 @@ var knipCommand = {
3488
3738
  if (argv.verbose) console.log("Knip");
3489
3739
  const start = Date.now();
3490
3740
  process.exitCode = knip();
3491
- console.log(chalk38.blue(`Knip finished in ${Date.now() - start}ms`));
3741
+ console.log(chalk39.blue(`Knip finished in ${Date.now() - start}ms`));
3492
3742
  }
3493
3743
  };
3494
3744
 
3495
3745
  // src/xy/lint/lintCommand.ts
3496
- import chalk39 from "chalk";
3746
+ import chalk40 from "chalk";
3497
3747
  var lintCommand = {
3498
3748
  command: "lint [package]",
3499
3749
  describe: "Lint - Run Eslint",
@@ -3522,7 +3772,27 @@ var lintCommand = {
3522
3772
  cache: argv.cache,
3523
3773
  verbose: !!argv.verbose
3524
3774
  });
3525
- console.log(chalk39.blue(`Finished in ${Date.now() - start}ms`));
3775
+ console.log(chalk40.blue(`Finished in ${Date.now() - start}ms`));
3776
+ }
3777
+ };
3778
+
3779
+ // src/xy/lint/lintlintCommand.ts
3780
+ var lintlintCommand = {
3781
+ command: "lintlint",
3782
+ describe: "Lint Lint - Check for redundant or overridden ESLint rules vs shared config",
3783
+ builder: (yargs2) => {
3784
+ return yargs2.option("fix", {
3785
+ default: false,
3786
+ description: "Remove redundant rules from local config",
3787
+ type: "boolean"
3788
+ });
3789
+ },
3790
+ handler: async (argv) => {
3791
+ if (argv.verbose) console.log("Lint Lint");
3792
+ process.exitCode = await lintlint({
3793
+ fix: argv.fix,
3794
+ verbose: !!argv.verbose
3795
+ });
3526
3796
  }
3527
3797
  };
3528
3798
 
@@ -3544,7 +3814,7 @@ var packageLintCommand = {
3544
3814
  };
3545
3815
 
3546
3816
  // src/xy/lint/publintCommand.ts
3547
- import chalk40 from "chalk";
3817
+ import chalk41 from "chalk";
3548
3818
  var publintCommand = {
3549
3819
  command: "publint [package]",
3550
3820
  describe: "Publint - Run Publint",
@@ -3555,12 +3825,12 @@ var publintCommand = {
3555
3825
  if (argv.verbose) console.log("Publint");
3556
3826
  const start = Date.now();
3557
3827
  process.exitCode = await publint({ pkg: argv.package, verbose: !!argv.verbose });
3558
- console.log(chalk40.blue(`Finished in ${Date.now() - start}ms`));
3828
+ console.log(chalk41.blue(`Finished in ${Date.now() - start}ms`));
3559
3829
  }
3560
3830
  };
3561
3831
 
3562
3832
  // src/xy/lint/relintCommand.ts
3563
- import chalk41 from "chalk";
3833
+ import chalk42 from "chalk";
3564
3834
  var relintCommand = {
3565
3835
  command: "relint [package]",
3566
3836
  describe: "Relint - Clean & Lint",
@@ -3571,12 +3841,12 @@ var relintCommand = {
3571
3841
  if (argv.verbose) console.log("Relinting");
3572
3842
  const start = Date.now();
3573
3843
  process.exitCode = relint();
3574
- console.log(chalk41.blue(`Finished in ${Date.now() - start}ms`));
3844
+ console.log(chalk42.blue(`Finished in ${Date.now() - start}ms`));
3575
3845
  }
3576
3846
  };
3577
3847
 
3578
3848
  // src/xy/lint/sonarCommand.ts
3579
- import chalk42 from "chalk";
3849
+ import chalk43 from "chalk";
3580
3850
  var sonarCommand = {
3581
3851
  command: "sonar",
3582
3852
  describe: "Sonar - Run Sonar Check",
@@ -3587,17 +3857,17 @@ var sonarCommand = {
3587
3857
  const start = Date.now();
3588
3858
  if (argv.verbose) console.log("Sonar Check");
3589
3859
  process.exitCode = sonar();
3590
- console.log(chalk42.blue(`Finished in ${Date.now() - start}ms`));
3860
+ console.log(chalk43.blue(`Finished in ${Date.now() - start}ms`));
3591
3861
  }
3592
3862
  };
3593
3863
 
3594
3864
  // src/xy/lint/index.ts
3595
3865
  var xyLintCommands = (args) => {
3596
- return args.command(cycleCommand).command(lintCommand).command(deplintCommand).command(fixCommand).command(relintCommand).command(publintCommand).command(knipCommand).command(packageLintCommand).command(sonarCommand);
3866
+ return args.command(cycleCommand).command(lintCommand).command(lintlintCommand).command(deplintCommand).command(fixCommand).command(relintCommand).command(publintCommand).command(knipCommand).command(packageLintCommand).command(sonarCommand);
3597
3867
  };
3598
3868
 
3599
3869
  // src/xy/xy.ts
3600
- import chalk43 from "chalk";
3870
+ import chalk44 from "chalk";
3601
3871
 
3602
3872
  // src/xy/xyParseOptions.ts
3603
3873
  import yargs from "yargs";
@@ -3638,8 +3908,8 @@ var xyParseOptions = () => {
3638
3908
  var xy = async () => {
3639
3909
  const options = xyParseOptions();
3640
3910
  return await xyBuildCommands(xyCommonCommands(xyInstallCommands(xyDeployCommands(xyLintCommands(options))))).demandCommand(1).command("*", "", () => {
3641
- console.error(chalk43.yellow(`Command not found [${chalk43.magenta(process.argv[2])}]`));
3642
- console.log(chalk43.gray("Try 'yarn xy --help' for list of commands"));
3911
+ console.error(chalk44.yellow(`Command not found [${chalk44.magenta(process.argv[2])}]`));
3912
+ console.log(chalk44.gray("Try 'yarn xy --help' for list of commands"));
3643
3913
  }).version().help().argv;
3644
3914
  };
3645
3915