@xylabs/ts-scripts-yarn3 6.0.3 → 6.0.5

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 (39) hide show
  1. package/dist/actions/fix.mjs +23 -60
  2. package/dist/actions/fix.mjs.map +1 -1
  3. package/dist/actions/index.mjs +83 -127
  4. package/dist/actions/index.mjs.map +1 -1
  5. package/dist/actions/lint.mjs +20 -66
  6. package/dist/actions/lint.mjs.map +1 -1
  7. package/dist/actions/recompile.mjs +1 -7
  8. package/dist/actions/recompile.mjs.map +1 -1
  9. package/dist/actions/relint.mjs +55 -45
  10. package/dist/actions/relint.mjs.map +1 -1
  11. package/dist/bin/package/relint.mjs +106 -0
  12. package/dist/bin/package/relint.mjs.map +1 -0
  13. package/dist/bin/xy.mjs +90 -102
  14. package/dist/bin/xy.mjs.map +1 -1
  15. package/dist/index.d.ts +29 -23
  16. package/dist/index.mjs +99 -141
  17. package/dist/index.mjs.map +1 -1
  18. package/dist/xy/index.mjs +90 -102
  19. package/dist/xy/index.mjs.map +1 -1
  20. package/dist/xy/xy.mjs +90 -102
  21. package/dist/xy/xy.mjs.map +1 -1
  22. package/dist/xy/xyBuildCommands.mjs +1 -7
  23. package/dist/xy/xyBuildCommands.mjs.map +1 -1
  24. package/dist/xy/xyLintCommands.mjs +86 -112
  25. package/dist/xy/xyLintCommands.mjs.map +1 -1
  26. package/package.json +5 -4
  27. package/src/actions/fix.ts +3 -2
  28. package/src/actions/index.ts +0 -2
  29. package/src/actions/lint.ts +15 -42
  30. package/src/actions/recompile.ts +2 -5
  31. package/src/actions/relint.ts +71 -18
  32. package/src/bin/package/relint.ts +16 -0
  33. package/src/xy/xyLintCommands.ts +6 -8
  34. package/dist/actions/lint-clean.mjs +0 -222
  35. package/dist/actions/lint-clean.mjs.map +0 -1
  36. package/dist/actions/lint-profile.mjs +0 -118
  37. package/dist/actions/lint-profile.mjs.map +0 -1
  38. package/src/actions/lint-clean.ts +0 -24
  39. 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,25 @@ 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"
