@xylabs/ts-scripts-yarn3 6.5.6 → 6.5.8

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 (148) hide show
  1. package/dist/actions/build.mjs +2 -2
  2. package/dist/actions/clean-docs.mjs +3 -3
  3. package/dist/actions/clean-eslint.mjs +2 -2
  4. package/dist/actions/clean-jest.mjs +2 -2
  5. package/dist/actions/clean.mjs +2 -2
  6. package/dist/actions/compile-types.mjs +2 -2
  7. package/dist/actions/compile.mjs +2 -2
  8. package/dist/actions/copy-assets.mjs +2 -2
  9. package/dist/actions/cycle.mjs +2 -2
  10. package/dist/actions/dead.mjs +2 -2
  11. package/dist/actions/deplint/checkPackage/checkPackage.mjs +85 -103
  12. package/dist/actions/deplint/checkPackage/checkPackage.mjs.map +1 -1
  13. package/dist/actions/deplint/checkPackage/getUnlistedDependencies.mjs +8 -17
  14. package/dist/actions/deplint/checkPackage/getUnlistedDependencies.mjs.map +1 -1
  15. package/dist/actions/deplint/checkPackage/getUnlistedDevDependencies.mjs +14 -5
  16. package/dist/actions/deplint/checkPackage/getUnlistedDevDependencies.mjs.map +1 -1
  17. package/dist/actions/deplint/checkPackage/getUnusedDependencies.mjs +13 -7
  18. package/dist/actions/deplint/checkPackage/getUnusedDependencies.mjs.map +1 -1
  19. package/dist/actions/deplint/checkPackage/getUnusedPeerDependencies.mjs +12 -6
  20. package/dist/actions/deplint/checkPackage/getUnusedPeerDependencies.mjs.map +1 -1
  21. package/dist/actions/deplint/checkPackage/index.mjs +85 -103
  22. package/dist/actions/deplint/checkPackage/index.mjs.map +1 -1
  23. package/dist/actions/deplint/deplint.mjs +86 -104
  24. package/dist/actions/deplint/deplint.mjs.map +1 -1
  25. package/dist/actions/deplint/findFiles.mjs +4 -14
  26. package/dist/actions/deplint/findFiles.mjs.map +1 -1
  27. package/dist/actions/deplint/getBasePackageName.mjs +5 -4
  28. package/dist/actions/deplint/getBasePackageName.mjs.map +1 -1
  29. package/dist/actions/deplint/getDependenciesFromPackageJson.mjs +2 -2
  30. package/dist/actions/deplint/getExternalImportsFromFiles.mjs +29 -40
  31. package/dist/actions/deplint/getExternalImportsFromFiles.mjs.map +1 -1
  32. package/dist/actions/deplint/getImportsFromFile.mjs +14 -11
  33. package/dist/actions/deplint/getImportsFromFile.mjs.map +1 -1
  34. package/dist/actions/deplint/index.mjs +86 -104
  35. package/dist/actions/deplint/index.mjs.map +1 -1
  36. package/dist/actions/deploy-major.mjs +4 -4
  37. package/dist/actions/deploy-minor.mjs +4 -4
  38. package/dist/actions/deploy-next.mjs +4 -4
  39. package/dist/actions/deploy.mjs +4 -4
  40. package/dist/actions/dupdeps.mjs +3 -3
  41. package/dist/actions/fix.mjs +2 -2
  42. package/dist/actions/gen-docs.mjs +2 -2
  43. package/dist/actions/gitignore-gen.mjs +2 -2
  44. package/dist/actions/gitlint-fix.mjs +1 -1
  45. package/dist/actions/index.mjs +123 -141
  46. package/dist/actions/index.mjs.map +1 -1
  47. package/dist/actions/knip.mjs +2 -2
  48. package/dist/actions/license.mjs +1 -1
  49. package/dist/actions/lint.mjs +2 -2
  50. package/dist/actions/npmignore-gen.mjs +2 -2
  51. package/dist/actions/package/clean-outputs.mjs +2 -2
  52. package/dist/actions/package/clean-typescript.mjs +2 -2
  53. package/dist/actions/package/clean.mjs +3 -3
  54. package/dist/actions/package/compile/compile.mjs +10 -10
  55. package/dist/actions/package/compile/compile.mjs.map +1 -1
  56. package/dist/actions/package/compile/compileTypes.mjs +2 -2
  57. package/dist/actions/package/compile/copyTypeFiles.mjs +1 -1
  58. package/dist/actions/package/compile/getCompilerOptions.mjs +1 -1
  59. package/dist/actions/package/compile/index.mjs +10 -10
  60. package/dist/actions/package/compile/index.mjs.map +1 -1
  61. package/dist/actions/package/compile/packageCompileTsc.mjs +2 -2
  62. package/dist/actions/package/compile/packageCompileTscTypes.mjs +2 -2
  63. package/dist/actions/package/compile/packageCompileTsup.mjs +9 -9
  64. package/dist/actions/package/compile/packageCompileTsup.mjs.map +1 -1
  65. package/dist/actions/package/copy-assets.mjs +1 -1
  66. package/dist/actions/package/gen-docs.mjs +2 -2
  67. package/dist/actions/package/index.mjs +20 -20
  68. package/dist/actions/package/index.mjs.map +1 -1
  69. package/dist/actions/package/lint.mjs +4 -4
  70. package/dist/actions/package/publint.mjs +1 -1
  71. package/dist/actions/package/recompile.mjs +13 -13
  72. package/dist/actions/package/recompile.mjs.map +1 -1
  73. package/dist/actions/publint.mjs +4 -4
  74. package/dist/actions/rebuild.mjs +2 -2
  75. package/dist/actions/recompile.mjs +2 -2
  76. package/dist/actions/recompile.mjs.map +1 -1
  77. package/dist/actions/reinstall.mjs +4 -4
  78. package/dist/actions/relint.mjs +2 -2
  79. package/dist/actions/retest.mjs +2 -2
  80. package/dist/actions/sonar.mjs +2 -2
  81. package/dist/actions/statics.mjs +3 -3
  82. package/dist/actions/test.mjs +2 -2
  83. package/dist/actions/up.mjs +2 -2
  84. package/dist/actions/updo.mjs +2 -2
  85. package/dist/actions/upplug.mjs +2 -2
  86. package/dist/actions/upyarn.mjs +2 -2
  87. package/dist/actions/yarn3only.mjs +1 -1
  88. package/dist/bin/package/build-only.mjs +10 -10
  89. package/dist/bin/package/build-only.mjs.map +1 -1
  90. package/dist/bin/package/build.mjs +10 -10
  91. package/dist/bin/package/build.mjs.map +1 -1
  92. package/dist/bin/package/clean-outputs.mjs +2 -2
  93. package/dist/bin/package/clean-typescript.mjs +2 -2
  94. package/dist/bin/package/clean.mjs +3 -3
  95. package/dist/bin/package/compile-only.mjs +10 -10
  96. package/dist/bin/package/compile-only.mjs.map +1 -1
  97. package/dist/bin/package/compile-tsup.mjs +9 -9
  98. package/dist/bin/package/compile-tsup.mjs.map +1 -1
  99. package/dist/bin/package/compile-types.mjs +2 -2
  100. package/dist/bin/package/compile.mjs +10 -10
  101. package/dist/bin/package/compile.mjs.map +1 -1
  102. package/dist/bin/package/copy-assets-cjs.mjs +1 -1
  103. package/dist/bin/package/copy-assets-esm.mjs +1 -1
  104. package/dist/bin/package/fix.mjs +4 -4
  105. package/dist/bin/package/gen-docs.mjs +2 -2
  106. package/dist/bin/package/lint.mjs +4 -4
  107. package/dist/bin/package/publint.mjs +1 -1
  108. package/dist/bin/package/recompile.mjs +13 -13
  109. package/dist/bin/package/recompile.mjs.map +1 -1
  110. package/dist/bin/package/relint.mjs +4 -4
  111. package/dist/bin/xy.mjs +104 -122
  112. package/dist/bin/xy.mjs.map +1 -1
  113. package/dist/index.mjs +126 -144
  114. package/dist/index.mjs.map +1 -1
  115. package/dist/lib/createBuildConfig.mjs +1 -1
  116. package/dist/lib/deleteGlob.mjs +1 -1
  117. package/dist/lib/dependencies/DuplicateDetector.mjs +1 -1
  118. package/dist/lib/dependencies/detectDuplicateDependencies.mjs +2 -2
  119. package/dist/lib/dependencies/index.mjs +2 -2
  120. package/dist/lib/file/fileLines.mjs +1 -1
  121. package/dist/lib/file/index.mjs +2 -2
  122. package/dist/lib/file/tryReadFileSync.mjs +1 -1
  123. package/dist/lib/generateIgnoreFiles.mjs +2 -2
  124. package/dist/lib/index.mjs +13 -13
  125. package/dist/lib/parsedPackageJSON.mjs +1 -1
  126. package/dist/lib/runSteps.mjs +2 -2
  127. package/dist/lib/runStepsAsync.mjs +2 -2
  128. package/dist/lib/runXy.mjs +2 -2
  129. package/dist/lib/yarn/index.mjs +2 -2
  130. package/dist/lib/yarn/isYarnVersionOrGreater.mjs +1 -1
  131. package/dist/lib/yarn/workspace/index.mjs +1 -1
  132. package/dist/lib/yarn/workspace/yarnWorkspace.mjs +1 -1
  133. package/dist/lib/yarn/workspace/yarnWorkspaces.mjs +1 -1
  134. package/dist/loadPackageConfig.mjs +1 -1
  135. package/dist/xy/index.mjs +104 -122
  136. package/dist/xy/index.mjs.map +1 -1
  137. package/dist/xy/xy.mjs +104 -122
  138. package/dist/xy/xy.mjs.map +1 -1
  139. package/dist/xy/xyBuildCommands.mjs +6 -6
  140. package/dist/xy/xyBuildCommands.mjs.map +1 -1
  141. package/dist/xy/xyCommonCommands.mjs +8 -8
  142. package/dist/xy/xyDeployCommands.mjs +7 -7
  143. package/dist/xy/xyInstallCommands.mjs +9 -9
  144. package/dist/xy/xyLintCommands.mjs +90 -108
  145. package/dist/xy/xyLintCommands.mjs.map +1 -1
  146. package/package.json +10 -9
  147. package/dist/actions/deplint/checkPackage/getTypesInDependencies.mjs +0 -19
  148. package/dist/actions/deplint/checkPackage/getTypesInDependencies.mjs.map +0 -1
