@xylabs/ts-scripts-yarn3 4.0.0 → 4.0.1

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/index.mjs CHANGED
@@ -516,7 +516,7 @@ var mergeEntries = /* @__PURE__ */ __name((a, b) => [
516
516
  ].sort(), "mergeEntries");
517
517
  var generateIgnoreFiles = /* @__PURE__ */ __name((filename3, pkg) => {
518
518
  console.log(chalk4.green(`Generate ${filename3} Files`));
519
- const cwd4 = INIT_CWD() ?? ".";
519
+ const cwd5 = INIT_CWD() ?? ".";
520
520
  const workspaces = pkg ? [
521
521
  yarnWorkspace(pkg)
522
522
  ] : yarnWorkspaces();
@@ -524,7 +524,7 @@ var generateIgnoreFiles = /* @__PURE__ */ __name((filename3, pkg) => {
524
524
  const writeEntries = /* @__PURE__ */ __name((location, entries) => writeLines(`${location}/${filename3}`, entries), "writeEntries");
525
525
  const results = workspaces.map(({ location, name }) => {
526
526
  try {
527
- writeEntries(location, mergeEntries(readEntries(cwd4), readEntries(location)));
527
+ writeEntries(location, mergeEntries(readEntries(cwd5), readEntries(location)));
528
528
  return 0;
529
529
  } catch (ex) {
530
530
  const error = ex;
@@ -1505,7 +1505,7 @@ var packageClean = /* @__PURE__ */ __name(async () => {
1505
1505
  }, "packageClean");
1506
1506
 
1507
1507
  // src/actions/package/compile/compile.ts
1508
- import chalk23 from "chalk";
1508
+ import chalk24 from "chalk";
1509
1509
 
1510
1510
  // src/actions/package/publint.ts
1511
1511
  import { promises as fs2 } from "node:fs";
@@ -1670,8 +1670,69 @@ var buildEntries = /* @__PURE__ */ __name((folder, entryMode, verbose = false) =
1670
1670
  }
1671
1671
  }, "buildEntries");
1672
1672
 
1673
+ // src/actions/package/compile/packageCompileTscTypes.ts
1674
+ import { cwd as cwd3 } from "node:process";
1675
+ import chalk23 from "chalk";
1676
+ import { createProgramFromConfig as createProgramFromConfig2 } from "tsc-prog";
1677
+ import { DiagnosticCategory as DiagnosticCategory2 } from "typescript";
1678
+ var packageCompileTscTypes = /* @__PURE__ */ __name((folder = "src", { verbose } = {}, compilerOptionsParam) => {
1679
+ const pkg = process.env.INIT_CWD ?? cwd3();
1680
+ if (verbose) {
1681
+ console.log(`Compiling types with TSC [${pkg}]`);
1682
+ }
1683
+ const compilerOptions = {
1684
+ ...getCompilerOptions({
1685
+ declaration: true,
1686
+ emitDeclarationOnly: true,
1687
+ outDir: "dist",
1688
+ removeComments: true,
1689
+ skipDefaultLibCheck: true,
1690
+ skipLibCheck: true,
1691
+ sourceMap: true
1692
+ }),
1693
+ ...compilerOptionsParam
1694
+ };
1695
+ const files = buildEntries(folder, "all");
1696
+ const result = createProgramFromConfig2({
1697
+ basePath: pkg ?? cwd3(),
1698
+ compilerOptions,
1699
+ exclude: [
1700
+ "dist",
1701
+ "docs",
1702
+ "**/*.spec.*",
1703
+ "**/*.stories.*",
1704
+ "src/**/spec/**/*"
1705
+ ],
1706
+ files
1707
+ }).emit();
1708
+ const diagResults = result.diagnostics.length;
1709
+ for (const diag of result.diagnostics) {
1710
+ switch (diag.category) {
1711
+ case DiagnosticCategory2.Error: {
1712
+ console.error(chalk23.red(diag.messageText));
1713
+ console.error(chalk23.grey(pkg));
1714
+ console.error(chalk23.blue(diag.file?.fileName));
1715
+ break;
1716
+ }
1717
+ case DiagnosticCategory2.Warning: {
1718
+ console.error(chalk23.yellow(diag.messageText));
1719
+ console.error(chalk23.grey(pkg));
1720
+ console.error(chalk23.blue(diag.file?.fileName));
1721
+ break;
1722
+ }
1723
+ case DiagnosticCategory2.Suggestion: {
1724
+ console.error(chalk23.white(diag.messageText));
1725
+ console.error(chalk23.grey(pkg));
1726
+ console.error(chalk23.blue(diag.file?.fileName));
1727
+ break;
1728
+ }
1729
+ }
1730
+ }
1731
+ return diagResults;
1732
+ }, "packageCompileTscTypes");
1733
+
1673
1734
  // src/actions/package/compile/packageCompileTsup.ts
1674
- var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single", options, _verbose) => {
1735
+ var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single", options, verbose) => {
1675
1736
  const outDir = options?.outDir ?? "dist";
1676
1737
  const entry = buildEntries(folder, entryMode);
1677
1738
  const optionsResult = defineConfig({
@@ -1685,7 +1746,7 @@ var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single",
1685
1746
  ],
1686
1747
  outDir,
1687
1748
  silent: true,
1688
- sourcemap: true,
1749
+ sourcemap: false,
1689
1750
  splitting: false,
1690
1751
  tsconfig: "tsconfig.json",
1691
1752
  ...options
@@ -1701,7 +1762,11 @@ var compileFolder = /* @__PURE__ */ __name(async (folder, entryMode = "single",
1701
1762
  ];
1702
1763
  }))).flat();
1703
1764
  await Promise.all(optionsList.map((options2) => build2(options2)));
1704
- return 0;
1765
+ return packageCompileTscTypes(folder, {
1766
+ verbose
1767
+ }, {
1768
+ outDir
1769
+ });
1705
1770
  }, "compileFolder");
1706
1771
  var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
1707
1772
  const compile2 = config2?.compile;
@@ -1788,7 +1853,7 @@ var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
1788
1853
  // src/actions/package/compile/compile.ts
1789
1854
  var packageCompile = /* @__PURE__ */ __name(async (inConfig = {}) => {
1790
1855
  const pkg = process.env.INIT_CWD;
1791
- console.log(chalk23.green(`Compiling ${pkg}`));
1856
+ console.log(chalk24.green(`Compiling ${pkg}`));
1792
1857
  const config2 = await loadConfig(inConfig);
1793
1858
  const publint2 = config2.publint;
1794
1859
  const mode = config2.compile?.mode ?? "tsup";
@@ -1808,7 +1873,7 @@ var packageCompile = /* @__PURE__ */ __name(async (inConfig = {}) => {
1808
1873
 
1809
1874
  // src/actions/package/copy-assets.ts
1810
1875
  import path5 from "node:path/posix";
1811
- import chalk24 from "chalk";
1876
+ import chalk25 from "chalk";
1812
1877
  import cpy2 from "cpy";
1813
1878
  var copyTargetAssets2 = /* @__PURE__ */ __name(async (target, name, location) => {
1814
1879
  try {
@@ -1827,7 +1892,7 @@ var copyTargetAssets2 = /* @__PURE__ */ __name(async (target, name, location) =>
1827
1892
  flat: false
1828
1893
  });
1829
1894
  if (values.length > 0) {
1830
- console.log(chalk24.green(`Copying Assets [${target.toUpperCase()}] - ${name} - ${location}`));
1895
+ console.log(chalk25.green(`Copying Assets [${target.toUpperCase()}] - ${name} - ${location}`));
1831
1896
  }
1832
1897
  for (const value of values) {
1833
1898
  console.log(`${value.split("/").pop()} => ./dist/${target}`);
@@ -1857,8 +1922,8 @@ var packageCopyAssets = /* @__PURE__ */ __name(async ({ target }) => {
1857
1922
 
1858
1923
  // src/actions/package/deps.ts
1859
1924
  import { existsSync as existsSync5, readFileSync as readFileSync5 } from "node:fs";
1860
- import { cwd as cwd3 } from "node:process";
1861
- import chalk25 from "chalk";
1925
+ import { cwd as cwd4 } from "node:process";
1926
+ import chalk26 from "chalk";
1862
1927
  import depcheck from "depcheck";
1863
1928
  var special = depcheck.special;
1864
1929
  var defaultIgnorePatterns = [
@@ -1885,21 +1950,21 @@ var defaultIgnoreDevPatterns = [
1885
1950
  var reportUnused = /* @__PURE__ */ __name((name, unused) => {
1886
1951
  if (unused.length > 0) {
1887
1952
  const message = [
1888
- chalk25.yellow(`${unused.length} Unused ${name}`)
1953
+ chalk26.yellow(`${unused.length} Unused ${name}`)
1889
1954
  ];
1890
- for (const value of unused) message.push(chalk25.gray(` ${value}`));
1955
+ for (const value of unused) message.push(chalk26.gray(` ${value}`));
1891
1956
  console.log(message.join("\n"));
1892
1957
  }
1893
1958
  }, "reportUnused");
1894
1959
  var reportMissing = /* @__PURE__ */ __name((name, missing) => {
1895
1960
  if (Object.keys(missing).length > 0) {
1896
1961
  const message = [
1897
- chalk25.yellow(`${Object.entries(missing).length} Missing ${name}`)
1962
+ chalk26.yellow(`${Object.entries(missing).length} Missing ${name}`)
1898
1963
  ];
1899
1964
  for (const [key, value] of Object.entries(missing)) {
1900
- message.push(`${key}`, chalk25.gray(` ${value.at(0)}`));
1965
+ message.push(`${key}`, chalk26.gray(` ${value.at(0)}`));
1901
1966
  }
1902
- console.log(chalk25.yellow(message.join("\n")));
1967
+ console.log(chalk26.yellow(message.join("\n")));
1903
1968
  }
1904
1969
  }, "reportMissing");
1905
1970
  var analyzeDeps = /* @__PURE__ */ __name(async (pkg, ignoreMatches) => {
@@ -1954,7 +2019,7 @@ var analyzeDeps = /* @__PURE__ */ __name(async (pkg, ignoreMatches) => {
1954
2019
  };
1955
2020
  }, "analyzeDeps");
1956
2021
  var packageDeps = /* @__PURE__ */ __name(async () => {
1957
- const pkg = process.env.INIT_CWD ?? cwd3();
2022
+ const pkg = process.env.INIT_CWD ?? cwd4();
1958
2023
  const pkgName = process.env.npm_package_name;
1959
2024
  const packageContent = existsSync5(`${pkg}/package.json`) ? JSON.parse(readFileSync5(`${pkg}/package.json`, {
1960
2025
  encoding: "utf8"
@@ -2004,10 +2069,10 @@ var packageDeps = /* @__PURE__ */ __name(async () => {
2004
2069
  reportUnused("dependencies", unusedDeps);
2005
2070
  reportUnused("devDependencies", unusedDevDeps);
2006
2071
  if (Object.entries(invalidDirs).length > 0) {
2007
- for (const [key, value] of Object.entries(invalidDirs)) console.warn(chalk25.gray(`Invalid Dir: ${key}: ${value}`));
2072
+ for (const [key, value] of Object.entries(invalidDirs)) console.warn(chalk26.gray(`Invalid Dir: ${key}: ${value}`));
2008
2073
  }
2009
2074
  if (Object.entries(invalidFiles).length > 0) {
2010
- for (const [key, value] of Object.entries(invalidFiles)) console.warn(chalk25.gray(`Invalid File: ${key}: ${value}`));
2075
+ for (const [key, value] of Object.entries(invalidFiles)) console.warn(chalk26.gray(`Invalid File: ${key}: ${value}`));
2011
2076
  }
2012
2077
  reportMissing("dependencies", missingDepsObject);
2013
2078
  reportMissing("devDependencies", missingDevDepsObject);
@@ -2018,7 +2083,7 @@ var packageDeps = /* @__PURE__ */ __name(async () => {
2018
2083
  // src/actions/package/gen-docs.ts
2019
2084
  import { existsSync as existsSync6 } from "node:fs";
2020
2085
  import path6 from "node:path";
2021
- import chalk26 from "chalk";
2086
+ import chalk27 from "chalk";
2022
2087
  import { Application, ArgumentsReader, TSConfigReader, TypeDocReader } from "typedoc";
2023
2088
  var ExitCodes = {
2024
2089
  CompileError: 3,
@@ -2120,7 +2185,7 @@ var runTypeDoc = /* @__PURE__ */ __name(async (app) => {
2120
2185
  return ExitCodes.OutputError;
2121
2186
  }
2122
2187
  }
2123
- console.log(chalk26.green(`${pkgName} - Ok`));
2188
+ console.log(chalk27.green(`${pkgName} - Ok`));
2124
2189
  return ExitCodes.Ok;
2125
2190
  }, "runTypeDoc");
2126
2191
 
@@ -2187,7 +2252,7 @@ var rebuild = /* @__PURE__ */ __name(({ target }) => {
2187
2252
  }, "rebuild");
2188
2253
 
2189
2254
  // src/actions/recompile.ts
2190
- import chalk27 from "chalk";
2255
+ import chalk28 from "chalk";
2191
2256
  var recompile = /* @__PURE__ */ __name(async ({ verbose, target, pkg, incremental }) => {
2192
2257
  return pkg ? await recompilePackage({
2193
2258
  pkg,
@@ -2248,7 +2313,7 @@ var recompileAll = /* @__PURE__ */ __name(async ({ jobs, verbose, target, increm
2248
2313
  `${jobs}`
2249
2314
  ] : [];
2250
2315
  if (jobs) {
2251
- console.log(chalk27.blue(`Jobs set to [${jobs}]`));
2316
+ console.log(chalk28.blue(`Jobs set to [${jobs}]`));
2252
2317
  }
2253
2318
  const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
2254
2319
  [
@@ -2278,7 +2343,7 @@ var recompileAll = /* @__PURE__ */ __name(async ({ jobs, verbose, target, increm
2278
2343
  ]
2279
2344
  ]
2280
2345
  ]);
2281
- console.log(`${chalk27.gray("Recompiled in")} [${chalk27.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk27.gray("seconds")}`);
2346
+ console.log(`${chalk28.gray("Recompiled in")} [${chalk28.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk28.gray("seconds")}`);
2282
2347
  return result;
2283
2348
  }, "recompileAll");
2284
2349
 
@@ -2378,7 +2443,7 @@ var sonar = /* @__PURE__ */ __name(() => {
2378
2443
  }, "sonar");
2379
2444
 
2380
2445
  // src/actions/statics.ts
2381
- import chalk28 from "chalk";
2446
+ import chalk29 from "chalk";
2382
2447
  var DefaultDependencies = [
2383
2448
  "axios",
2384
2449
  "@xylabs/pixel",
@@ -2389,7 +2454,7 @@ var DefaultDependencies = [
2389
2454
  "@mui/system"
2390
2455
  ];
2391
2456
  var statics = /* @__PURE__ */ __name(() => {
2392
- console.log(chalk28.green("Check Required Static Dependencies"));
2457
+ console.log(chalk29.green("Check Required Static Dependencies"));
2393
2458
  const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
2394
2459
  return detectDuplicateDependencies(statics2, DefaultDependencies);
2395
2460
  }, "statics");
@@ -2507,7 +2572,7 @@ var loadPackageConfig = /* @__PURE__ */ __name(async () => {
2507
2572
  }, "loadPackageConfig");
2508
2573
 
2509
2574
  // src/xy/xy.ts
2510
- import chalk30 from "chalk";
2575
+ import chalk31 from "chalk";
2511
2576
 
2512
2577
  // src/xy/xyBuildCommands.ts
2513
2578
  var xyBuildCommands = /* @__PURE__ */ __name((args) => {
@@ -2743,7 +2808,7 @@ var xyInstallCommands = /* @__PURE__ */ __name((args) => {
2743
2808
  }, "xyInstallCommands");
2744
2809
 
2745
2810
  // src/xy/xyLintCommands.ts
2746
- import chalk29 from "chalk";
2811
+ import chalk30 from "chalk";
2747
2812
  var xyLintCommands = /* @__PURE__ */ __name((args) => {
2748
2813
  return args.command("cycle [package]", "Cycle - Check for dependency cycles", (yargs2) => {
2749
2814
  return packagePositionalParam(yargs2);
@@ -2751,7 +2816,7 @@ var xyLintCommands = /* @__PURE__ */ __name((args) => {
2751
2816
  const start = Date.now();
2752
2817
  if (argv.verbose) console.log("Cycle");
2753
2818
  process.exitCode = await cycle();
2754
- console.log(chalk29.blue(`Finished in ${Date.now() - start}ms`));
2819
+ console.log(chalk30.blue(`Finished in ${Date.now() - start}ms`));
2755
2820
  }).command("lint [package]", "Lint - Run Eslint", (yargs2) => {
2756
2821
  return packagePositionalParam(yargs2);
2757
2822
  }, async (argv) => {
@@ -2760,21 +2825,21 @@ var xyLintCommands = /* @__PURE__ */ __name((args) => {
2760
2825
  process.exitCode = argv.fix ? fix() : argv.profile ? lintProfile() : await lint({
2761
2826
  pkg: argv.package
2762
2827
  });
2763
- console.log(chalk29.blue(`Finished in ${Date.now() - start}ms`));
2828
+ console.log(chalk30.blue(`Finished in ${Date.now() - start}ms`));
2764
2829
  }).command("fix [package]", "Fix - Run Eslint w/fix", (yargs2) => {
2765
2830
  return packagePositionalParam(yargs2);
2766
2831
  }, (argv) => {
2767
2832
  const start = Date.now();
2768
2833
  if (argv.verbose) console.log("Fix");
2769
2834
  process.exitCode = fix();
2770
- console.log(chalk29.blue(`Finished in ${Date.now() - start}ms`));
2835
+ console.log(chalk30.blue(`Finished in ${Date.now() - start}ms`));
2771
2836
  }).command("relint [package]", "Relint - Clean & Lint", (yargs2) => {
2772
2837
  return packagePositionalParam(yargs2);
2773
2838
  }, (argv) => {
2774
2839
  if (argv.verbose) console.log("Relinting");
2775
2840
  const start = Date.now();
2776
2841
  process.exitCode = relint();
2777
- console.log(chalk29.blue(`Finished in ${Date.now() - start}ms`));
2842
+ console.log(chalk30.blue(`Finished in ${Date.now() - start}ms`));
2778
2843
  }).command("publint [package]", "Publint - Run Publint", (yargs2) => {
2779
2844
  return packagePositionalParam(yargs2);
2780
2845
  }, async (argv) => {
@@ -2784,14 +2849,14 @@ var xyLintCommands = /* @__PURE__ */ __name((args) => {
2784
2849
  pkg: argv.package,
2785
2850
  verbose: !!argv.verbose
2786
2851
  });
2787
- console.log(chalk29.blue(`Finished in ${Date.now() - start}ms`));
2852
+ console.log(chalk30.blue(`Finished in ${Date.now() - start}ms`));
2788
2853
  }).command("sonar", "Sonar - Run Sonar Check", (yargs2) => {
2789
2854
  return packagePositionalParam(yargs2);
2790
2855
  }, (argv) => {
2791
2856
  const start = Date.now();
2792
2857
  if (argv.verbose) console.log("Sonar Check");
2793
2858
  process.exitCode = sonar();
2794
- console.log(chalk29.blue(`Finished in ${Date.now() - start}ms`));
2859
+ console.log(chalk30.blue(`Finished in ${Date.now() - start}ms`));
2795
2860
  });
2796
2861
  }, "xyLintCommands");
2797
2862
 
@@ -2844,8 +2909,8 @@ var xyParseOptions = /* @__PURE__ */ __name(() => {
2844
2909
  var xy = /* @__PURE__ */ __name(async () => {
2845
2910
  const options = xyParseOptions();
2846
2911
  return await xyBuildCommands(xyCommonCommands(xyInstallCommands(xyDeployCommands(xyLintCommands(options))))).demandCommand(1).command("*", "", () => {
2847
- console.error(chalk30.yellow(`Command not found [${chalk30.magenta(process.argv[2])}]`));
2848
- console.log(chalk30.gray("Try 'yarn xy --help' for list of commands"));
2912
+ console.error(chalk31.yellow(`Command not found [${chalk31.magenta(process.argv[2])}]`));
2913
+ console.log(chalk31.gray("Try 'yarn xy --help' for list of commands"));
2849
2914
  }).version().help().argv;
2850
2915
  }, "xy");
2851
2916
  export {