@xylabs/ts-scripts-yarn3 4.0.0-rc.11 → 4.0.0-rc.13

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 (91) hide show
  1. package/dist/actions/clean-docs.mjs +14 -4
  2. package/dist/actions/clean-docs.mjs.map +1 -1
  3. package/dist/actions/clean-eslint.mjs +16 -4
  4. package/dist/actions/clean-eslint.mjs.map +1 -1
  5. package/dist/actions/cycle.mjs +0 -7
  6. package/dist/actions/cycle.mjs.map +1 -1
  7. package/dist/actions/dupdeps.mjs +3 -2
  8. package/dist/actions/dupdeps.mjs.map +1 -1
  9. package/dist/actions/index.mjs +35 -26
  10. package/dist/actions/index.mjs.map +1 -1
  11. package/dist/actions/package/clean-outputs.mjs +16 -2
  12. package/dist/actions/package/clean-outputs.mjs.map +1 -1
  13. package/dist/actions/package/clean-typescript.mjs +16 -2
  14. package/dist/actions/package/clean-typescript.mjs.map +1 -1
  15. package/dist/actions/package/clean.mjs +17 -4
  16. package/dist/actions/package/clean.mjs.map +1 -1
  17. package/dist/actions/package/compile/compile.mjs +12 -5
  18. package/dist/actions/package/compile/compile.mjs.map +1 -1
  19. package/dist/actions/package/compile/getCompilerOptions.mjs +4 -2
  20. package/dist/actions/package/compile/getCompilerOptions.mjs.map +1 -1
  21. package/dist/actions/package/compile/index.mjs +12 -5
  22. package/dist/actions/package/compile/index.mjs.map +1 -1
  23. package/dist/actions/package/compile/packageCompileTsc.mjs +4 -2
  24. package/dist/actions/package/compile/packageCompileTsc.mjs.map +1 -1
  25. package/dist/actions/package/compile/packageCompileTscTypes.mjs +4 -2
  26. package/dist/actions/package/compile/packageCompileTscTypes.mjs.map +1 -1
  27. package/dist/actions/package/compile/packageCompileTsup.mjs.map +1 -1
  28. package/dist/actions/package/index.mjs +66 -46
  29. package/dist/actions/package/index.mjs.map +1 -1
  30. package/dist/actions/package/publint.mjs.map +1 -1
  31. package/dist/actions/package/recompile.mjs +53 -33
  32. package/dist/actions/package/recompile.mjs.map +1 -1
  33. package/dist/actions/statics.mjs +3 -2
  34. package/dist/actions/statics.mjs.map +1 -1
  35. package/dist/bin/package/clean-outputs.mjs +14 -2
  36. package/dist/bin/package/clean-outputs.mjs.map +1 -1
  37. package/dist/bin/package/clean-typescript.mjs +14 -2
  38. package/dist/bin/package/clean-typescript.mjs.map +1 -1
  39. package/dist/bin/package/clean.mjs +15 -4
  40. package/dist/bin/package/clean.mjs.map +1 -1
  41. package/dist/bin/package/compile-only.mjs +12 -5
  42. package/dist/bin/package/compile-only.mjs.map +1 -1
  43. package/dist/bin/package/compile-tsup.mjs.map +1 -1
  44. package/dist/bin/package/compile.mjs +12 -5
  45. package/dist/bin/package/compile.mjs.map +1 -1
  46. package/dist/bin/package/publint.mjs.map +1 -1
  47. package/dist/bin/package/recompile.mjs +31 -13
  48. package/dist/bin/package/recompile.mjs.map +1 -1
  49. package/dist/bin/xy-ts.mjs +17 -13
  50. package/dist/bin/xy-ts.mjs.map +1 -1
  51. package/dist/bin/xy.mjs +17 -13
  52. package/dist/bin/xy.mjs.map +1 -1
  53. package/dist/index.d.ts +3 -1
  54. package/dist/index.mjs +36 -26
  55. package/dist/index.mjs.map +1 -1
  56. package/dist/lib/deleteGlob.mjs +19 -0
  57. package/dist/lib/deleteGlob.mjs.map +1 -0
  58. package/dist/lib/dependencies/DuplicateDetector.mjs +3 -2
  59. package/dist/lib/dependencies/DuplicateDetector.mjs.map +1 -1
  60. package/dist/lib/dependencies/detectDuplicateDependencies.mjs +3 -2
  61. package/dist/lib/dependencies/detectDuplicateDependencies.mjs.map +1 -1
  62. package/dist/lib/dependencies/index.mjs +3 -2
  63. package/dist/lib/dependencies/index.mjs.map +1 -1
  64. package/dist/lib/index.mjs +25 -5
  65. package/dist/lib/index.mjs.map +1 -1
  66. package/dist/lib/loadConfig.mjs +8 -3
  67. package/dist/lib/loadConfig.mjs.map +1 -1
  68. package/dist/xy/index.mjs +17 -13
  69. package/dist/xy/index.mjs.map +1 -1
  70. package/dist/xy/xy.mjs +17 -13
  71. package/dist/xy/xy.mjs.map +1 -1
  72. package/dist/xy/xyCommonCommands.mjs +14 -4
  73. package/dist/xy/xyCommonCommands.mjs.map +1 -1
  74. package/dist/xy/xyInstallCommands.mjs +3 -2
  75. package/dist/xy/xyInstallCommands.mjs.map +1 -1
  76. package/dist/xy/xyLintCommands.mjs +0 -7
  77. package/dist/xy/xyLintCommands.mjs.map +1 -1
  78. package/dist/xy/xyParseOptions.mjs.map +1 -1
  79. package/package.json +10 -13
  80. package/src/actions/clean-docs.ts +2 -3
  81. package/src/actions/clean-eslint.ts +3 -2
  82. package/src/actions/cycle.ts +0 -5
  83. package/src/actions/package/clean-outputs.ts +3 -2
  84. package/src/actions/package/clean-typescript.ts +3 -2
  85. package/src/actions/package/compile/getCompilerOptions.ts +1 -3
  86. package/src/actions/package/publint.ts +1 -1
  87. package/src/lib/deleteGlob.ts +13 -0
  88. package/src/lib/dependencies/DuplicateDetector.ts +1 -3
  89. package/src/lib/index.ts +1 -0
  90. package/src/lib/loadConfig.ts +2 -4
  91. package/src/xy/xyParseOptions.ts +1 -1
