@xylabs/ts-scripts-yarn3 6.0.2 → 6.0.4

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 (43) hide show
  1. package/dist/actions/fix.mjs +28 -59
  2. package/dist/actions/fix.mjs.map +1 -1
  3. package/dist/actions/index.mjs +96 -121
  4. package/dist/actions/index.mjs.map +1 -1
  5. package/dist/actions/lint.mjs +25 -65
  6. package/dist/actions/lint.mjs.map +1 -1
  7. package/dist/actions/package/index.mjs +3 -2
  8. package/dist/actions/package/index.mjs.map +1 -1
  9. package/dist/actions/package/lint.mjs +3 -2
  10. package/dist/actions/package/lint.mjs.map +1 -1
  11. package/dist/actions/relint.mjs +61 -45
  12. package/dist/actions/relint.mjs.map +1 -1
  13. package/dist/bin/package/fix.mjs +3 -2
  14. package/dist/bin/package/fix.mjs.map +1 -1
  15. package/dist/bin/package/lint.mjs +3 -2
  16. package/dist/bin/package/lint.mjs.map +1 -1
  17. package/dist/bin/package/relint.mjs +106 -0
  18. package/dist/bin/package/relint.mjs.map +1 -0
  19. package/dist/bin/xy.mjs +100 -94
  20. package/dist/bin/xy.mjs.map +1 -1
  21. package/dist/index.d.ts +29 -23
  22. package/dist/index.mjs +112 -135
  23. package/dist/index.mjs.map +1 -1
  24. package/dist/xy/index.mjs +100 -94
  25. package/dist/xy/index.mjs.map +1 -1
  26. package/dist/xy/xy.mjs +100 -94
  27. package/dist/xy/xy.mjs.map +1 -1
  28. package/dist/xy/xyLintCommands.mjs +97 -111
  29. package/dist/xy/xyLintCommands.mjs.map +1 -1
  30. package/package.json +5 -4
  31. package/src/actions/fix.ts +3 -2
  32. package/src/actions/index.ts +0 -2
  33. package/src/actions/lint.ts +19 -42
  34. package/src/actions/package/lint.ts +2 -2
  35. package/src/actions/relint.ts +73 -18
  36. package/src/bin/package/relint.ts +16 -0
  37. package/src/xy/xyLintCommands.ts +6 -8
  38. package/dist/actions/lint-clean.mjs +0 -222
  39. package/dist/actions/lint-clean.mjs.map +0 -1
  40. package/dist/actions/lint-profile.mjs +0 -118
  41. package/dist/actions/lint-profile.mjs.map +0 -1
  42. package/src/actions/lint-clean.ts +0 -24
  43. package/src/actions/lint-profile.ts +0 -5
package/dist/bin/xy.mjs CHANGED
@@ -3,7 +3,7 @@ var __defProp = Object.defineProperty;
3
3
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
4
4
 
5
5
  // src/xy/xy.ts
6
- import chalk21 from "chalk";
6
+ import chalk22 from "chalk";
7
7
 
8
8
  // src/actions/build.ts
9
9
  import chalk7 from "chalk";