@@ -15,7 +15,7 @@ var checkResult = (name, result, level = "error", exitOnFail = false) => {
15
15
  };
16
16
 
17
17
  // src/lib/deleteGlob.ts
18
- import fs from "node:fs";
18
+ import fs from "fs";
19
19
  import { glob } from "glob";
20
20
  var deleteGlob = (globPath) => {
21
21
  const files = glob.sync(globPath);
@@ -25,7 +25,7 @@ var deleteGlob = (globPath) => {
25
25
  };
26
26
 
27
27
  // src/lib/dependencies/detectDuplicateDependencies.ts
28
- import { execSync } from "node:child_process";
28
+ import { execSync } from "child_process";
29
29
 
30
30
  // src/lib/processEx.ts
31
31
  import chalk2 from "chalk";
@@ -85,7 +85,7 @@ var safeExitAsync = async (func, exitOnFail = true) => {
85
85
  };
86
86
 
87
87
  // src/lib/dependencies/DuplicateDetector.ts
88
- import { EOL } from "node:os";
88
+ import { EOL } from "os";
89
89
  import chalk3 from "chalk";
90
90
 
91
91
  // src/lib/jsonFormatters.ts
@@ -205,7 +205,7 @@ import {
205
205
  existsSync,
206
206
  readFileSync,
207
207
  writeFileSync
208
- } from "node:fs";
208
+ } from "fs";
209
209
 
