@xylabs/ts-scripts-yarn3 7.1.7 → 7.2.2

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 (38) hide show
  1. package/dist/actions/deplint/checkPackage/checkPackage.mjs +12 -1
  2. package/dist/actions/deplint/checkPackage/checkPackage.mjs.map +1 -1
  3. package/dist/actions/deplint/checkPackage/index.mjs +12 -1
  4. package/dist/actions/deplint/checkPackage/index.mjs.map +1 -1
  5. package/dist/actions/deplint/deplint.mjs +12 -1
  6. package/dist/actions/deplint/deplint.mjs.map +1 -1
  7. package/dist/actions/deplint/getExternalImportsFromFiles.mjs +12 -1
  8. package/dist/actions/deplint/getExternalImportsFromFiles.mjs.map +1 -1
  9. package/dist/actions/deplint/getImportsFromFile.mjs +14 -2
  10. package/dist/actions/deplint/getImportsFromFile.mjs.map +1 -1
  11. package/dist/actions/deplint/index.mjs +12 -1
  12. package/dist/actions/deplint/index.mjs.map +1 -1
  13. package/dist/actions/gitignore-gen.mjs +1 -1
  14. package/dist/actions/gitignore-gen.mjs.map +1 -1
  15. package/dist/actions/index.mjs +39 -23
  16. package/dist/actions/index.mjs.map +1 -1
  17. package/dist/actions/npmignore-gen.mjs +1 -1
  18. package/dist/actions/npmignore-gen.mjs.map +1 -1
  19. package/dist/actions/relint.mjs +26 -21
  20. package/dist/actions/relint.mjs.map +1 -1
  21. package/dist/bin/xy.mjs +39 -23
  22. package/dist/bin/xy.mjs.map +1 -1
  23. package/dist/index.d.ts +5 -3
  24. package/dist/index.mjs +39 -23
  25. package/dist/index.mjs.map +1 -1
  26. package/dist/lib/generateIgnoreFiles.mjs +1 -1
  27. package/dist/lib/generateIgnoreFiles.mjs.map +1 -1
  28. package/dist/lib/index.mjs +1 -1
  29. package/dist/lib/index.mjs.map +1 -1
  30. package/dist/xy/index.mjs +39 -23
  31. package/dist/xy/index.mjs.map +1 -1
  32. package/dist/xy/xy.mjs +39 -23
  33. package/dist/xy/xy.mjs.map +1 -1
  34. package/dist/xy/xyCommonCommands.mjs +1 -1
  35. package/dist/xy/xyCommonCommands.mjs.map +1 -1
  36. package/dist/xy/xyLintCommands.mjs +38 -22
  37. package/dist/xy/xyLintCommands.mjs.map +1 -1
  38. package/package.json +19 -19
