@xylabs/ts-scripts-yarn3 6.0.3 → 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.
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,31 @@ 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"
974
+ var lintPackage = /* @__PURE__ */ __name(({ pkg, fix: fix2, verbose }) => {
975
+ console.log(chalk14.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
976
+ const start = Date.now();
977
+ const verboseOptions = verbose ? [
978
+ "--verbose"
979
+ ] : [
980
+ "--no-verbose"
985
981
  ];
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);
982
+ const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
983
+ [
984
+ "yarn",
985
+ [
986
+ "workspace",
987
+ pkg,
988
+ ...verboseOptions,
989
+ "run",
990
+ fix2 ? "package-fix" : "package-lint"
991
+ ]
992
+ ]
993
+ ]);
994
+ console.log(chalk14.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk14.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk14.gray("seconds")}`));
995
+ return result;
1008
996
  }, "lintPackage");
1009
- var lint = /* @__PURE__ */ __name(async ({ pkg, verbose, incremental, fix: fix2 } = {}) => {
1010
- return pkg ? await lintPackage({
997
+ var lint = /* @__PURE__ */ __name(({ pkg, verbose, incremental, fix: fix2 } = {}) => {
998
+ return pkg ? lintPackage({
1011
999
  pkg,
1012
1000
  fix: fix2
1013
1001
  }) : lintAllPackages({
@@ -1049,8 +1037,9 @@ var lintAllPackages = /* @__PURE__ */ __name(({ fix: fix2, verbose = true, incre
1049
1037
  }, "lintAllPackages");
1050
1038
 
1051
1039
  // src/actions/fix.ts
1052
- var fix = /* @__PURE__ */ __name(async () => {
1053
- return await lint({
1040
+ var fix = /* @__PURE__ */ __name((params) => {
1041
+ return lint({
1042
+ ...params,
1054
1043
  fix: true
1055
1044
  });
1056
1045
  }, "fix");
@@ -1252,25 +1241,6 @@ var license = /* @__PURE__ */ __name(async (pkg) => {
1252
1241
  }))).reduce((prev, value) => prev || value, 0);
1253
1242
  }, "license");
1254
1243
 
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
1244
  // src/actions/npmignore-gen.ts
1275
1245
  var filename2 = ".npmignore";
1276
1246
  var npmignoreGen = /* @__PURE__ */ __name((pkg) => generateIgnoreFiles(filename2, pkg), "npmignoreGen");
@@ -1458,35 +1428,69 @@ var reinstall = /* @__PURE__ */ __name(() => {
1458
1428
  }, "reinstall");
1459
1429
 
1460
1430
  // 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", [
1431
+ import chalk19 from "chalk";
1432
+ var relintPackage = /* @__PURE__ */ __name(({ pkg, verbose }) => {
1433
+ console.log(chalk19.gray(`${"Relint"} [All-Packages]`));
1434
+ const start = Date.now();
1435
+ const verboseOptions = verbose ? [
1436
+ "--verbose"
1437
+ ] : [
1438
+ "--no-verbose"
1439
+ ];
1440
+ const result = runSteps("Relint [All-Packages]", [
1480
1441
  [
1481
1442
  "yarn",
1482
1443
  [
1483
- "eslint",
1484
- ".",
1485
- "--cache"
1444
+ "workspace",
1445
+ pkg,
1446
+ ...verboseOptions,
1447
+ "run",
1448
+ "package-relint"
1486
1449
  ]
1487
1450
  ]
1488
1451
  ]);
1452
+ console.log(chalk19.gray(`${"Relinted in"} [${chalk19.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk19.gray("seconds")}`));
1453
+ return result;
1454
+ }, "relintPackage");
1455
+ var relint = /* @__PURE__ */ __name(({ pkg, verbose, incremental } = {}) => {
1456
+ return pkg ? relintPackage({
1457
+ pkg
1458
+ }) : relintAllPackages({
1459
+ verbose,
1460
+ incremental
1461
+ });
1489
1462
  }, "relint");
1463
+ var relintAllPackages = /* @__PURE__ */ __name(({ verbose = true, incremental } = {}) => {
1464
+ console.log(chalk19.gray(`${"Relint"} [All-Packages]`));
1465
+ const start = Date.now();
1466
+ const verboseOptions = verbose ? [
1467
+ "--verbose"
1468
+ ] : [
1469
+ "--no-verbose"
1470
+ ];
1471
+ const incrementalOptions = incremental ? [
1472
+ "--since",
1473
+ "-Ap"
1474
+ ] : [
1475
+ "--parallel",
1476
+ "-Ap"
1477
+ ];
1478
+ const result = runSteps(`${"Relint"} [All-Packages]`, [
1479
+ [
1480
+ "yarn",
1481
+ [
1482
+ "workspaces",
1483
+ "foreach",
1484
+ ...verboseOptions,
1485
+ ...incrementalOptions,
1486
+ "run",
1487
+ "package-relint"
1488
+ ]
1489
+ ]
1490
+ ]);
1491
+ console.log(chalk19.gray(`Relinted in [${chalk19.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk19.gray("seconds")}`));
1492
+ return result;
1493
+ }, "relintAllPackages");
1490
1494
 
1491
1495
  // src/actions/retest.ts
1492
1496
  var retest = /* @__PURE__ */ __name(() => {
@@ -1524,7 +1528,7 @@ var sonar = /* @__PURE__ */ __name(() => {
1524
1528
  }, "sonar");
1525
1529
 
1526
1530
  // src/actions/statics.ts
1527
- import chalk19 from "chalk";
1531
+ import chalk20 from "chalk";
1528
1532
  var DefaultDependencies = [
1529
1533
  "axios",
1530
1534
  "@xylabs/pixel",
@@ -1535,7 +1539,7 @@ var DefaultDependencies = [
1535
1539
  "@mui/system"
1536
1540
  ];
1537
1541
  var statics = /* @__PURE__ */ __name(() => {
1538
- console.log(chalk19.green("Check Required Static Dependencies"));
1542
+ console.log(chalk20.green("Check Required Static Dependencies"));
1539
1543
  const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
1540
1544
  return detectDuplicateDependencies(statics2, DefaultDependencies);
1541
1545
  }, "statics");
@@ -1891,7 +1895,7 @@ var xyInstallCommands = /* @__PURE__ */ __name((args) => {
1891
1895
  }, "xyInstallCommands");
1892
1896
 
1893
1897
  // src/xy/xyLintCommands.ts
1894
- import chalk20 from "chalk";
1898
+ import chalk21 from "chalk";
1895
1899
  var xyLintCommands = /* @__PURE__ */ __name((args) => {
1896
1900
  return args.command("cycle [package]", "Cycle - Check for dependency cycles", (yargs2) => {
1897
1901
  return packagePositionalParam(yargs2);
@@ -1899,30 +1903,32 @@ var xyLintCommands = /* @__PURE__ */ __name((args) => {
1899
1903
  const start = Date.now();
1900
1904
  if (argv.verbose) console.log("Cycle");
1901
1905
  process.exitCode = await cycle();
1902
- console.log(chalk20.blue(`Finished in ${Date.now() - start}ms`));
1906
+ console.log(chalk21.blue(`Finished in ${Date.now() - start}ms`));
1903
1907
  }).command("lint [package]", "Lint - Run Eslint", (yargs2) => {
1904
1908
  return packagePositionalParam(yargs2);
1905
- }, async (argv) => {
1909
+ }, (argv) => {
1906
1910
  if (argv.verbose) console.log("Lint");
1907
1911
  const start = Date.now();
1908
- process.exitCode = argv.fix ? await fix() : argv.profile ? lintProfile() : await lint({
1912
+ process.exitCode = argv.fix ? fix({
1913
+ pkg: argv.package
1914
+ }) : lint({
1909
1915
  pkg: argv.package
1910
1916
  });
1911
- console.log(chalk20.blue(`Finished in ${Date.now() - start}ms`));
1917
+ console.log(chalk21.blue(`Finished in ${Date.now() - start}ms`));
1912
1918
  }).command("fix [package]", "Fix - Run Eslint w/fix", (yargs2) => {
1913
1919
  return packagePositionalParam(yargs2);
1914
- }, async (argv) => {
1920
+ }, (argv) => {
1915
1921
  const start = Date.now();
1916
1922
  if (argv.verbose) console.log("Fix");
1917
- process.exitCode = await fix();
1918
- console.log(chalk20.blue(`Finished in ${Date.now() - start}ms`));
1923
+ process.exitCode = fix();
1924
+ console.log(chalk21.blue(`Finished in ${Date.now() - start}ms`));
1919
1925
  }).command("relint [package]", "Relint - Clean & Lint", (yargs2) => {
1920
1926
  return packagePositionalParam(yargs2);
1921
1927
  }, (argv) => {
1922
1928
  if (argv.verbose) console.log("Relinting");
1923
1929
  const start = Date.now();
1924
1930
  process.exitCode = relint();
1925
- console.log(chalk20.blue(`Finished in ${Date.now() - start}ms`));
1931
+ console.log(chalk21.blue(`Finished in ${Date.now() - start}ms`));
1926
1932
  }).command("publint [package]", "Publint - Run Publint", (yargs2) => {
1927
1933
  return packagePositionalParam(yargs2);
1928
1934
  }, async (argv) => {
@@ -1932,14 +1938,14 @@ var xyLintCommands = /* @__PURE__ */ __name((args) => {
1932
1938
  pkg: argv.package,
1933
1939
  verbose: !!argv.verbose
1934
1940
  });
1935
- console.log(chalk20.blue(`Finished in ${Date.now() - start}ms`));
1941
+ console.log(chalk21.blue(`Finished in ${Date.now() - start}ms`));
1936
1942
  }).command("sonar", "Sonar - Run Sonar Check", (yargs2) => {
1937
1943
  return packagePositionalParam(yargs2);
1938
1944
  }, (argv) => {
1939
1945
  const start = Date.now();
1940
1946
  if (argv.verbose) console.log("Sonar Check");
1941
1947
  process.exitCode = sonar();
1942
- console.log(chalk20.blue(`Finished in ${Date.now() - start}ms`));
1948
+ console.log(chalk21.blue(`Finished in ${Date.now() - start}ms`));
1943
1949
  });
1944
1950
  }, "xyLintCommands");
1945
1951
 
@@ -2001,8 +2007,8 @@ var xyParseOptions = /* @__PURE__ */ __name(() => {
2001
2007
  var xy = /* @__PURE__ */ __name(async () => {
2002
2008
  const options = xyParseOptions();
2003
2009
  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"));
2010
+ console.error(chalk22.yellow(`Command not found [${chalk22.magenta(process.argv[2])}]`));
2011
+ console.log(chalk22.gray("Try 'yarn xy --help' for list of commands"));
2006
2012
  }).version().help().argv;
2007
2013
  }, "xy");
2008
2014
  export {