210
210
  // src/lib/string/empty.ts
211
211
  var empty = (value) => value?.trim().length === 0;
@@ -230,7 +230,7 @@ var writeLines = (uri, lines, options = defaultReadFileSyncOptions) => {
230
230
  import chalk4 from "chalk";
231
231
 
232
232
  // src/lib/yarn/isYarnVersionOrGreater.ts
233
- import { spawnSync } from "node:child_process";
233
+ import { spawnSync } from "child_process";
234
234
  var isYarnVersionOrGreater = (major, minor, patch) => {
235
235
  const result = spawnSync("yarn", ["-v"], { encoding: "utf8", shell: true });
236
236
  const version = result.stdout.toString().replaceAll("\n", "");
@@ -245,7 +245,7 @@ var isYarnVersionOrGreater = (major, minor, patch) => {
245
245
  };
246
246
 
247
247
  // src/lib/yarn/workspace/yarnWorkspaces.ts
248
- import { spawnSync as spawnSync2 } from "node:child_process";
248
+ import { spawnSync as spawnSync2 } from "child_process";
249
249
  var yarnWorkspaces = () => {
250
250
  const result = spawnSync2("yarn", ["workspaces", "list", "--json", "--recursive"], { encoding: "utf8", shell: true });
251
251
  if (result.error) {
@@ -312,7 +312,7 @@ var loadConfig = async (params) => {
312
312
  };
313
313
 
314
314
  // src/lib/parsedPackageJSON.ts
315
- import { readFileSync as readFileSync2 } from "node:fs";
315
+ import { readFileSync as readFileSync2 } from "fs";
316
316
  var parsedPackageJSON = (path10) => {
317
317
  const pathToPackageJSON = path10 ?? process.env.npm_package_json ?? "";
318
318
  const packageJSON = readFileSync2(pathToPackageJSON).toString();
@@ -320,8 +320,8 @@ var parsedPackageJSON = (path10) => {
320
320
  };
321
321
 
322
322
  // src/lib/runSteps.ts
323
- import { spawnSync as spawnSync3 } from "node:child_process";
324
- import { existsSync as existsSync2 } from "node:fs";
323
+ import { spawnSync as spawnSync3 } from "child_process";
324
+ import { existsSync as existsSync2 } from "fs";
325
325
  import chalk6 from "chalk";
326
326
  var runSteps = (name, steps, exitOnFail = true, messages) => {
327
327
  return safeExit(() => {
@@ -351,8 +351,8 @@ var runSteps = (name, steps, exitOnFail = true, messages) => {
351
351
  };
352
352
 
353
353
  // src/lib/runStepsAsync.ts
354
- import { spawn } from "node:child_process";
355
- import { existsSync as existsSync3 } from "node:fs";
354
+ import { spawn } from "child_process";
355
+ import { existsSync as existsSync3 } from "fs";
356
356
  import chalk7 from "chalk";
357
357
  var runStepAsync = (name, step, exitOnFail = true, message) => {
358
358
  return new Promise((resolve) => {
@@ -438,7 +438,7 @@ var cleanAll = ({ verbose }) => {
438
438
  };
439
439
 
440
440
  // src/actions/clean-docs.ts
441
- import path from "node:path";
441
+ import path from "path";
442
442
  import chalk9 from "chalk";
443
443
  var cleanDocs = () => {
444
444
  const pkgName = process.env.npm_package_name;
@@ -564,7 +564,7 @@ var compileTypesAll = ({
564
564
  };
565
565
 
566
566
  // src/actions/copy-assets.ts
567
- import path2 from "node:path/posix";
567
+ import path2 from "path/posix";
568
568
  import chalk12 from "chalk";
569
569
  import cpy from "cpy";
570
570
  var copyPackageTargetAssets = async (target, name, location) => {
@@ -683,25 +683,15 @@ function findFilesByGlob(cwd4, pattern) {
683
683
  // src/actions/deplint/findFiles.ts
684
684
  function findFiles(path10) {
685
685
  const allSourceInclude = ["./src/**/*.{ts,tsx}"];
686
- const allDistInclude = ["./dist/**/*.d.ts"];
687
- const prodExcludeEndswith = [".spec.ts", ".stories.tsx"];
688
- const prodExcludeIncludes = ["/spec/", "/stories/", "/scripts/"];
689
- const allSourceFiles = allSourceInclude.flatMap((pattern) => findFilesByGlob(path10, pattern));
690
- const allDistFiles = allDistInclude.flatMap((pattern) => findFilesByGlob(path10, pattern));
691
- const prodSourceFiles = allSourceFiles.filter((file) => !prodExcludeEndswith.some((ext) => file.endsWith(ext)) && !prodExcludeIncludes.some((excl) => file.includes(excl)));
692
- const prodDistFiles = allDistFiles.filter((file) => !prodExcludeEndswith.some((ext) => file.endsWith(ext)) && !prodExcludeIncludes.some((excl) => file.includes(excl)));
693
- const devSourceFiles = allSourceFiles.filter((file) => !prodSourceFiles.includes(file));
694
- return {
695
- allSourceFiles,
696
- prodSourceFiles,
697
- devSourceFiles,
698
- prodDistFiles
699
- };
686
+ const allDistInclude = ["./dist/**/*.d.ts", "./dist/**/*.{mjs,js,cjs}"];
687
+ const srcFiles = allSourceInclude.flatMap((pattern) => findFilesByGlob(path10, pattern));
688
+ const distFiles = allDistInclude.flatMap((pattern) => findFilesByGlob(path10, pattern));
689
+ return { srcFiles, distFiles };
700
690
  }
701
691
 
702
692
  // src/actions/deplint/getDependenciesFromPackageJson.ts
703
- import fs2 from "node:fs";
704
- import path3 from "node:path";
693
+ import fs2 from "fs";
694
+ import path3 from "path";
705
695
  function getDependenciesFromPackageJson(packageJsonPath) {
706
696
  const packageJsonFullPath = path3.resolve(packageJsonPath);
707
697
  const rawContent = fs2.readFileSync(packageJsonFullPath, "utf8");
@@ -717,27 +707,30 @@ function getDependenciesFromPackageJson(packageJsonPath) {
717
707
  }
718
708
 
719
709
  // src/actions/deplint/getImportsFromFile.ts
720
- import fs3 from "node:fs";
721
- import path4 from "node:path";
710
+ import fs3 from "fs";
711
+ import path4 from "path";
722
712
  import ts from "typescript";
723
713
 
724
714
  // src/actions/deplint/getBasePackageName.ts
725
715
  function getBasePackageName(importName) {
726
- if (importName.startsWith("@")) {
727
- const parts = importName.split("/");
728
- return parts.length >= 2 ? `${parts[0]}/${parts[1]}` : importName;
716
+ const importNameScrubbed = importName.replaceAll('"', "").trim();
717
+ if (importNameScrubbed.startsWith("@")) {
718
+ const parts = importNameScrubbed.split("/");
719
+ return parts.length >= 2 ? `${parts[0]}/${parts[1]}` : importNameScrubbed;
729
720
  }
730
- return importName.split("/")[0];
721
+ return importNameScrubbed.split("/")[0];
731
722
  }
732
723
 
733
724
  // src/actions/deplint/getImportsFromFile.ts
734
725
  function getImportsFromFile(filePath, importPaths, typeImportPaths) {
735
726
  const sourceCode = fs3.readFileSync(filePath, "utf8");
727
+ const isMjsFile = filePath.endsWith(".mjs");
736
728
  const sourceFile = ts.createSourceFile(
737
729
  path4.basename(filePath),
738
730
  sourceCode,
739
731
  ts.ScriptTarget.Latest,
740
- true
732
+ true,
733
+ isMjsFile ? ts.ScriptKind.JS : void 0
741
734
  );
742
735
  const imports = [];
743
736
  const typeImports = [];
@@ -746,8 +739,8 @@ function getImportsFromFile(filePath, importPaths, typeImportPaths) {
746
739
  if (ts.isImportDeclaration(node) || ts.isExportDeclaration(node)) {
747
740
  const moduleSpecifier = node.moduleSpecifier?.getFullText();
748
741
  const isTypeImport = ts.isImportDeclaration(node) ? node.importClause?.isTypeOnly ?? false : false;
749
- if (moduleSpecifier) {
750
- const trimmed = moduleSpecifier.split("'").at(1) ?? moduleSpecifier;
742
+ if (typeof moduleSpecifier === "string") {
743
+ const trimmed = moduleSpecifier.replaceAll("'", "").replaceAll('"', "").trim();
751
744
  if (isTypeImport || isDeclarationFile) {
752
745
  typeImports.push(trimmed);
753
746
  } else {
@@ -768,11 +761,11 @@ function getImportsFromFile(filePath, importPaths, typeImportPaths) {
768
761
  const cleanedImports = imports.filter((imp) => !importsStartsWithExcludes.some((exc) => imp.startsWith(exc))).map(getBasePackageName);
769
762
  const cleanedTypeImports = typeImports.filter((imp) => !importsStartsWithExcludes.some((exc) => imp.startsWith(exc))).map(getBasePackageName);
770
763
  for (const imp of cleanedImports) {
771
- importPaths[imp] = importPaths[imp] || [];
764
+ importPaths[imp] = importPaths[imp] ?? [];
772
765
  importPaths[imp].push(filePath);
773
766
  }
774
767
  for (const imp of cleanedTypeImports) {
775
- typeImportPaths[imp] = typeImportPaths[imp] || [];
768
+ typeImportPaths[imp] = typeImportPaths[imp] ?? [];
776
769
  typeImportPaths[imp].push(filePath);
777
770
  }
778
771
  return [cleanedImports, cleanedTypeImports];
@@ -783,117 +776,115 @@ var internalImportPrefixes = [".", "#", "node:"];
783
776
  var removeInternalImports = (imports) => {
784
777
  return imports.filter((imp) => !internalImportPrefixes.some((prefix) => imp.startsWith(prefix)));
785
778
  };
786
- function getExternalImportsFromFiles({
787
- prodSourceFiles,
788
- devSourceFiles,
789
- prodDistFiles
790
- }) {
791
- const prodImportPaths = {};
792
- const prodTypeImportPaths = {};
793
- const prodImportPairs = prodSourceFiles.map((path10) => getImportsFromFile(path10, prodImportPaths, prodTypeImportPaths));
794
- const prodDistImportPairs = prodDistFiles.map((path10) => getImportsFromFile(path10, prodImportPaths, prodTypeImportPaths));
795
- const prodImports = prodImportPairs.flatMap((pair) => pair[0]);
796
- const prodDistImports = prodDistImportPairs.flatMap((pair) => pair[1]);
797
- const devImportPaths = {};
798
- const devTypeImportPaths = {};
799
- const devImportPairs = devSourceFiles.map((path10) => getImportsFromFile(path10, devImportPaths, devTypeImportPaths));
800
- const devImports = devImportPairs.flatMap((pair) => pair[0]);
801
- const devTypeImports = devImportPairs.flatMap((pair) => pair[1]);
802
- const externalProdImports = removeInternalImports(prodImports);
803
- const externalProdTypeImports = removeInternalImports(prodDistImports);
804
- const externalDevImports = removeInternalImports(devImports);
779
+ function getExternalImportsFromFiles({ srcFiles, distFiles }) {
780
+ const srcImportPaths = {};
781
+ const distImportPaths = {};
782
+ for (const path10 of srcFiles) getImportsFromFile(path10, srcImportPaths, srcImportPaths).flat();
783
+ for (const path10 of distFiles) getImportsFromFile(path10, distImportPaths, distImportPaths).flat();
784
+ const srcImports = Object.keys(srcImportPaths);
785
+ const distImports = Object.keys(distImportPaths);
786
+ const externalSrcImports = removeInternalImports(srcImports);
787
+ const externalDistImports = removeInternalImports(distImports);
805
788
  return {
806
- prodImports,
807
- devImports,
808
- prodImportPaths,
809
- prodTypeImportPaths,
810
- devImportPaths,
811
- externalProdImports,
812
- externalDevImports,
813
- prodDistImports,
814
- devTypeImports,
815
- externalProdTypeImports
789
+ srcImports,
790
+ srcImportPaths,
791
+ externalSrcImports,
792
+ distImports,
793
+ distImportPaths,
794
+ externalDistImports
816
795
  };
817
796
  }
818
797
 
819
798
  // src/actions/deplint/checkPackage/getUnlistedDependencies.ts
820
799
  import chalk13 from "chalk";
821
- function getUnlistedDependencies({ name }, { dependencies, peerDependencies }, {
822
- externalProdTypeImports,
823
- prodTypeImportPaths,
824
- externalProdImports,
825
- prodImportPaths
826
- }) {
800
+ function getUnlistedDependencies({ name, location }, { dependencies, peerDependencies }, { externalDistImports, distImportPaths }) {
827
801
  let unlistedDependencies = 0;
828
- for (const imp of externalProdTypeImports) {
829
- if (!dependencies.includes(imp) && !peerDependencies.includes(imp) && !dependencies.includes(`@types/${imp}`) && !peerDependencies.includes(`@types/${imp}`)) {
830
- unlistedDependencies++;
831
- console.log(`[${chalk13.blue(name)}] Missing dependency in package.json: ${chalk13.red(imp)}`);
832
- console.log(` ${prodTypeImportPaths[imp].join("\n")}`);
833
- console.log("");
834
- }
835
- }
836
- for (const imp of externalProdImports) {
802
+ for (const imp of externalDistImports) {
837
803
  if (!dependencies.includes(imp) && !peerDependencies.includes(imp)) {
838
804
  unlistedDependencies++;
839
805
  console.log(`[${chalk13.blue(name)}] Missing dependency in package.json: ${chalk13.red(imp)}`);
840
- console.log(` ${prodImportPaths[imp].join("\n")}`);
841
- console.log("");
806
+ console.log(` ${distImportPaths[imp].join("\n ")}`);
842
807
  }
843
808
  }
809
+ if (unlistedDependencies > 0) {
810
+ const packageLocation = `${location}/package.json`;
811
+ console.log(` ${chalk13.yellow(packageLocation)}
812
+ `);
813
+ }
844
814
  return unlistedDependencies;
845
815
  }
846
816
 
847
817
  // src/actions/deplint/checkPackage/getUnlistedDevDependencies.ts
848
818
  import chalk14 from "chalk";
849
- function getUnlistedDevDependencies({ name }, {
819
+ function getUnlistedDevDependencies({ name, location }, {
850
820
  devDependencies,
851
821
  dependencies,
852
822
  peerDependencies
853
- }, { devImportPaths, externalDevImports }) {
823
+ }, {
824
+ srcImportPaths,
825
+ externalSrcImports,
826
+ distImports
827
+ }) {
854
828
  let unlistedDevDependencies = 0;
855
- for (const imp of externalDevImports) {
856
- if (!devDependencies.includes(imp) && !dependencies.includes(imp) && !peerDependencies.includes(imp)) {
829
+ for (const imp of externalSrcImports) {
830
+ if (!distImports.includes(imp) && !dependencies.includes(imp) && !peerDependencies.includes(imp) && !devDependencies.includes(imp)) {
857
831
  unlistedDevDependencies++;
858
832
  console.log(`[${chalk14.blue(name)}] Missing devDependency in package.json: ${chalk14.red(imp)}`);
859
- console.log(` Found in: ${devImportPaths[imp].join(", ")}`);
833
+ console.log(` ${srcImportPaths[imp].join("\n ")}`);
860
834
  }
861
835
  }
836
+ if (unlistedDevDependencies > 0) {
837
+ const packageLocation = `${location}/package.json`;
838
+ console.log(` ${chalk14.yellow(packageLocation)}
839
+ `);
840
+ }
862
841
  return unlistedDevDependencies;
863
842
  }
864
843
 
865
844
  // src/actions/deplint/checkPackage/getUnusedDependencies.ts
866
845
  import chalk15 from "chalk";
867
846
  function getUnusedDependencies({ name, location }, { dependencies }, {
868
- externalProdImports,
869
- externalProdTypeImports
847
+ externalDistImports,
848
+ externalSrcImports
870
849
  }) {
871
850
  let unusedDependencies = 0;
872
851
  for (const dep of dependencies) {
873
- if (!externalProdImports.includes(dep) && !externalProdTypeImports.includes(dep)) {
852
+ if (!externalDistImports.includes(dep)) {
874
853
  unusedDependencies++;
875
- console.log(`[${chalk15.blue(name)}] Unused dependency in package.json: ${chalk15.red(dep)}`);
876
- console.log(` ${location}/package.json
877
- `);
878
- console.log("");
854
+ if (externalSrcImports.includes(dep)) {
855
+ console.log(`[${chalk15.blue(name)}] dependency should be devDependency in package.json: ${chalk15.red(dep)}`);
856
+ } else {
857
+ console.log(`[${chalk15.blue(name)}] Unused dependency in package.json: ${chalk15.red(dep)}`);
858
+ }
879
859
  }
880
860
  }
861
+ if (unusedDependencies > 0) {
862
+ const packageLocation = `${location}/package.json`;
863
+ console.log(` ${chalk15.yellow(packageLocation)}
864
+ `);
865
+ }
881
866
  return unusedDependencies;
882
867
  }
883
868
 
884
869
  // src/actions/deplint/checkPackage/getUnusedPeerDependencies.ts
885
870
  import chalk16 from "chalk";
886
- function getUnusedPeerDependencies({ name, location }, { peerDependencies }, { externalProdImports, externalProdTypeImports }) {
871
+ function getUnusedPeerDependencies({ name, location }, { peerDependencies, dependencies }, { externalDistImports }) {
887
872
  let unusedDependencies = 0;
888
873
  for (const dep of peerDependencies) {
889
- if (!externalProdImports.includes(dep) && !externalProdTypeImports.includes(dep)) {
874
+ if (!externalDistImports.includes(dep)) {
890
875
  unusedDependencies++;
891
- console.log(`[${chalk16.blue(name)}] Unused peerDependency in package.json: ${chalk16.red(dep)}`);
892
- console.log(` ${location}/package.json
893
- `);
894
- console.log("");
876
+ if (dependencies.includes(dep)) {
877
+ console.log(`[${chalk16.blue(name)}] Unused peerDependency [already a dependency] in package.json: ${chalk16.red(dep)}`);
878
+ } else {
879
+ console.log(`[${chalk16.blue(name)}] Unused peerDependency in package.json: ${chalk16.red(dep)}`);
880
+ }
895
881
  }
896
882
  }
883
+ if (unusedDependencies > 0) {
884
+ const packageLocation = `${location}/package.json`;
885
+ console.log(` ${chalk16.yellow(packageLocation)}
886
+ `);
887
+ }
897
888
  return unusedDependencies;
898
889
  }
899
890
 
@@ -905,26 +896,17 @@ function checkPackage({
905
896
  devDeps = false,
906
897
  peerDeps = false
907
898
  }) {
908
- const {
909
- prodSourceFiles,
910
- devSourceFiles,
911
- prodDistFiles
912
- } = findFiles(location);
899
+ const { srcFiles, distFiles } = findFiles(location);
913
900
  const checkDeps = deps || !(deps || devDeps || peerDeps);
914
901
  const checkDevDeps = devDeps || !(deps || devDeps || peerDeps);
915
902
  const checkPeerDeps = peerDeps;
916
- const sourceParams = getExternalImportsFromFiles({
917
- prodSourceFiles,
918
- devSourceFiles,
919
- prodDistFiles
920
- });
903
+ const sourceParams = getExternalImportsFromFiles({ srcFiles, distFiles });
921
904
  const packageParams = getDependenciesFromPackageJson(`${location}/package.json`);
922
905
  const unlistedDependencies = checkDeps ? getUnlistedDependencies({ name, location }, packageParams, sourceParams) : 0;
923
906
  const unusedDependencies = checkDeps ? getUnusedDependencies({ name, location }, packageParams, sourceParams) : 0;
924
- const typesInDependencies = 0;
925
907
  const unlistedDevDependencies = checkDevDeps ? getUnlistedDevDependencies({ name, location }, packageParams, sourceParams) : 0;
926
908
  const unusedPeerDependencies = checkPeerDeps ? getUnusedPeerDependencies({ name, location }, packageParams, sourceParams) : 0;
927
- const totalErrors = unlistedDependencies + unlistedDevDependencies + unusedDependencies + typesInDependencies + unusedPeerDependencies;
909
+ const totalErrors = unlistedDependencies + unlistedDevDependencies + unusedDependencies + unusedPeerDependencies;
928
910
  return totalErrors;
929
911
  }
930
912
 
@@ -967,7 +949,7 @@ var deplint = ({
967
949
  };
968
950
 
969
951
  // src/actions/deploy.ts
970
- import { readFileSync as readFileSync3 } from "node:fs";
952
+ import { readFileSync as readFileSync3 } from "fs";
971
953
  var privatePackageExcludeList = () => {
972
954
  const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
973
955
  workspace,
@@ -992,7 +974,7 @@ var deploy = () => {
992
974
  };
993
975
 
994
976
  // src/actions/deploy-major.ts
995
- import { readFileSync as readFileSync4 } from "node:fs";
977
+ import { readFileSync as readFileSync4 } from "fs";
996
978
  var privatePackageExcludeList2 = () => {
997
979
  const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
998
980
  workspace,
@@ -1017,7 +999,7 @@ var deployMajor = () => {
1017
999
  };
1018
1000
 
1019
1001
  // src/actions/deploy-minor.ts
1020
- import { readFileSync as readFileSync5 } from "node:fs";
1002
+ import { readFileSync as readFileSync5 } from "fs";
1021
1003
  var privatePackageExcludeList3 = () => {
1022
1004
  const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
1023
1005
  workspace,
@@ -1042,7 +1024,7 @@ var deployMinor = () => {
1042
1024
  };
1043
1025
 
1044
1026
  // src/actions/deploy-next.ts
1045
- import { readFileSync as readFileSync6 } from "node:fs";
1027
+ import { readFileSync as readFileSync6 } from "fs";
1046
1028
  var privatePackageExcludeList4 = () => {
1047
1029
  const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
1048
1030
  workspace,
@@ -1183,7 +1165,7 @@ Gitlint Start [${process.cwd()}]
1183
1165
  };
1184
1166
 
1185
1167
  // src/actions/gitlint-fix.ts
1186
- import { execSync as execSync2 } from "node:child_process";
1168
+ import { execSync as execSync2 } from "child_process";
1187
1169
  import chalk21 from "chalk";
1188
1170
  import ParseGitConfig2 from "parse-git-config";
1189
1171
  var gitlintFix = () => {
@@ -1283,7 +1265,7 @@ var filename2 = ".npmignore";
1283
1265
  var npmignoreGen = (pkg) => generateIgnoreFiles(filename2, pkg);
1284
1266
 
1285
1267
  // src/actions/package/clean-outputs.ts
1286
- import path5 from "node:path";
1268
+ import path5 from "path";
1287
1269
  import chalk23 from "chalk";
1288
1270
  var packageCleanOutputs = () => {
1289
1271
  const pkg = process.env.INIT_CWD ?? ".";
@@ -1297,7 +1279,7 @@ var packageCleanOutputs = () => {
1297
1279
  };
1298
1280
 
1299
1281
  // src/actions/package/clean-typescript.ts
1300
- import path6 from "node:path";
1282
+ import path6 from "path";
1301
1283
  import chalk24 from "chalk";
1302
1284
  var packageCleanTypescript = () => {
1303
1285
  const pkg = process.env.INIT_CWD ?? ".";
@@ -1319,7 +1301,7 @@ var packageClean = async () => {
1319
1301
  import chalk28 from "chalk";
1320
1302
 
1321
1303
  // src/actions/package/publint.ts
1322
- import { promises as fs4 } from "node:fs";
1304
+ import { promises as fs4 } from "fs";
1323
1305
  import chalk25 from "chalk";
1324
1306
  import sortPackageJson from "sort-package-json";
1325
1307
  var packagePublint = async (params) => {
@@ -1393,7 +1375,7 @@ var buildEntries = (folder, entryMode = "single", excludeSpecAndStories = true,
1393
1375
  };
1394
1376
 
1395
1377
  // src/actions/package/compile/packageCompileTscTypes.ts
1396
- import { cwd } from "node:process";
1378
+ import { cwd } from "process";
1397
1379
  import chalk26 from "chalk";
1398
1380
  import { createProgramFromConfig } from "tsc-prog";
1399
1381
  import {
@@ -1404,7 +1386,7 @@ import {
1404
1386
  } from "typescript";
1405
1387
 
1406
1388
  // src/actions/package/compile/getCompilerOptions.ts
1407
- import { createRequire } from "node:module";
1389
+ import { createRequire } from "module";
1408
1390
  import deepmerge2 from "deepmerge";
1409
1391
  import {
1410
1392
  findConfigFile,
@@ -1505,7 +1487,7 @@ function deepMergeObjects(objects) {
1505
1487
  }
1506
1488
 
1507
1489
  // src/actions/package/compile/packageCompileTsc.ts
1508
- import { cwd as cwd2 } from "node:process";
1490
+ import { cwd as cwd2 } from "process";
1509
1491
  import chalk27 from "chalk";
1510
1492
  import { createProgramFromConfig as createProgramFromConfig2 } from "tsc-prog";
1511
1493
  import {
@@ -1635,7 +1617,7 @@ var packageCompileTsup = async (config2) => {
1635
1617
  return (await Promise.all(
1636
1618
  Object.entries(compileForNode).map(async ([folder, options]) => {
1637
1619
  const inEsBuildOptions = typeof compile2?.node?.esbuildOptions === "object" ? compile2?.node?.esbuildOptions : {};
1638
- return folder ? await compileFolder(
1620
+ return typeof folder === "string" ? await compileFolder(
1639
1621
  folder,
1640
1622
  compile2?.entryMode,
1641
1623
  tsupOptions([
@@ -1647,10 +1629,10 @@ var packageCompileTsup = async (config2) => {
1647
1629
  verbose
1648
1630
  ) : 0;
1649
1631
  })
1650
- )).reduce((prev, value) => prev + value, 0) || (await Promise.all(
1632
+ )).reduce((prev, value) => prev + value, 0) + (await Promise.all(
1651
1633
  Object.entries(compileForBrowser).map(async ([folder, options]) => {
1652
1634
  const inEsBuildOptions = typeof compile2?.browser?.esbuildOptions === "object" ? compile2?.browser?.esbuildOptions : {};
1653
- return folder ? await compileFolder(
1635
+ return typeof folder === "string" ? await compileFolder(
1654
1636
  folder,
1655
1637
  compile2?.entryMode,
1656
1638
  tsupOptions([
@@ -1662,10 +1644,10 @@ var packageCompileTsup = async (config2) => {
1662
1644
  verbose
1663
1645
  ) : 0;
1664
1646
  })
1665
- )).reduce((prev, value) => prev + value, 0) || (await Promise.all(
1647
+ )).reduce((prev, value) => prev + value, 0) + (await Promise.all(
1666
1648
  Object.entries(compileForNeutral).map(async ([folder, options]) => {
1667
1649
  const inEsBuildOptions = typeof compile2?.neutral?.esbuildOptions === "object" ? compile2?.neutral?.esbuildOptions : {};
1668
- return folder ? await compileFolder(
1650
+ return typeof folder === "string" ? await compileFolder(
1669
1651
  folder,
1670
1652
  compile2?.entryMode,
1671
1653
  tsupOptions([
@@ -1677,7 +1659,7 @@ var packageCompileTsup = async (config2) => {
1677
1659
  verbose
1678
1660
  ) : 0;
1679
1661
  })
1680
- )).reduce((prev, value) => prev + value, 0) || 0;
1662
+ )).reduce((prev, value) => prev + value, 0) + 0;
1681
1663
  };
1682
1664
 
1683
1665
  // src/actions/package/compile/compile.ts
@@ -1694,7 +1676,7 @@ var packageCompile = async (inConfig = {}) => {
1694
1676
  };
1695
1677
 
1696
1678
  // src/actions/package/copy-assets.ts
1697
- import path7 from "node:path/posix";
1679
+ import path7 from "path/posix";
1698
1680
  import chalk29 from "chalk";
1699
1681
  import cpy2 from "cpy";
1700
1682
  var copyTargetAssets2 = async (target, name, location) => {
@@ -1775,8 +1757,8 @@ var packageCycle = async ({ verbose = false }) => {
1775
1757
  };
1776
1758
 
1777
1759
  // src/actions/package/gen-docs.ts
1778
- import { existsSync as existsSync4 } from "node:fs";
1779
- import path8 from "node:path";
1760
+ import { existsSync as existsSync4 } from "fs";
1761
+ import path8 from "path";
1780
1762
  import chalk30 from "chalk";
1781
1763
  import {
1782
1764
  Application,
@@ -1886,10 +1868,10 @@ var runTypeDoc = async (app) => {
1886
1868
  };
1887
1869
 
1888
1870
  // src/actions/package/lint.ts
1889
- import { readdirSync } from "node:fs";
1890
- import path9 from "node:path";
1891
- import { cwd as cwd3 } from "node:process";
1892
- import { pathToFileURL } from "node:url";
1871
+ import { readdirSync } from "fs";
1872
+ import path9 from "path";
1873
+ import { cwd as cwd3 } from "process";
1874
+ import { pathToFileURL } from "url";
1893
1875
  import chalk31 from "chalk";
1894
1876
  import { ESLint } from "eslint";
1895
1877
  import { findUp } from "find-up";
@@ -2062,7 +2044,7 @@ import {
2062
2044
  closeSync,
2063
2045
  openSync,
2064
2046
  rmSync
2065
- } from "node:fs";
2047
+ } from "fs";
2066
2048
  var reinstall = () => {
2067
2049
  console.log("Reinstall [Clear Lock File]");
2068
2050
  closeSync(openSync("./yarn.lock", "w"));