package/dist/xy/xy.mjs CHANGED
@@ -274,7 +274,7 @@ var INIT_CWD = () => {
274
274
 
275
275
  // src/lib/generateIgnoreFiles.ts
276
276
  var localeCompare = (a, b) => a.localeCompare(b);
277
- var mergeEntries = (a, b) => [...union(a, b)].sort(localeCompare);
277
+ var mergeEntries = (a, b) => [...union(a, b)].toSorted(localeCompare);
278
278
  var generateIgnoreFiles = (filename3, pkg) => {
279
279
  console.log(chalk4.green(`Generate ${filename3} Files`));
280
280
  const cwd = INIT_CWD() ?? ".";
@@ -650,6 +650,17 @@ function getBasePackageName(importName) {
650
650
  }
651
651
 
652
652
  // src/actions/deplint/getImportsFromFile.ts
653
+ function isTypeOnlyImportClause(clause) {
654
+ if (clause === void 0) {
655
+ return false;
656
+ }
657
+ if ("phaseModifier" in clause) {
658
+ const mod = clause.phaseModifier;
659
+ const kind = typeof mod === "number" ? mod : mod?.kind;
660
+ return kind === ts.SyntaxKind.TypeKeyword;
661
+ }
662
+ return clause.isTypeOnly;
663
+ }
653
664
  function getImportsFromFile(filePath, importPaths, typeImportPaths) {
654
665
  const sourceCode = fs3.readFileSync(filePath, "utf8");
655
666
  const isMjsFile = filePath.endsWith(".mjs");
@@ -666,7 +677,7 @@ function getImportsFromFile(filePath, importPaths, typeImportPaths) {
666
677
  function visit(node) {
667
678
  if (ts.isImportDeclaration(node) || ts.isExportDeclaration(node)) {
668
679
  const moduleSpecifier = node.moduleSpecifier?.getFullText();
669
- const isTypeImport = ts.isImportDeclaration(node) ? node.importClause?.isTypeOnly ?? false : false;
680
+ const isTypeImport = ts.isImportDeclaration(node) ? isTypeOnlyImportClause(node.importClause) : false;
670
681
  if (typeof moduleSpecifier === "string") {
671
682
  const trimmed = moduleSpecifier.replaceAll("'", "").replaceAll('"', "").trim();
672
683
  if (isTypeImport || isDeclarationFile) {
@@ -1355,43 +1366,48 @@ var reinstall = () => {
1355
1366
 
1356
1367
  // src/actions/relint.ts
1357
1368
  import chalk22 from "chalk";
1358
- var relintPackage = ({ pkg }) => {
1359
- console.log(chalk22.gray(`${"Relint"} [All-Packages]`));
1369
+ var relintPackage = ({
1370
+ pkg,
1371
+ fix: fix2,
1372
+ verbose
1373
+ }) => {
1374
+ console.log(chalk22.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
1360
1375
  const start = Date.now();
1361
- const result = runSteps("Relint [All-Packages]", [
1376
+ const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
1362
1377
  ["yarn", [
1363
1378
  "workspace",
1364
1379
  pkg,
1365
1380
  "run",
1366
- "package-relint"
1381
+ fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
1367
1382
  ]]
1368
1383
  ]);
1369
- console.log(chalk22.gray(`${"Relinted in"} [${chalk22.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk22.gray("seconds")}`));
1384
+ console.log(chalk22.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk22.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk22.gray("seconds")}`));
1370
1385
  return result;
1371
1386
  };
1372
1387
  var relint = ({
1373
1388
  pkg,
1374
1389
  verbose,
1375
- incremental
1390
+ incremental,
1391
+ fix: fix2
1376
1392
  } = {}) => {
1377
- return pkg ? relintPackage({ pkg }) : relintAllPackages({ verbose, incremental });
1393
+ return pkg === void 0 ? relintAllPackages({
1394
+ verbose,
1395
+ incremental,
1396
+ fix: fix2
1397
+ }) : relintPackage({
1398
+ pkg,
1399
+ fix: fix2,
1400
+ verbose
1401
+ });
1378
1402
  };
1379
- var relintAllPackages = ({ verbose = false, incremental } = {}) => {
1380
- console.log(chalk22.gray(`${"Relint"} [All-Packages]`));
1403
+ var relintAllPackages = ({ fix: fix2 = false } = {}) => {
1404
+ console.log(chalk22.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
1381
1405
  const start = Date.now();
1382
- const verboseOptions = verbose ? ["--verbose"] : ["--no-verbose"];
1383
- const incrementalOptions = incremental ? ["--since", "-Ap"] : ["--parallel", "-Ap"];
1384
- const result = runSteps(`${"Relint"} [All-Packages]`, [
1385
- ["yarn", [
1386
- "workspaces",
1387
- "foreach",
1388
- ...verboseOptions,
1389
- ...incrementalOptions,
1390
- "run",
1391
- "package-relint"
1392
- ]]
1406
+ const fixOptions = fix2 ? ["--fix"] : [];
1407
+ const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
1408
+ ["yarn", ["eslint", ...fixOptions]]
1393
1409
  ]);
1394
- console.log(chalk22.gray(`Relinted in [${chalk22.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk22.gray("seconds")}`));
1410
+ console.log(chalk22.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk22.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk22.gray("seconds")}`));
1395
1411
  return result;
1396
1412
  };
1397
1413