@@ -972,43 +972,31 @@ var dupdeps = /* @__PURE__ */ __name(() => {
972
972
 
973
973
  // src/actions/lint.ts
974
974
  import chalk14 from "chalk";
975
- import { ESLint as ESLint2 } from "eslint";
976
- var dumpMessages = /* @__PURE__ */ __name((lintResults) => {
977
- const colors = [
978
- "white",
979
- "yellow",
980
- "red"
981
- ];
982
- const severity = [
983
- "none",
984
- "warning",
985
- "error"
975
+ var lintPackage = /* @__PURE__ */ __name(({ pkg, fix: fix2, verbose }) => {
976
+ console.log(chalk14.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
977
+ const start = Date.now();
978
+ const verboseOptions = verbose ? [
979
+ "--verbose"
980
+ ] : [
981
+ "--no-verbose"
986
982
  ];
987
- for (const lintResult of lintResults) {
988
- if (lintResult.messages.length > 0) {
989
- console.log(chalk14.gray(`${lintResult.filePath}`));
990
- for (const message of lintResult.messages) {
991
- console.log(chalk14.gray(` ${message.line}:${message.column}`), chalk14[colors[message.severity]](` ${severity[message.severity]}`), chalk14.white(` ${message.message}`), chalk14.gray(` ${message.ruleId}`));
992
- }
993
- }
994
- }
995
- }, "dumpMessages");
996
- var lintPackage = /* @__PURE__ */ __name(async ({ pkg, fix: fix2 }) => {
997
- const workspace = yarnWorkspaces().find((workspace2) => workspace2.name === pkg);
998
- if (!workspace) {
999
- console.error(chalk14.red(`Unable to locate package [${chalk14.magenta(pkg)}]`));
1000
- process.exit(1);
1001
- }
1002
- const engine = new ESLint2({
1003
- cache: true,
1004
- fix: fix2
1005
- });
1006
- const lintResults = await engine.lintFiles(workspace.location);
1007
- dumpMessages(lintResults);
1008
- return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0);
983
+ const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
984
+ [
985
+ "yarn",
986
+ [
987
+ "workspace",
988
+ pkg,
989
+ ...verboseOptions,
990
+ "run",
991
+ fix2 ? "package-fix" : "package-lint"
992
+ ]
993
+ ]
994
+ ]);
995
+ console.log(chalk14.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk14.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk14.gray("seconds")}`));
996
+ return result;
1009
997
  }, "lintPackage");
1010
- var lint = /* @__PURE__ */ __name(async ({ pkg, verbose, incremental, fix: fix2 } = {}) => {
1011
- return pkg ? await lintPackage({
998
+ var lint = /* @__PURE__ */ __name(({ pkg, verbose, incremental, fix: fix2 } = {}) => {
999
+ return pkg ? lintPackage({
1012
1000
  pkg,
1013
1001
  fix: fix2
1014
1002
  }) : lintAllPackages({
@@ -1050,8 +1038,9 @@ var lintAllPackages = /* @__PURE__ */ __name(({ fix: fix2, verbose = true, incre
1050
1038
  }, "lintAllPackages");
1051
1039
 
1052
1040
  // src/actions/fix.ts
1053
- var fix = /* @__PURE__ */ __name(async () => {
1054
- return await lint({
1041
+ var fix = /* @__PURE__ */ __name((params) => {
1042
+ return lint({
1043
+ ...params,
1055
1044
  fix: true
1056
1045
  });
1057
1046
  }, "fix");
@@ -1253,25 +1242,6 @@ var license = /* @__PURE__ */ __name(async (pkg) => {
1253
1242
  }))).reduce((prev, value) => prev || value, 0);
1254
1243
  }, "license");
1255
1244
 
1256
- // src/actions/lint-profile.ts
1257
- var lintProfile = /* @__PURE__ */ __name(() => {
1258
- return runSteps("Lint Profile", [
1259
- [
1260
- "yarn",
1261
- [
1262
- "xy",
1263
- "lint"
1264
- ],
1265
- {
1266
- env: {
1267
- ...process.env,
1268
- TIMING: "1"
1269
- }
1270
- }
1271
- ]
1272
- ]);
1273
- }, "lintProfile");
1274
-
1275
1245
  // src/actions/npmignore-gen.ts
1276
1246
  var filename2 = ".npmignore";
1277
1247
  var npmignoreGen = /* @__PURE__ */ __name((pkg) => generateIgnoreFiles(filename2, pkg), "npmignoreGen");
@@ -1459,35 +1429,69 @@ var reinstall = /* @__PURE__ */ __name(() => {
1459
1429
  }, "reinstall");
1460
1430
 
1461
1431
  // src/actions/relint.ts
1462
- import { rmSync as rmSync2 } from "node:fs";
1463
- var relint = /* @__PURE__ */ __name(() => {
1464
- console.log("Relint - Cleaning [.eslintcache]");
1465
- const workspaces = yarnWorkspaces();
1466
- const result = workspaces.map(({ location, name }) => {
1467
- const dist = `${location}/.eslintcache`;
1468
- try {
1469
- rmSync2(dist, {
1470
- force: true,
1471
- recursive: true
1472
- });
1473
- return 0;
1474
- } catch (ex) {
1475
- const error = ex;
1476
- console.error(`Relint - Cleaning [.eslintcache] Failed [${name}, ${error.message}]`);
1477
- return 1;
1478
- }
1479
- }).reduce((prev, result2) => prev || result2, 0);
1480
- return result || runSteps("Relint", [
1432
+ import chalk19 from "chalk";
1433
+ var relintPackage = /* @__PURE__ */ __name(({ pkg, verbose }) => {
1434
+ console.log(chalk19.gray(`${"Relint"} [All-Packages]`));
1435
+ const start = Date.now();
1436
+ const verboseOptions = verbose ? [
1437
+ "--verbose"
1438
+ ] : [
1439
+ "--no-verbose"
1440
+ ];
1441
+ const result = runSteps("Relint [All-Packages]", [
1481
1442
  [
1482
1443
  "yarn",
1483
1444
  [
1484
- "eslint",
1485
- ".",
1486
- "--cache"
1445
+ "workspace",
1446
+ pkg,
1447
+ ...verboseOptions,
1448
+ "run",
1449
+ "package-relint"
1487
1450
  ]
1488
1451
  ]
1489
1452
  ]);
1453
+ console.log(chalk19.gray(`${"Relinted in"} [${chalk19.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk19.gray("seconds")}`));
1454
+ return result;
1455
+ }, "relintPackage");
1456
+ var relint = /* @__PURE__ */ __name(({ pkg, verbose, incremental } = {}) => {
1457
+ return pkg ? relintPackage({
1458
+ pkg
1459
+ }) : relintAllPackages({
1460
+ verbose,
1461
+ incremental
1462
+ });
1490
1463
  }, "relint");
1464
+ var relintAllPackages = /* @__PURE__ */ __name(({ verbose = true, incremental } = {}) => {
1465
+ console.log(chalk19.gray(`${"Relint"} [All-Packages]`));
1466
+ const start = Date.now();
1467
+ const verboseOptions = verbose ? [
1468
+ "--verbose"
1469
+ ] : [
1470
+ "--no-verbose"
1471
+ ];
1472
+ const incrementalOptions = incremental ? [
1473
+ "--since",
1474
+ "-Ap"
1475
+ ] : [
1476
+ "--parallel",
1477
+ "-Ap"
1478
+ ];
1479
+ const result = runSteps(`${"Relint"} [All-Packages]`, [
1480
+ [
1481
+ "yarn",
1482
+ [
1483
+ "workspaces",
1484
+ "foreach",
1485
+ ...verboseOptions,
1486
+ ...incrementalOptions,
1487
+ "run",
1488
+ "package-relint"
1489
+ ]
1490
+ ]
1491
+ ]);
1492
+ console.log(chalk19.gray(`Relinted in [${chalk19.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk19.gray("seconds")}`));
1493
+ return result;
1494
+ }, "relintAllPackages");
1491
1495
 
1492
1496
  // src/actions/retest.ts
1493
1497
  var retest = /* @__PURE__ */ __name(() => {
@@ -1525,7 +1529,7 @@ var sonar = /* @__PURE__ */ __name(() => {
1525
1529
  }, "sonar");
1526
1530
 
1527
1531
  // src/actions/statics.ts
1528
- import chalk19 from "chalk";
1532
+ import chalk20 from "chalk";
1529
1533
  var DefaultDependencies = [
1530
1534
  "axios",
1531
1535
  "@xylabs/pixel",
@@ -1536,7 +1540,7 @@ var DefaultDependencies = [
1536
1540
  "@mui/system"
1537
1541
  ];
1538
1542
  var statics = /* @__PURE__ */ __name(() => {
1539
- console.log(chalk19.green("Check Required Static Dependencies"));
1543
+ console.log(chalk20.green("Check Required Static Dependencies"));
1540
1544
  const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
1541
1545
  return detectDuplicateDependencies(statics2, DefaultDependencies);
1542
1546
  }, "statics");
@@ -1892,7 +1896,7 @@ var xyInstallCommands = /* @__PURE__ */ __name((args) => {
1892
1896
  }, "xyInstallCommands");
1893
1897
 
1894
1898
  // src/xy/xyLintCommands.ts
1895
- import chalk20 from "chalk";
1899
+ import chalk21 from "chalk";
1896
1900
  var xyLintCommands = /* @__PURE__ */ __name((args) => {
1897
1901
  return args.command("cycle [package]", "Cycle - Check for dependency cycles", (yargs2) => {
1898
1902
  return packagePositionalParam(yargs2);
@@ -1900,30 +1904,32 @@ var xyLintCommands = /* @__PURE__ */ __name((args) => {
1900
1904
  const start = Date.now();
1901
1905
  if (argv.verbose) console.log("Cycle");
1902
1906
  process.exitCode = await cycle();
1903
- console.log(chalk20.blue(`Finished in ${Date.now() - start}ms`));
1907
+ console.log(chalk21.blue(`Finished in ${Date.now() - start}ms`));
1904
1908
  }).command("lint [package]", "Lint - Run Eslint", (yargs2) => {
1905
1909
  return packagePositionalParam(yargs2);
1906
- }, async (argv) => {
1910
+ }, (argv) => {
1907
1911
  if (argv.verbose) console.log("Lint");
1908
1912
  const start = Date.now();
1909
- process.exitCode = argv.fix ? await fix() : argv.profile ? lintProfile() : await lint({
1913
+ process.exitCode = argv.fix ? fix({
1914
+ pkg: argv.package
1915
+ }) : lint({
1910
1916
  pkg: argv.package
1911
1917
  });
1912
- console.log(chalk20.blue(`Finished in ${Date.now() - start}ms`));
1918
+ console.log(chalk21.blue(`Finished in ${Date.now() - start}ms`));
1913
1919
  }).command("fix [package]", "Fix - Run Eslint w/fix", (yargs2) => {
1914
1920
  return packagePositionalParam(yargs2);
1915
- }, async (argv) => {
1921
+ }, (argv) => {
1916
1922
  const start = Date.now();
1917
1923
  if (argv.verbose) console.log("Fix");
1918
- process.exitCode = await fix();
1919
- console.log(chalk20.blue(`Finished in ${Date.now() - start}ms`));
1924
+ process.exitCode = fix();
1925
+ console.log(chalk21.blue(`Finished in ${Date.now() - start}ms`));
1920
1926
  }).command("relint [package]", "Relint - Clean & Lint", (yargs2) => {
1921
1927
  return packagePositionalParam(yargs2);
1922
1928
  }, (argv) => {
1923
1929
  if (argv.verbose) console.log("Relinting");
1924
1930
  const start = Date.now();
1925
1931
  process.exitCode = relint();
1926
- console.log(chalk20.blue(`Finished in ${Date.now() - start}ms`));
1932
+ console.log(chalk21.blue(`Finished in ${Date.now() - start}ms`));
1927
1933
  }).command("publint [package]", "Publint - Run Publint", (yargs2) => {
1928
1934
  return packagePositionalParam(yargs2);
1929
1935
  }, async (argv) => {
@@ -1933,14 +1939,14 @@ var xyLintCommands = /* @__PURE__ */ __name((args) => {
1933
1939
  pkg: argv.package,
1934
1940
  verbose: !!argv.verbose
1935
1941
  });
1936
- console.log(chalk20.blue(`Finished in ${Date.now() - start}ms`));
1942
+ console.log(chalk21.blue(`Finished in ${Date.now() - start}ms`));
1937
1943
  }).command("sonar", "Sonar - Run Sonar Check", (yargs2) => {
1938
1944
  return packagePositionalParam(yargs2);
1939
1945
  }, (argv) => {
1940
1946
  const start = Date.now();
1941
1947
  if (argv.verbose) console.log("Sonar Check");
1942
1948
  process.exitCode = sonar();
1943
- console.log(chalk20.blue(`Finished in ${Date.now() - start}ms`));
1949
+ console.log(chalk21.blue(`Finished in ${Date.now() - start}ms`));
1944
1950
  });
1945
1951
  }, "xyLintCommands");
1946
1952
 
@@ -2002,8 +2008,8 @@ var xyParseOptions = /* @__PURE__ */ __name(() => {
2002
2008
  var xy = /* @__PURE__ */ __name(async () => {
2003
2009
  const options = xyParseOptions();
2004
2010
  return await xyBuildCommands(xyCommonCommands(xyInstallCommands(xyDeployCommands(xyLintCommands(options))))).demandCommand(1).command("*", "", () => {
2005
- console.error(chalk21.yellow(`Command not found [${chalk21.magenta(process.argv[2])}]`));
2006
- console.log(chalk21.gray("Try 'yarn xy --help' for list of commands"));
2011
+ console.error(chalk22.yellow(`Command not found [${chalk22.magenta(process.argv[2])}]`));
2012
+ console.log(chalk22.gray("Try 'yarn xy --help' for list of commands"));
2007
2013
  }).version().help().argv;
2008
2014
  }, "xy");
2009
2015