package/dist/index.d.ts CHANGED
@@ -258,6 +258,8 @@ declare const defaultBuildConfig: {
258
258
  include: string[];
259
259
  };
260
260
 
261
+ declare const deleteGlob: (globPath: string) => void;
262
+
261
263
  declare const detectDuplicateDependencies: (depsFromPackageJSON?: string[], DefaultDependencies?: string[]) => number;
262
264
 
263
265
  declare class DuplicateDetector {
@@ -356,4 +358,4 @@ declare const xyLintCommands: (args: Argv) => Argv<{}>;
356
358
 
357
359
  declare const xyParseOptions: () => Argv;
358
360
 
359
- export { type BuildParams, CROSS_PLATFORM_NEWLINE, type CleanPackageParams, type CleanParams, type CompileConfig, type CompileMode, type CompileParams, type CopyAssetsParams, type DepsPackageParams, type DepsParams, DuplicateDetector, type DynamicShareConfig, type EntryMode, type GenDocsPackageParams, type GenDocsParams, INIT_CWD, type LintPackageParams, type LintParams, type LiveShareConfig, type PackageCompileTscConfig, type PackageCompileTsupConfig, type PackageCopyAssetsParams, type PackageJsonEx, type PackagePublintParams, type PathConfig, type PublintPackageParams, type PublintParams, type ReadFileSyncOptions, type RebuildParams, type RecompilePackageParams, type RecompileParams, type ScriptStep, WINDOWS_NEWLINE_REGEX, type Workspace, type XyConfig, type XyConfigBase, type XyTscConfig, type XyTsupConfig, build, checkResult, clean, cleanAll, cleanDocs, cleanPackage, compile, compileAll, compilePackage, copyAssets, createBuildConfig, cycle, dead, defaultBuildConfig, defaultReadFileSyncOptions, deploy, deployMajor, deployMinor, deployNext, deps, depsAll, depsPackage, detectDuplicateDependencies, dupdeps, empty, fix, genDocs, genDocsAll, genDocsPackage, generateIgnoreFiles, gitignoreGen, gitlint, gitlintFix, isYarnVersionOrGreater, license, lint, lintAll, lintClean, lintPackage, lintProfile, loadConfig, loadPackageConfig, multiLineToJSONArray, notEmpty, npmignoreGen, packageClean, packageCleanOutputs, packageCleanTypescript, packageCompile, packageCompileTsc, packageCompileTsup, packageCopyAssets, packageDeps, packageGenDocs, packagePublint, packageRecompile, parsedPackageJSON, processEx, publint, publintAll, publintPackage, readLines, readNonEmptyLines, rebuild, recompile, recompileAll, recompilePackage, reinstall, relint, retest, runStepAsync, runSteps, runStepsAsync, runXy, runXyWithWarning, safeExit, safeExitAsync, sonar, statics, test, tryReadFileSync, union, up, updateYarnPlugins, updateYarnVersion, updo, withErrnoException, withError, writeLines, xy, xyBuildCommands, xyCommonCommands, xyDeployCommands, xyInstallCommands, xyLintCommands, xyParseOptions, yarn3Only, yarnWorkspace, yarnWorkspaces };
361
+ export { type BuildParams, CROSS_PLATFORM_NEWLINE, type CleanPackageParams, type CleanParams, type CompileConfig, type CompileMode, type CompileParams, type CopyAssetsParams, type DepsPackageParams, type DepsParams, DuplicateDetector, type DynamicShareConfig, type EntryMode, type GenDocsPackageParams, type GenDocsParams, INIT_CWD, type LintPackageParams, type LintParams, type LiveShareConfig, type PackageCompileTscConfig, type PackageCompileTsupConfig, type PackageCopyAssetsParams, type PackageJsonEx, type PackagePublintParams, type PathConfig, type PublintPackageParams, type PublintParams, type ReadFileSyncOptions, type RebuildParams, type RecompilePackageParams, type RecompileParams, type ScriptStep, WINDOWS_NEWLINE_REGEX, type Workspace, type XyConfig, type XyConfigBase, type XyTscConfig, type XyTsupConfig, build, checkResult, clean, cleanAll, cleanDocs, cleanPackage, compile, compileAll, compilePackage, copyAssets, createBuildConfig, cycle, dead, defaultBuildConfig, defaultReadFileSyncOptions, deleteGlob, deploy, deployMajor, deployMinor, deployNext, deps, depsAll, depsPackage, detectDuplicateDependencies, dupdeps, empty, fix, genDocs, genDocsAll, genDocsPackage, generateIgnoreFiles, gitignoreGen, gitlint, gitlintFix, isYarnVersionOrGreater, license, lint, lintAll, lintClean, lintPackage, lintProfile, loadConfig, loadPackageConfig, multiLineToJSONArray, notEmpty, npmignoreGen, packageClean, packageCleanOutputs, packageCleanTypescript, packageCompile, packageCompileTsc, packageCompileTsup, packageCopyAssets, packageDeps, packageGenDocs, packagePublint, packageRecompile, parsedPackageJSON, processEx, publint, publintAll, publintPackage, readLines, readNonEmptyLines, rebuild, recompile, recompileAll, recompilePackage, reinstall, relint, retest, runStepAsync, runSteps, runStepsAsync, runXy, runXyWithWarning, safeExit, safeExitAsync, sonar, statics, test, tryReadFileSync, union, up, updateYarnPlugins, updateYarnVersion, updo, withErrnoException, withError, writeLines, xy, xyBuildCommands, xyCommonCommands, xyDeployCommands, xyInstallCommands, xyLintCommands, xyParseOptions, yarn3Only, yarnWorkspace, yarnWorkspaces };
package/dist/index.mjs CHANGED
@@ -81,6 +81,19 @@ var createBuildConfig = /* @__PURE__ */ __name((location, module, target, outDir
81
81
  };
82
82
  }, "createBuildConfig");