986
- ];
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);
975
+ var lintPackage = /* @__PURE__ */ __name(({ pkg, fix: fix2 }) => {
976
+ console.log(chalk14.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
977
+ const start = Date.now();
978
+ const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
979
+ [
980
+ "yarn",
981
+ [
982
+ "workspace",
983
+ pkg,
984
+ "run",
985
+ fix2 ? "package-fix" : "package-lint"
986
+ ]
987
+ ]
988
+ ]);
989
+ console.log(chalk14.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk14.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk14.gray("seconds")}`));
990
+ return result;
1009
991
  }, "lintPackage");
1010
- var lint = /* @__PURE__ */ __name(async ({ pkg, verbose, incremental, fix: fix2 } = {}) => {
1011
- return pkg ? await lintPackage({
992
+ var lint = /* @__PURE__ */ __name(({ pkg, verbose, incremental, fix: fix2 } = {}) => {
993
+ return pkg ? lintPackage({
1012
994
  pkg,
1013
995
  fix: fix2
1014
996
  }) : lintAllPackages({
@@ -1050,8 +1032,9 @@ var lintAllPackages = /* @__PURE__ */ __name(({ fix: fix2, verbose = true, incre
1050
1032
  }, "lintAllPackages");
1051
1033
 
1052
1034
  // src/actions/fix.ts
1053
- var fix = /* @__PURE__ */ __name(async () => {
1054
- return await lint({
1035
+ var fix = /* @__PURE__ */ __name((params) => {
1036
+ return lint({
1037
+ ...params,
1055
1038
  fix: true
1056
1039
  });
1057
1040
  }, "fix");
@@ -1253,25 +1236,6 @@ var license = /* @__PURE__ */ __name(async (pkg) => {
1253
1236
  }))).reduce((prev, value) => prev || value, 0);
1254
1237
  }, "license");
1255
1238
 
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
1239
  // src/actions/npmignore-gen.ts
1276
1240
  var filename2 = ".npmignore";
1277
1241
  var npmignoreGen = /* @__PURE__ */ __name((pkg) => generateIgnoreFiles(filename2, pkg), "npmignoreGen");
@@ -1346,23 +1310,17 @@ var recompile = /* @__PURE__ */ __name(async ({ verbose, target, pkg, incrementa
1346
1310
  verbose
1347
1311
  });
1348
1312
  }, "recompile");
1349
- var recompilePackage = /* @__PURE__ */ __name(({ verbose, target, pkg }) => {
1313
+ var recompilePackage = /* @__PURE__ */ __name(({ target, pkg }) => {
1350
1314
  const targetOptions = target ? [
1351
1315
  "-t",
1352
1316
  target
1353
1317
  ] : [];
1354
- const verboseOptions = verbose ? [
1355
- "--verbose"
1356
- ] : [
1357
- "--no-verbose"
1358
- ];
1359
1318
  return runStepsAsync(`Recompile [${pkg}]`, [
1360
1319
  [
1361
1320
  "yarn",
1362
1321
  [
1363
1322
  "workspace",
1364
1323
  pkg,
1365
- ...verboseOptions,
1366
1324
  "run",
1367
1325
  "package-recompile",
1368
1326
  ...targetOptions
@@ -1459,35 +1417,63 @@ var reinstall = /* @__PURE__ */ __name(() => {
1459
1417
  }, "reinstall");
1460
1418
 
1461
1419
  // 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", [
1420
+ import chalk19 from "chalk";
1421
+ var relintPackage = /* @__PURE__ */ __name(({ pkg }) => {
1422
+ console.log(chalk19.gray(`${"Relint"} [All-Packages]`));
1423
+ const start = Date.now();
1424
+ const result = runSteps("Relint [All-Packages]", [
1481
1425
  [
1482
1426
  "yarn",
1483
1427
  [
1484
- "eslint",
1485
- ".",
1486
- "--cache"
1428
+ "workspace",
1429
+ pkg,
1430
+ "run",
1431
+ "package-relint"
1487
1432
  ]
1488
1433
  ]
1489
1434
  ]);
1435
+ console.log(chalk19.gray(`${"Relinted in"} [${chalk19.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk19.gray("seconds")}`));
1436
+ return result;
1437
+ }, "relintPackage");
1438
+ var relint = /* @__PURE__ */ __name(({ pkg, verbose, incremental } = {}) => {
1439
+ return pkg ? relintPackage({
1440
+ pkg
1441
+ }) : relintAllPackages({
1442
+ verbose,
1443
+ incremental
1444
+ });
1490
1445
  }, "relint");
1446
+ var relintAllPackages = /* @__PURE__ */ __name(({ verbose = true, incremental } = {}) => {
1447
+ console.log(chalk19.gray(`${"Relint"} [All-Packages]`));
1448
+ const start = Date.now();
1449
+ const verboseOptions = verbose ? [
1450
+ "--verbose"
1451
+ ] : [
1452
+ "--no-verbose"
1453
+ ];
1454
+ const incrementalOptions = incremental ? [
1455
+ "--since",
1456
+ "-Ap"
1457
+ ] : [
1458
+ "--parallel",
1459
+ "-Ap"
1460
+ ];
1461
+ const result = runSteps(`${"Relint"} [All-Packages]`, [
1462
+ [
1463
+ "yarn",
1464
+ [
1465
+ "workspaces",
1466
+ "foreach",
1467
+ ...verboseOptions,
1468
+ ...incrementalOptions,
1469
+ "run",
1470
+ "package-relint"
1471
+ ]
1472
+ ]
1473
+ ]);
1474
+ console.log(chalk19.gray(`Relinted in [${chalk19.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk19.gray("seconds")}`));
1475
+ return result;
1476
+ }, "relintAllPackages");
1491
1477
 
1492
1478
  // src/actions/retest.ts
1493
1479
  var retest = /* @__PURE__ */ __name(() => {
@@ -1525,7 +1511,7 @@ var sonar = /* @__PURE__ */ __name(() => {
1525
1511
  }, "sonar");
1526
1512
 
1527
1513
  // src/actions/statics.ts
1528
- import chalk19 from "chalk";
1514
+ import chalk20 from "chalk";
1529
1515
  var DefaultDependencies = [
1530
1516
  "axios",
1531
1517
  "@xylabs/pixel",
@@ -1536,7 +1522,7 @@ var DefaultDependencies = [
1536
1522
  "@mui/system"
1537
1523
  ];
1538
1524
  var statics = /* @__PURE__ */ __name(() => {
1539
- console.log(chalk19.green("Check Required Static Dependencies"));
1525
+ console.log(chalk20.green("Check Required Static Dependencies"));
1540
1526
  const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
1541
1527
  return detectDuplicateDependencies(statics2, DefaultDependencies);
1542
1528
  }, "statics");
@@ -1892,7 +1878,7 @@ var xyInstallCommands = /* @__PURE__ */ __name((args) => {
1892
1878
  }, "xyInstallCommands");
1893
1879
 
1894
1880
  // src/xy/xyLintCommands.ts
1895
- import chalk20 from "chalk";
1881
+ import chalk21 from "chalk";
1896
1882
  var xyLintCommands = /* @__PURE__ */ __name((args) => {
1897
1883
  return args.command("cycle [package]", "Cycle - Check for dependency cycles", (yargs2) => {
1898
1884
  return packagePositionalParam(yargs2);
@@ -1900,30 +1886,32 @@ var xyLintCommands = /* @__PURE__ */ __name((args) => {
1900
1886
  const start = Date.now();
1901
1887
  if (argv.verbose) console.log("Cycle");
1902
1888
  process.exitCode = await cycle();
1903
- console.log(chalk20.blue(`Finished in ${Date.now() - start}ms`));
1889
+ console.log(chalk21.blue(`Finished in ${Date.now() - start}ms`));
1904
1890
  }).command("lint [package]", "Lint - Run Eslint", (yargs2) => {
1905
1891
  return packagePositionalParam(yargs2);
1906
- }, async (argv) => {
1892
+ }, (argv) => {
1907
1893
  if (argv.verbose) console.log("Lint");
1908
1894
  const start = Date.now();
1909
- process.exitCode = argv.fix ? await fix() : argv.profile ? lintProfile() : await lint({
1895
+ process.exitCode = argv.fix ? fix({
1896
+ pkg: argv.package
1897
+ }) : lint({
1910
1898
  pkg: argv.package
1911
1899
  });
1912
- console.log(chalk20.blue(`Finished in ${Date.now() - start}ms`));
1900
+ console.log(chalk21.blue(`Finished in ${Date.now() - start}ms`));
1913
1901
  }).command("fix [package]", "Fix - Run Eslint w/fix", (yargs2) => {
1914
1902
  return packagePositionalParam(yargs2);
1915
- }, async (argv) => {
1903
+ }, (argv) => {
1916
1904
  const start = Date.now();
1917
1905
  if (argv.verbose) console.log("Fix");
1918
- process.exitCode = await fix();
1919
- console.log(chalk20.blue(`Finished in ${Date.now() - start}ms`));
1906
+ process.exitCode = fix();
1907
+ console.log(chalk21.blue(`Finished in ${Date.now() - start}ms`));
1920
1908
  }).command("relint [package]", "Relint - Clean & Lint", (yargs2) => {
1921
1909
  return packagePositionalParam(yargs2);
1922
1910
  }, (argv) => {
1923
1911
  if (argv.verbose) console.log("Relinting");
1924
1912
  const start = Date.now();
1925
1913
  process.exitCode = relint();
1926
- console.log(chalk20.blue(`Finished in ${Date.now() - start}ms`));
1914
+ console.log(chalk21.blue(`Finished in ${Date.now() - start}ms`));
1927
1915
  }).command("publint [package]", "Publint - Run Publint", (yargs2) => {
1928
1916
  return packagePositionalParam(yargs2);
1929
1917
  }, async (argv) => {
@@ -1933,14 +1921,14 @@ var xyLintCommands = /* @__PURE__ */ __name((args) => {
1933
1921
  pkg: argv.package,
1934
1922
  verbose: !!argv.verbose
1935
1923
  });
1936
- console.log(chalk20.blue(`Finished in ${Date.now() - start}ms`));
1924
+ console.log(chalk21.blue(`Finished in ${Date.now() - start}ms`));
1937
1925
  }).command("sonar", "Sonar - Run Sonar Check", (yargs2) => {
1938
1926
  return packagePositionalParam(yargs2);
1939
1927
  }, (argv) => {
1940
1928
  const start = Date.now();
1941
1929
  if (argv.verbose) console.log("Sonar Check");
1942
1930
  process.exitCode = sonar();
1943
- console.log(chalk20.blue(`Finished in ${Date.now() - start}ms`));
1931
+ console.log(chalk21.blue(`Finished in ${Date.now() - start}ms`));
1944
1932
  });
1945
1933
  }, "xyLintCommands");
1946
1934
 
@@ -2002,8 +1990,8 @@ var xyParseOptions = /* @__PURE__ */ __name(() => {
2002
1990
  var xy = /* @__PURE__ */ __name(async () => {
2003
1991
  const options = xyParseOptions();
2004
1992
  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"));
1993
+ console.error(chalk22.yellow(`Command not found [${chalk22.magenta(process.argv[2])}]`));
1994
+ console.log(chalk22.gray("Try 'yarn xy --help' for list of commands"));
2007
1995
  }).version().help().argv;
2008
1996
  }, "xy");
2009
1997