@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/xy/index.mjs CHANGED
@@ -2,7 +2,7 @@ var __defProp = Object.defineProperty;
2
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
3
 
4
4
  // src/xy/xy.ts
5
- import chalk21 from "chalk";
5
+ import chalk22 from "chalk";
6
6
 
7
7
  // src/actions/build.ts
8
8
  import chalk7 from "chalk";
@@ -971,43 +971,25 @@ var dupdeps = /* @__PURE__ */ __name(() => {
971
971
 
972
972
  // src/actions/lint.ts
973
973
  import chalk14 from "chalk";
974
- import { ESLint as ESLint2 } from "eslint";
975
- var dumpMessages = /* @__PURE__ */ __name((lintResults) => {
976
- const colors = [
977
- "white",
978
- "yellow",
979
- "red"
980
- ];
981
- const severity = [
982
- "none",
983
- "warning",
984
- "error"
985
- ];
986
- for (const lintResult of lintResults) {
987
- if (lintResult.messages.length > 0) {
988
- console.log(chalk14.gray(`${lintResult.filePath}`));
989
- for (const message of lintResult.messages) {
990
- console.log(chalk14.gray(` ${message.line}:${message.column}`), chalk14[colors[message.severity]](` ${severity[message.severity]}`), chalk14.white(` ${message.message}`), chalk14.gray(` ${message.ruleId}`));
991
- }
992
- }
993
- }
994
- }, "dumpMessages");
995
- var lintPackage = /* @__PURE__ */ __name(async ({ pkg, fix: fix2 }) => {
996
- const workspace = yarnWorkspaces().find((workspace2) => workspace2.name === pkg);
997
- if (!workspace) {
998
- console.error(chalk14.red(`Unable to locate package [${chalk14.magenta(pkg)}]`));
999
- process.exit(1);
1000
- }
1001
- const engine = new ESLint2({
1002
- cache: true,
1003
- fix: fix2
1004
- });
1005
- const lintResults = await engine.lintFiles(workspace.location);
1006
- dumpMessages(lintResults);
1007
- return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0);
974
+ var lintPackage = /* @__PURE__ */ __name(({ pkg, fix: fix2 }) => {
975
+ console.log(chalk14.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
976
+ const start = Date.now();
977
+ const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
978
+ [
979
+ "yarn",
980
+ [
981
+ "workspace",
982
+ pkg,
983
+ "run",
984
+ fix2 ? "package-fix" : "package-lint"
985
+ ]
986
+ ]
987
+ ]);
988
+ console.log(chalk14.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk14.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk14.gray("seconds")}`));
989
+ return result;
1008
990
  }, "lintPackage");
1009
- var lint = /* @__PURE__ */ __name(async ({ pkg, verbose, incremental, fix: fix2 } = {}) => {
1010
- return pkg ? await lintPackage({
991
+ var lint = /* @__PURE__ */ __name(({ pkg, verbose, incremental, fix: fix2 } = {}) => {
992
+ return pkg ? lintPackage({
1011
993
  pkg,
1012
994
  fix: fix2
1013
995
  }) : lintAllPackages({
@@ -1049,8 +1031,9 @@ var lintAllPackages = /* @__PURE__ */ __name(({ fix: fix2, verbose = true, incre
1049
1031
  }, "lintAllPackages");
1050
1032
 
1051
1033
  // src/actions/fix.ts
1052
- var fix = /* @__PURE__ */ __name(async () => {
1053
- return await lint({
1034
+ var fix = /* @__PURE__ */ __name((params) => {
1035
+ return lint({
1036
+ ...params,
1054
1037
  fix: true
1055
1038
  });
1056
1039
  }, "fix");
@@ -1252,25 +1235,6 @@ var license = /* @__PURE__ */ __name(async (pkg) => {
1252
1235
  }))).reduce((prev, value) => prev || value, 0);
1253
1236
  }, "license");
1254
1237
 
1255
- // src/actions/lint-profile.ts
1256
- var lintProfile = /* @__PURE__ */ __name(() => {
1257
- return runSteps("Lint Profile", [
1258
- [
1259
- "yarn",
1260
- [
1261
- "xy",
1262
- "lint"
1263
- ],
1264
- {
1265
- env: {
1266
- ...process.env,
1267
- TIMING: "1"
1268
- }
1269
- }
1270
- ]
1271
- ]);
1272
- }, "lintProfile");
1273
-
1274
1238
  // src/actions/npmignore-gen.ts
1275
1239
  var filename2 = ".npmignore";
1276
1240
  var npmignoreGen = /* @__PURE__ */ __name((pkg) => generateIgnoreFiles(filename2, pkg), "npmignoreGen");
@@ -1345,23 +1309,17 @@ var recompile = /* @__PURE__ */ __name(async ({ verbose, target, pkg, incrementa
1345
1309
  verbose
1346
1310
  });
1347
1311
  }, "recompile");
1348
- var recompilePackage = /* @__PURE__ */ __name(({ verbose, target, pkg }) => {
1312
+ var recompilePackage = /* @__PURE__ */ __name(({ target, pkg }) => {
1349
1313
  const targetOptions = target ? [
1350
1314
  "-t",
1351
1315
  target
1352
1316
  ] : [];
1353
- const verboseOptions = verbose ? [
1354
- "--verbose"
1355
- ] : [
1356
- "--no-verbose"
1357
- ];
1358
1317
  return runStepsAsync(`Recompile [${pkg}]`, [
1359
1318
  [
1360
1319
  "yarn",
1361
1320
  [
1362
1321
  "workspace",
1363
1322
  pkg,
1364
- ...verboseOptions,
1365
1323
  "run",
1366
1324
  "package-recompile",
1367
1325
  ...targetOptions
@@ -1458,35 +1416,63 @@ var reinstall = /* @__PURE__ */ __name(() => {
1458
1416
  }, "reinstall");
1459
1417
 
1460
1418
  // src/actions/relint.ts
1461
- import { rmSync as rmSync2 } from "node:fs";
1462
- var relint = /* @__PURE__ */ __name(() => {
1463
- console.log("Relint - Cleaning [.eslintcache]");
1464
- const workspaces = yarnWorkspaces();
1465
- const result = workspaces.map(({ location, name }) => {
1466
- const dist = `${location}/.eslintcache`;
1467
- try {
1468
- rmSync2(dist, {
1469
- force: true,
1470
- recursive: true
1471
- });
1472
- return 0;
1473
- } catch (ex) {
1474
- const error = ex;
1475
- console.error(`Relint - Cleaning [.eslintcache] Failed [${name}, ${error.message}]`);
1476
- return 1;
1477
- }
1478
- }).reduce((prev, result2) => prev || result2, 0);
1479
- return result || runSteps("Relint", [
1419
+ import chalk19 from "chalk";
1420
+ var relintPackage = /* @__PURE__ */ __name(({ pkg }) => {
1421
+ console.log(chalk19.gray(`${"Relint"} [All-Packages]`));
1422
+ const start = Date.now();
1423
+ const result = runSteps("Relint [All-Packages]", [
1480
1424
  [
1481
1425
  "yarn",
1482
1426
  [
1483
- "eslint",
1484
- ".",
1485
- "--cache"
1427
+ "workspace",
1428
+ pkg,
1429
+ "run",
1430
+ "package-relint"
1486
1431
  ]
1487
1432
  ]
1488
1433
  ]);
1434
+ console.log(chalk19.gray(`${"Relinted in"} [${chalk19.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk19.gray("seconds")}`));
1435
+ return result;
1436
+ }, "relintPackage");
1437
+ var relint = /* @__PURE__ */ __name(({ pkg, verbose, incremental } = {}) => {
1438
+ return pkg ? relintPackage({
1439
+ pkg
1440
+ }) : relintAllPackages({
1441
+ verbose,
1442
+ incremental
1443
+ });
1489
1444
  }, "relint");
1445
+ var relintAllPackages = /* @__PURE__ */ __name(({ verbose = true, incremental } = {}) => {
1446
+ console.log(chalk19.gray(`${"Relint"} [All-Packages]`));
1447
+ const start = Date.now();
1448
+ const verboseOptions = verbose ? [
1449
+ "--verbose"
1450
+ ] : [
1451
+ "--no-verbose"
1452
+ ];
1453
+ const incrementalOptions = incremental ? [
1454
+ "--since",
1455
+ "-Ap"
1456
+ ] : [
1457
+ "--parallel",
1458
+ "-Ap"
1459
+ ];
1460
+ const result = runSteps(`${"Relint"} [All-Packages]`, [
1461
+ [
1462
+ "yarn",
1463
+ [
1464
+ "workspaces",
1465
+ "foreach",
1466
+ ...verboseOptions,
1467
+ ...incrementalOptions,
1468
+ "run",
1469
+ "package-relint"
1470
+ ]
1471
+ ]
1472
+ ]);
1473
+ console.log(chalk19.gray(`Relinted in [${chalk19.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk19.gray("seconds")}`));
1474
+ return result;
1475
+ }, "relintAllPackages");
1490
1476
 
1491
1477
  // src/actions/retest.ts
1492
1478
  var retest = /* @__PURE__ */ __name(() => {
@@ -1524,7 +1510,7 @@ var sonar = /* @__PURE__ */ __name(() => {
1524
1510
  }, "sonar");
1525
1511
 
1526
1512
  // src/actions/statics.ts
1527
- import chalk19 from "chalk";
1513
+ import chalk20 from "chalk";
1528
1514
  var DefaultDependencies = [
1529
1515
  "axios",
1530
1516
  "@xylabs/pixel",
@@ -1535,7 +1521,7 @@ var DefaultDependencies = [
1535
1521
  "@mui/system"
1536
1522
  ];
1537
1523
  var statics = /* @__PURE__ */ __name(() => {
1538
- console.log(chalk19.green("Check Required Static Dependencies"));
1524
+ console.log(chalk20.green("Check Required Static Dependencies"));
1539
1525
  const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
1540
1526
  return detectDuplicateDependencies(statics2, DefaultDependencies);
1541
1527
  }, "statics");
@@ -1891,7 +1877,7 @@ var xyInstallCommands = /* @__PURE__ */ __name((args) => {
1891
1877
  }, "xyInstallCommands");
1892
1878
 
1893
1879
  // src/xy/xyLintCommands.ts
1894
- import chalk20 from "chalk";
1880
+ import chalk21 from "chalk";
1895
1881
  var xyLintCommands = /* @__PURE__ */ __name((args) => {
1896
1882
  return args.command("cycle [package]", "Cycle - Check for dependency cycles", (yargs2) => {
1897
1883
  return packagePositionalParam(yargs2);
@@ -1899,30 +1885,32 @@ var xyLintCommands = /* @__PURE__ */ __name((args) => {
1899
1885
  const start = Date.now();
1900
1886
  if (argv.verbose) console.log("Cycle");
1901
1887
  process.exitCode = await cycle();
1902
- console.log(chalk20.blue(`Finished in ${Date.now() - start}ms`));
1888
+ console.log(chalk21.blue(`Finished in ${Date.now() - start}ms`));
1903
1889
  }).command("lint [package]", "Lint - Run Eslint", (yargs2) => {
1904
1890
  return packagePositionalParam(yargs2);
1905
- }, async (argv) => {
1891
+ }, (argv) => {
1906
1892
  if (argv.verbose) console.log("Lint");
1907
1893
  const start = Date.now();
1908
- process.exitCode = argv.fix ? await fix() : argv.profile ? lintProfile() : await lint({
1894
+ process.exitCode = argv.fix ? fix({
1895
+ pkg: argv.package
1896
+ }) : lint({
1909
1897
  pkg: argv.package
1910
1898
  });
1911
- console.log(chalk20.blue(`Finished in ${Date.now() - start}ms`));
1899
+ console.log(chalk21.blue(`Finished in ${Date.now() - start}ms`));
1912
1900
  }).command("fix [package]", "Fix - Run Eslint w/fix", (yargs2) => {
1913
1901
  return packagePositionalParam(yargs2);
1914
- }, async (argv) => {
1902
+ }, (argv) => {
1915
1903
  const start = Date.now();
1916
1904
  if (argv.verbose) console.log("Fix");
1917
- process.exitCode = await fix();
1918
- console.log(chalk20.blue(`Finished in ${Date.now() - start}ms`));
1905
+ process.exitCode = fix();
1906
+ console.log(chalk21.blue(`Finished in ${Date.now() - start}ms`));
1919
1907
  }).command("relint [package]", "Relint - Clean & Lint", (yargs2) => {
1920
1908
  return packagePositionalParam(yargs2);
1921
1909
  }, (argv) => {
1922
1910
  if (argv.verbose) console.log("Relinting");
1923
1911
  const start = Date.now();
1924
1912
  process.exitCode = relint();
1925
- console.log(chalk20.blue(`Finished in ${Date.now() - start}ms`));
1913
+ console.log(chalk21.blue(`Finished in ${Date.now() - start}ms`));
1926
1914
  }).command("publint [package]", "Publint - Run Publint", (yargs2) => {
1927
1915
  return packagePositionalParam(yargs2);
1928
1916
  }, async (argv) => {
@@ -1932,14 +1920,14 @@ var xyLintCommands = /* @__PURE__ */ __name((args) => {
1932
1920
  pkg: argv.package,
1933
1921
  verbose: !!argv.verbose
1934
1922
  });
1935
- console.log(chalk20.blue(`Finished in ${Date.now() - start}ms`));
1923
+ console.log(chalk21.blue(`Finished in ${Date.now() - start}ms`));
1936
1924
  }).command("sonar", "Sonar - Run Sonar Check", (yargs2) => {
1937
1925
  return packagePositionalParam(yargs2);
1938
1926
  }, (argv) => {
1939
1927
  const start = Date.now();
1940
1928
  if (argv.verbose) console.log("Sonar Check");
1941
1929
  process.exitCode = sonar();
1942
- console.log(chalk20.blue(`Finished in ${Date.now() - start}ms`));
1930
+ console.log(chalk21.blue(`Finished in ${Date.now() - start}ms`));
1943
1931
  });
1944
1932
  }, "xyLintCommands");
1945
1933
 
@@ -2001,8 +1989,8 @@ var xyParseOptions = /* @__PURE__ */ __name(() => {
2001
1989
  var xy = /* @__PURE__ */ __name(async () => {
2002
1990
  const options = xyParseOptions();
2003
1991
  return await xyBuildCommands(xyCommonCommands(xyInstallCommands(xyDeployCommands(xyLintCommands(options))))).demandCommand(1).command("*", "", () => {
2004
- console.error(chalk21.yellow(`Command not found [${chalk21.magenta(process.argv[2])}]`));
2005
- console.log(chalk21.gray("Try 'yarn xy --help' for list of commands"));
1992
+ console.error(chalk22.yellow(`Command not found [${chalk22.magenta(process.argv[2])}]`));
1993
+ console.log(chalk22.gray("Try 'yarn xy --help' for list of commands"));
2006
1994
  }).version().help().argv;
2007
1995
  }, "xy");
2008
1996
  export {