83
83
 
84
+ // src/lib/deleteGlob.ts
85
+ import fs from "node:fs";
86
+ import { glob } from "glob";
87
+ var deleteGlob = /* @__PURE__ */ __name((globPath) => {
88
+ const files = glob.sync(globPath);
89
+ for (const file of files) {
90
+ fs.rmSync(file, {
91
+ recursive: true,
92
+ force: true
93
+ });
94
+ }
95
+ }, "deleteGlob");
96
+
84
97
  // src/lib/dependencies/detectDuplicateDependencies.ts
85
98
  import { execSync } from "node:child_process";
86
99
 
@@ -144,7 +157,6 @@ var safeExitAsync = /* @__PURE__ */ __name(async (func, exitOnFail = true) => {
144
157
  // src/lib/dependencies/DuplicateDetector.ts
145
158
  import { EOL } from "node:os";
146
159
  import chalk3 from "chalk";
147
- import uniq from "lodash/uniq.js";
148
160
 
149
161
  // src/lib/jsonFormatters.ts
150
162
  var multiLineToJSONArray = /* @__PURE__ */ __name((output) => {
@@ -215,7 +227,9 @@ var DuplicateDetector = class {
215
227
  acc.duplicateVersions.push(acc.currentVersion);
216
228
  }
217
229
  acc.duplicateVersions.push(version);
218
- acc.duplicateVersions = uniq(acc.duplicateVersions);
230
+ acc.duplicateVersions = [
231
+ ...new Set(acc.duplicateVersions)
232
+ ];
219
233
  }
220
234
  return acc;
221
235
  }
@@ -385,11 +399,13 @@ var generateIgnoreFiles = /* @__PURE__ */ __name((filename3, pkg) => {
385
399
  // src/lib/loadConfig.ts
386
400
  import chalk5 from "chalk";
387
401
  import { cosmiconfig } from "cosmiconfig";
388
- import merge from "lodash/merge.js";
389
402
  var config;
390
403
  var loadConfig = /* @__PURE__ */ __name(async (params) => {
391
404
  if (config) {
392
- return merge({}, config, params);
405
+ return {
406
+ ...config,
407
+ ...params
408
+ };
393
409
  }
394
410
  const cosmicConfigResult = await cosmiconfig("xy", {
395
411
  cache: true
@@ -399,7 +415,10 @@ var loadConfig = /* @__PURE__ */ __name(async (params) => {
399
415
  if (configFilePath) {
400
416
  console.log(chalk5.gray(`Loading config from ${configFilePath}`));
401
417
  }
402
- return merge({}, config, params);
418
+ return {
419
+ ...config,
420
+ ...params
421
+ };
403
422
  }, "loadConfig");
404
423
 
405
424
  // src/lib/parsedPackageJSON.ts
@@ -621,13 +640,10 @@ var cleanAll = /* @__PURE__ */ __name(({ verbose }) => {
621
640
  // src/actions/clean-docs.ts
622
641
  import path from "node:path";
623
642
  import chalk10 from "chalk";
624
- import { rimrafSync } from "rimraf";
625
643
  var cleanDocs = /* @__PURE__ */ __name(() => {
626
644
  const pkgName = process.env.npm_package_name;
627
645
  console.log(chalk10.green(`Cleaning Docs [${pkgName}]`));
628
- for (const { location } of yarnWorkspaces()) rimrafSync(path.join(location, "docs"), {
629
- glob: true
630
- });
646
+ for (const { location } of yarnWorkspaces()) deleteGlob(path.join(location, "docs"));
631
647
  return 0;
632
648
  }, "cleanDocs");
633
649
 
@@ -774,14 +790,10 @@ var copyAssets = /* @__PURE__ */ __name(async ({ target, pkg }) => {
774
790
  // src/actions/cycle.ts
775
791
  import { cwd } from "node:process";
776
792
  import { ESLint } from "eslint";
777
- import importPlugin from "eslint-plugin-import";
778
793
  var cycle = /* @__PURE__ */ __name(async () => {
779
794
  const eslint = new ESLint({
780
795
  fix: false,
781
796
  overrideConfig: {
782
- plugins: {
783
- import: importPlugin
784
- },
785
797
  rules: {
786
798
  "import/no-cycle": [
787
799
  "error",
@@ -792,8 +804,6 @@ var cycle = /* @__PURE__ */ __name(async () => {
792
804
  }
793
805
  }
794
806
  });
795
- const configFile = await eslint.findConfigFile();
796
- console.log("Config file:", configFile);
797
807
  const results = await eslint.lintFiles([
798
808
  "src/**/*.ts*",
799
809
  "packages/**/src/**/*.ts*"
@@ -804,7 +814,6 @@ var cycle = /* @__PURE__ */ __name(async () => {
804
814
  rulesMeta: {}
805
815
  });
806
816
  console.log(resultText);
807
- console.log("Lint Errors:", results.length);
808
817
  return results.length;
809
818
  }, "cycle");
810
819
 
@@ -1323,7 +1332,6 @@ var npmignoreGen = /* @__PURE__ */ __name((pkg) => generateIgnoreFiles(filename2
1323
1332
  // src/actions/package/clean-outputs.ts
1324
1333
  import path3 from "node:path";
1325
1334
  import chalk19 from "chalk";
1326
- import { rimraf } from "rimraf";
1327
1335
  var packageCleanOutputs = /* @__PURE__ */ __name(async () => {
1328
1336
  const pkg = process.env.INIT_CWD ?? ".";
1329
1337
  const pkgName = process.env.npm_package_name;
@@ -1333,14 +1341,13 @@ var packageCleanOutputs = /* @__PURE__ */ __name(async () => {
1333
1341
  path3.join(pkg, "docs")
1334
1342
  ];
1335
1343
  console.log(chalk19.green(`Cleaning Outputs [${pkgName}]`));
1336
- await Promise.all(folders.map((folder) => rimraf(folder)));
1344
+ await Promise.all(folders.map((folder) => deleteGlob(folder)));
1337
1345
  return 0;
1338
1346
  }, "packageCleanOutputs");
1339
1347
 
1340
1348
  // src/actions/package/clean-typescript.ts
1341
1349
  import path4 from "node:path";
1342
1350
  import chalk20 from "chalk";
1343
- import { rimraf as rimraf2 } from "rimraf";
1344
1351
  var packageCleanTypescript = /* @__PURE__ */ __name(async () => {
1345
1352
  const pkg = process.env.INIT_CWD ?? ".";
1346
1353
  const pkgName = process.env.npm_package_name;
@@ -1350,7 +1357,7 @@ var packageCleanTypescript = /* @__PURE__ */ __name(async () => {
1350
1357
  path4.join(pkg, ".tsconfig.*"),
1351
1358
  path4.join(pkg, ".eslintcache")
1352
1359
  ];
1353
- await Promise.all(files.map((file) => rimraf2(file)));
1360
+ await Promise.all(files.map((file) => deleteGlob(file)));
1354
1361
  return 0;
1355
1362
  }, "packageCleanTypescript");
1356
1363
 
@@ -1366,11 +1373,11 @@ var packageClean = /* @__PURE__ */ __name(async () => {
1366
1373
  import chalk23 from "chalk";
1367
1374
 
1368
1375
  // src/actions/package/publint.ts
1369
- import { promises as fs } from "node:fs";
1376
+ import { promises as fs2 } from "node:fs";
1370
1377
  import chalk21 from "chalk";
1371
1378
  var packagePublint = /* @__PURE__ */ __name(async (params) => {
1372
1379
  const pkgDir = process.env.INIT_CWD;
1373
- const pkg = JSON.parse(await fs.readFile(`${pkgDir}/package.json`, "utf8"));
1380
+ const pkg = JSON.parse(await fs2.readFile(`${pkgDir}/package.json`, "utf8"));
1374
1381
  console.log(chalk21.green(`Publint: ${pkg.name}`));
1375
1382
  console.log(chalk21.gray(pkgDir));
1376
1383
  const { publint: publint2 } = await import("publint");
@@ -1414,7 +1421,6 @@ import { DiagnosticCategory, formatDiagnosticsWithColorAndContext, getLineAndCha
1414
1421
 
1415
1422
  // src/actions/package/compile/getCompilerOptions.ts
1416
1423
  import { createRequire } from "node:module";
1417
- import merge2 from "lodash/merge.js";
1418
1424
  import { findConfigFile, readConfigFile, sys } from "typescript";
1419
1425
  var getNested = /* @__PURE__ */ __name((config2) => {
1420
1426
  if (config2.extends) {
@@ -1434,7 +1440,10 @@ var getCompilerOptionsJSONFollowExtends = /* @__PURE__ */ __name((filename3) =>
1434
1440
  var getCompilerOptions = /* @__PURE__ */ __name((options, tsconfig = "tsconfig.json") => {
1435
1441
  const configFileName = findConfigFile("./", sys.fileExists, tsconfig);
1436
1442
  const configFileCompilerOptions = configFileName ? getCompilerOptionsJSONFollowExtends(configFileName) : void 0;
1437
- return merge2({}, configFileCompilerOptions, options);
1443
+ return {
1444
+ ...configFileCompilerOptions,
1445
+ ...options
1446
+ };
1438
1447
  }, "getCompilerOptions");
1439
1448
 
1440
1449
  // src/actions/package/compile/packageCompileTsc.ts
@@ -1493,9 +1502,9 @@ var packageCompileTsc = /* @__PURE__ */ __name(async (noEmit, config2, compilerO
1493
1502
  import { build as build2, defineConfig } from "tsup";
1494
1503
 
1495
1504
  // src/actions/package/compile/inputs.ts
1496
- import { glob } from "glob";
1505
+ import { glob as glob2 } from "glob";
1497
1506
  var getAllInputs2 = /* @__PURE__ */ __name((folder) => {
1498
- return glob.sync(`${folder}/**/*.*`, {
1507
+ return glob2.sync(`${folder}/**/*.*`, {
1499
1508
  ignore: [
1500
1509
  "**/*.spec.*",
1501
1510
  "**/*.stories.*",
@@ -2726,6 +2735,7 @@ export {
2726
2735
  dead,
2727
2736
  defaultBuildConfig,
2728
2737
  defaultReadFileSyncOptions,
2738
+ deleteGlob,
2729
2739
  deploy,
2730
2740
  deployMajor,
2731
2741
  deployMinor,