@xylabs/ts-scripts-yarn3 6.3.5 → 6.4.1

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 (251) hide show
  1. package/dist/actions/build.mjs +39 -87
  2. package/dist/actions/build.mjs.map +1 -1
  3. package/dist/actions/clean-docs.mjs +8 -22
  4. package/dist/actions/clean-docs.mjs.map +1 -1
  5. package/dist/actions/clean-eslint.mjs +5 -11
  6. package/dist/actions/clean-eslint.mjs.map +1 -1
  7. package/dist/actions/clean-jest.mjs +16 -29
  8. package/dist/actions/clean-jest.mjs.map +1 -1
  9. package/dist/actions/clean.mjs +32 -63
  10. package/dist/actions/clean.mjs.map +1 -1
  11. package/dist/actions/compile-types.mjs +45 -68
  12. package/dist/actions/compile-types.mjs.map +1 -1
  13. package/dist/actions/compile.mjs +50 -76
  14. package/dist/actions/compile.mjs.map +1 -1
  15. package/dist/actions/copy-assets.mjs +23 -38
  16. package/dist/actions/copy-assets.mjs.map +1 -1
  17. package/dist/actions/cycle.mjs +28 -57
  18. package/dist/actions/cycle.mjs.map +1 -1
  19. package/dist/actions/dead.mjs +16 -31
  20. package/dist/actions/dead.mjs.map +1 -1
  21. package/dist/actions/deplint.mjs +195 -0
  22. package/dist/actions/deplint.mjs.map +1 -0
  23. package/dist/actions/deploy-major.mjs +20 -41
  24. package/dist/actions/deploy-major.mjs.map +1 -1
  25. package/dist/actions/deploy-minor.mjs +20 -41
  26. package/dist/actions/deploy-minor.mjs.map +1 -1
  27. package/dist/actions/deploy-next.mjs +20 -41
  28. package/dist/actions/deploy-next.mjs.map +1 -1
  29. package/dist/actions/deploy.mjs +20 -41
  30. package/dist/actions/deploy.mjs.map +1 -1
  31. package/dist/actions/dupdeps.mjs +26 -37
  32. package/dist/actions/dupdeps.mjs.map +1 -1
  33. package/dist/actions/fix.mjs +36 -54
  34. package/dist/actions/fix.mjs.map +1 -1
  35. package/dist/actions/gen-docs.mjs +25 -65
  36. package/dist/actions/gen-docs.mjs.map +1 -1
  37. package/dist/actions/gitignore-gen.mjs +28 -44
  38. package/dist/actions/gitignore-gen.mjs.map +1 -1
  39. package/dist/actions/gitlint-fix.mjs +5 -14
  40. package/dist/actions/gitlint-fix.mjs.map +1 -1
  41. package/dist/actions/gitlint.mjs +4 -7
  42. package/dist/actions/gitlint.mjs.map +1 -1
  43. package/dist/actions/index.mjs +864 -1241
  44. package/dist/actions/index.mjs.map +1 -1
  45. package/dist/actions/knip.mjs +16 -31
  46. package/dist/actions/knip.mjs.map +1 -1
  47. package/dist/actions/license.mjs +37 -51
  48. package/dist/actions/license.mjs.map +1 -1
  49. package/dist/actions/lint.mjs +33 -48
  50. package/dist/actions/lint.mjs.map +1 -1
  51. package/dist/actions/npmignore-gen.mjs +28 -44
  52. package/dist/actions/npmignore-gen.mjs.map +1 -1
  53. package/dist/actions/package/clean-outputs.mjs +6 -16
  54. package/dist/actions/package/clean-outputs.mjs.map +1 -1
  55. package/dist/actions/package/clean-typescript.mjs +6 -16
  56. package/dist/actions/package/clean-typescript.mjs.map +1 -1
  57. package/dist/actions/package/clean.mjs +12 -29
  58. package/dist/actions/package/clean.mjs.map +1 -1
  59. package/dist/actions/package/compile/buildEntries.mjs +7 -17
  60. package/dist/actions/package/compile/buildEntries.mjs.map +1 -1
  61. package/dist/actions/package/compile/compile.mjs +133 -169
  62. package/dist/actions/package/compile/compile.mjs.map +1 -1
  63. package/dist/actions/package/compile/compileTypes.mjs +43 -59
  64. package/dist/actions/package/compile/compileTypes.mjs.map +1 -1
  65. package/dist/actions/package/compile/copyTypeFiles.mjs +20 -23
  66. package/dist/actions/package/compile/copyTypeFiles.mjs.map +1 -1
  67. package/dist/actions/package/compile/deepMerge.mjs +0 -5
  68. package/dist/actions/package/compile/deepMerge.mjs.map +1 -1
  69. package/dist/actions/package/compile/getCompilerOptions.mjs +11 -10
  70. package/dist/actions/package/compile/getCompilerOptions.mjs.map +1 -1
  71. package/dist/actions/package/compile/index.mjs +133 -169
  72. package/dist/actions/package/compile/index.mjs.map +1 -1
  73. package/dist/actions/package/compile/inputs.mjs +3 -8
  74. package/dist/actions/package/compile/inputs.mjs.map +1 -1
  75. package/dist/actions/package/compile/packageCompileTsc.mjs +37 -52
  76. package/dist/actions/package/compile/packageCompileTsc.mjs.map +1 -1
  77. package/dist/actions/package/compile/packageCompileTscTypes.mjs +37 -52
  78. package/dist/actions/package/compile/packageCompileTscTypes.mjs.map +1 -1
  79. package/dist/actions/package/compile/packageCompileTsup.mjs +127 -163
  80. package/dist/actions/package/compile/packageCompileTsup.mjs.map +1 -1
  81. package/dist/actions/package/copy-assets.mjs +12 -21
  82. package/dist/actions/package/copy-assets.mjs.map +1 -1
  83. package/dist/actions/package/cycle.mjs +5 -14
  84. package/dist/actions/package/cycle.mjs.map +1 -1
  85. package/dist/actions/package/gen-docs.mjs +11 -12
  86. package/dist/actions/package/gen-docs.mjs.map +1 -1
  87. package/dist/actions/package/index.mjs +191 -271
  88. package/dist/actions/package/index.mjs.map +1 -1
  89. package/dist/actions/package/lint.mjs +16 -39
  90. package/dist/actions/package/lint.mjs.map +1 -1
  91. package/dist/actions/package/publint.mjs +4 -7
  92. package/dist/actions/package/publint.mjs.map +1 -1
  93. package/dist/actions/package/recompile.mjs +147 -197
  94. package/dist/actions/package/recompile.mjs.map +1 -1
  95. package/dist/actions/publint.mjs +37 -71
  96. package/dist/actions/publint.mjs.map +1 -1
  97. package/dist/actions/rebuild.mjs +17 -29
  98. package/dist/actions/rebuild.mjs.map +1 -1
  99. package/dist/actions/recompile.mjs +50 -67
  100. package/dist/actions/recompile.mjs.map +1 -1
  101. package/dist/actions/reinstall.mjs +25 -43
  102. package/dist/actions/reinstall.mjs.map +1 -1
  103. package/dist/actions/relint.mjs +40 -63
  104. package/dist/actions/relint.mjs.map +1 -1
  105. package/dist/actions/retest.mjs +17 -35
  106. package/dist/actions/retest.mjs.map +1 -1
  107. package/dist/actions/sonar.mjs +16 -32
  108. package/dist/actions/sonar.mjs.map +1 -1
  109. package/dist/actions/statics.mjs +27 -46
  110. package/dist/actions/statics.mjs.map +1 -1
  111. package/dist/actions/test.mjs +16 -30
  112. package/dist/actions/test.mjs.map +1 -1
  113. package/dist/actions/up.mjs +16 -27
  114. package/dist/actions/up.mjs.map +1 -1
  115. package/dist/actions/updo.mjs +18 -33
  116. package/dist/actions/updo.mjs.map +1 -1
  117. package/dist/actions/upplug.mjs +19 -53
  118. package/dist/actions/upplug.mjs.map +1 -1
  119. package/dist/actions/upyarn.mjs +16 -31
  120. package/dist/actions/upyarn.mjs.map +1 -1
  121. package/dist/actions/yarn3only.mjs +12 -23
  122. package/dist/actions/yarn3only.mjs.map +1 -1
  123. package/dist/bin/package/build-only.mjs +134 -172
  124. package/dist/bin/package/build-only.mjs.map +1 -1
  125. package/dist/bin/package/build.mjs +134 -172
  126. package/dist/bin/package/build.mjs.map +1 -1
  127. package/dist/bin/package/clean-outputs.mjs +6 -15
  128. package/dist/bin/package/clean-outputs.mjs.map +1 -1
  129. package/dist/bin/package/clean-typescript.mjs +6 -15
  130. package/dist/bin/package/clean-typescript.mjs.map +1 -1
  131. package/dist/bin/package/clean.mjs +12 -28
  132. package/dist/bin/package/clean.mjs.map +1 -1
  133. package/dist/bin/package/compile-only.mjs +134 -172
  134. package/dist/bin/package/compile-only.mjs.map +1 -1
  135. package/dist/bin/package/compile-tsup.mjs +128 -165
  136. package/dist/bin/package/compile-tsup.mjs.map +1 -1
  137. package/dist/bin/package/compile-types.mjs +44 -61
  138. package/dist/bin/package/compile-types.mjs.map +1 -1
  139. package/dist/bin/package/compile.mjs +134 -171
  140. package/dist/bin/package/compile.mjs.map +1 -1
  141. package/dist/bin/package/copy-assets-cjs.mjs +13 -23
  142. package/dist/bin/package/copy-assets-cjs.mjs.map +1 -1
  143. package/dist/bin/package/copy-assets-esm.mjs +13 -23
  144. package/dist/bin/package/copy-assets-esm.mjs.map +1 -1
  145. package/dist/bin/package/cycle.mjs +6 -16
  146. package/dist/bin/package/cycle.mjs.map +1 -1
  147. package/dist/bin/package/fix.mjs +16 -38
  148. package/dist/bin/package/fix.mjs.map +1 -1
  149. package/dist/bin/package/gen-docs.mjs +11 -11
  150. package/dist/bin/package/gen-docs.mjs.map +1 -1
  151. package/dist/bin/package/lint.mjs +16 -38
  152. package/dist/bin/package/lint.mjs.map +1 -1
  153. package/dist/bin/package/publint.mjs +4 -6
  154. package/dist/bin/package/publint.mjs.map +1 -1
  155. package/dist/bin/package/recompile.mjs +147 -196
  156. package/dist/bin/package/recompile.mjs.map +1 -1
  157. package/dist/bin/package/relint.mjs +16 -38
  158. package/dist/bin/package/relint.mjs.map +1 -1
  159. package/dist/bin/xy.mjs +1086 -1237
  160. package/dist/bin/xy.mjs.map +1 -1
  161. package/dist/index.d.ts +5 -1
  162. package/dist/index.mjs +1338 -1583
  163. package/dist/index.mjs.map +1 -1
  164. package/dist/lib/checkResult.mjs +2 -5
  165. package/dist/lib/checkResult.mjs.map +1 -1
  166. package/dist/lib/createBuildConfig.mjs +9 -24
  167. package/dist/lib/createBuildConfig.mjs.map +1 -1
  168. package/dist/lib/defaultBuildConfig.mjs +2 -6
  169. package/dist/lib/defaultBuildConfig.mjs.map +1 -1
  170. package/dist/lib/deleteGlob.mjs +3 -9
  171. package/dist/lib/deleteGlob.mjs.map +1 -1
  172. package/dist/lib/dependencies/DuplicateDetector.mjs +12 -23
  173. package/dist/lib/dependencies/DuplicateDetector.mjs.map +1 -1
  174. package/dist/lib/dependencies/detectDuplicateDependencies.mjs +22 -33
  175. package/dist/lib/dependencies/detectDuplicateDependencies.mjs.map +1 -1
  176. package/dist/lib/dependencies/index.mjs +22 -33
  177. package/dist/lib/dependencies/index.mjs.map +1 -1
  178. package/dist/lib/file/ReadFileSyncOptions.mjs +1 -3
  179. package/dist/lib/file/ReadFileSyncOptions.mjs.map +1 -1
  180. package/dist/lib/file/constants.mjs.map +1 -1
  181. package/dist/lib/file/fileLines.mjs +12 -13
  182. package/dist/lib/file/fileLines.mjs.map +1 -1
  183. package/dist/lib/file/index.mjs +14 -15
  184. package/dist/lib/file/index.mjs.map +1 -1
  185. package/dist/lib/file/tryReadFileSync.mjs +3 -8
  186. package/dist/lib/file/tryReadFileSync.mjs.map +1 -1
  187. package/dist/lib/generateIgnoreFiles.mjs +27 -43
  188. package/dist/lib/generateIgnoreFiles.mjs.map +1 -1
  189. package/dist/lib/index.mjs +100 -154
  190. package/dist/lib/index.mjs.map +1 -1
  191. package/dist/lib/jsonFormatters.mjs +2 -5
  192. package/dist/lib/jsonFormatters.mjs.map +1 -1
  193. package/dist/lib/loadConfig.mjs +4 -8
  194. package/dist/lib/loadConfig.mjs.map +1 -1
  195. package/dist/lib/parsedPackageJSON.mjs +2 -5
  196. package/dist/lib/parsedPackageJSON.mjs.map +1 -1
  197. package/dist/lib/processEx.mjs +6 -9
  198. package/dist/lib/processEx.mjs.map +1 -1
  199. package/dist/lib/runSteps.mjs +13 -19
  200. package/dist/lib/runSteps.mjs.map +1 -1
  201. package/dist/lib/runStepsAsync.mjs +22 -22
  202. package/dist/lib/runStepsAsync.mjs.map +1 -1
  203. package/dist/lib/runXy.mjs +19 -31
  204. package/dist/lib/runXy.mjs.map +1 -1
  205. package/dist/lib/runXyWithWarning.mjs +2 -5
  206. package/dist/lib/runXyWithWarning.mjs.map +1 -1
  207. package/dist/lib/safeExit.mjs +10 -13
  208. package/dist/lib/safeExit.mjs.map +1 -1
  209. package/dist/lib/string/empty.mjs +2 -5
  210. package/dist/lib/string/empty.mjs.map +1 -1
  211. package/dist/lib/string/index.mjs +3 -9
  212. package/dist/lib/string/index.mjs.map +1 -1
  213. package/dist/lib/string/union.mjs +1 -7
  214. package/dist/lib/string/union.mjs.map +1 -1
  215. package/dist/lib/withErrnoException.mjs +4 -7
  216. package/dist/lib/withErrnoException.mjs.map +1 -1
  217. package/dist/lib/withError.mjs +2 -5
  218. package/dist/lib/withError.mjs.map +1 -1
  219. package/dist/lib/yarn/index.mjs +11 -30
  220. package/dist/lib/yarn/index.mjs.map +1 -1
  221. package/dist/lib/yarn/isYarnVersionOrGreater.mjs +4 -15
  222. package/dist/lib/yarn/isYarnVersionOrGreater.mjs.map +1 -1
  223. package/dist/lib/yarn/workspace/index.mjs +5 -16
  224. package/dist/lib/yarn/workspace/index.mjs.map +1 -1
  225. package/dist/lib/yarn/workspace/yarnWorkspace.mjs +5 -16
  226. package/dist/lib/yarn/workspace/yarnWorkspace.mjs.map +1 -1
  227. package/dist/lib/yarn/workspace/yarnWorkspaces.mjs +3 -14
  228. package/dist/lib/yarn/workspace/yarnWorkspaces.mjs.map +1 -1
  229. package/dist/lib/yarn/yarnInitCwd.mjs +2 -5
  230. package/dist/lib/yarn/yarnInitCwd.mjs.map +1 -1
  231. package/dist/loadPackageConfig.mjs +3 -8
  232. package/dist/loadPackageConfig.mjs.map +1 -1
  233. package/dist/xy/index.mjs +1086 -1238
  234. package/dist/xy/index.mjs.map +1 -1
  235. package/dist/xy/param.mjs +3 -8
  236. package/dist/xy/param.mjs.map +1 -1
  237. package/dist/xy/xy.mjs +1086 -1238
  238. package/dist/xy/xy.mjs.map +1 -1
  239. package/dist/xy/xyBuildCommands.mjs +276 -382
  240. package/dist/xy/xyBuildCommands.mjs.map +1 -1
  241. package/dist/xy/xyCommonCommands.mjs +251 -335
  242. package/dist/xy/xyCommonCommands.mjs.map +1 -1
  243. package/dist/xy/xyDeployCommands.mjs +84 -130
  244. package/dist/xy/xyDeployCommands.mjs.map +1 -1
  245. package/dist/xy/xyInstallCommands.mjs +145 -193
  246. package/dist/xy/xyInstallCommands.mjs.map +1 -1
  247. package/dist/xy/xyLintCommands.mjs +413 -292
  248. package/dist/xy/xyLintCommands.mjs.map +1 -1
  249. package/dist/xy/xyParseOptions.mjs +4 -13
  250. package/dist/xy/xyParseOptions.mjs.map +1 -1
  251. package/package.json +3 -22
@@ -1,12 +1,9 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
-
4
1
  // src/xy/xyLintCommands.ts
5
- import chalk7 from "chalk";
2
+ import chalk8 from "chalk";
6
3
 
7
4
  // src/lib/checkResult.ts
8
5
  import chalk from "chalk";
9
- var checkResult = /* @__PURE__ */ __name((name, result, level = "error", exitOnFail = false) => {
6
+ var checkResult = (name, result, level = "error", exitOnFail = false) => {
10
7
  if (result) {
11
8
  const exiting = exitOnFail ? "[Exiting Process]" : "[Continuing]";
12
9
  const chalkFunc = level === "error" ? chalk.red : chalk.yellow;
@@ -15,23 +12,23 @@ var checkResult = /* @__PURE__ */ __name((name, result, level = "error", exitOnF
15
12
  process.exit(result);
16
13
  }
17
14
  }
18
- }, "checkResult");
15
+ };
19
16
 
20
17
  // src/lib/processEx.ts
21
18
  import chalk2 from "chalk";
22
19
 
23
20
  // src/lib/withError.ts
24
- var withError = /* @__PURE__ */ __name((ex, closure, predicate = (ex2) => !!ex2.name && !!ex2.message) => {
21
+ var withError = (ex, closure, predicate = (ex2) => !!ex2.name && !!ex2.message) => {
25
22
  return predicate(ex) ? closure(ex) : void 0;
26
- }, "withError");
23
+ };
27
24
 
28
25
  // src/lib/withErrnoException.ts
29
- var withErrnoException = /* @__PURE__ */ __name((ex, closure) => {
26
+ var withErrnoException = (ex, closure) => {
30
27
  return withError(ex, closure, (ex2) => ex2.errno !== void 0);
31
- }, "withErrnoException");
28
+ };
32
29
 
33
30
  // src/lib/processEx.ts
34
- var processEx = /* @__PURE__ */ __name((ex) => {
31
+ var processEx = (ex) => {
35
32
  const error = typeof ex === "string" ? new Error(ex) : ex;
36
33
  const exitCode = withErrnoException(error, (error2) => {
37
34
  if (error2.code === "ENOENT") {
@@ -48,10 +45,10 @@ var processEx = /* @__PURE__ */ __name((ex) => {
48
45
  return -1;
49
46
  })();
50
47
  process.exit(process.exitCode ?? exitCode);
51
- }, "processEx");
48
+ };
52
49
 
53
50
  // src/lib/safeExit.ts
54
- var safeExit = /* @__PURE__ */ __name((func, exitOnFail = true) => {
51
+ var safeExit = (func, exitOnFail = true) => {
55
52
  try {
56
53
  const result = func();
57
54
  if (result && exitOnFail) {
@@ -61,8 +58,8 @@ var safeExit = /* @__PURE__ */ __name((func, exitOnFail = true) => {
61
58
  } catch (ex) {
62
59
  return processEx(ex);
63
60
  }
64
- }, "safeExit");
65
- var safeExitAsync = /* @__PURE__ */ __name(async (func, exitOnFail = true) => {
61
+ };
62
+ var safeExitAsync = async (func, exitOnFail = true) => {
66
63
  try {
67
64
  const result = await func();
68
65
  if (result && exitOnFail) {
@@ -72,13 +69,32 @@ var safeExitAsync = /* @__PURE__ */ __name(async (func, exitOnFail = true) => {
72
69
  } catch (ex) {
73
70
  return processEx(ex);
74
71
  }
75
- }, "safeExitAsync");
72
+ };
76
73
 
77
- // src/lib/runSteps.ts
74
+ // src/lib/yarn/workspace/yarnWorkspaces.ts
78
75
  import { spawnSync } from "node:child_process";
76
+ var yarnWorkspaces = () => {
77
+ const result = spawnSync("yarn", ["workspaces", "list", "--json", "--recursive"], { encoding: "utf8", shell: true });
78
+ if (result.error) {
79
+ throw result.error;
80
+ }
81
+ return result.stdout.toString().split("\n").slice(0, -1).map((item) => {
82
+ return JSON.parse(item);
83
+ });
84
+ };
85
+
86
+ // src/lib/yarn/workspace/yarnWorkspace.ts
87
+ var yarnWorkspace = (pkg) => {
88
+ const workspace = yarnWorkspaces().find(({ name }) => name === pkg);
89
+ if (!workspace) throw new Error(`Workspace ${pkg} not found`);
90
+ return workspace;
91
+ };
92
+
93
+ // src/lib/runSteps.ts
94
+ import { spawnSync as spawnSync2 } from "node:child_process";
79
95
  import { existsSync } from "node:fs";
80
96
  import chalk3 from "chalk";
81
- var runSteps = /* @__PURE__ */ __name((name, steps, exitOnFail = true, messages) => {
97
+ var runSteps = (name, steps, exitOnFail = true, messages) => {
82
98
  return safeExit(() => {
83
99
  const pkgName = process.env.npm_package_name;
84
100
  console.log(chalk3.green(`${name} [${pkgName}]`));
@@ -91,13 +107,10 @@ var runSteps = /* @__PURE__ */ __name((name, steps, exitOnFail = true, messages)
91
107
  if (command === "node" && !existsSync(argList[0])) {
92
108
  throw new Error(`File not found [${argList[0]}]`);
93
109
  }
94
- const status = spawnSync(command, Array.isArray(args) ? args : args.split(" "), {
110
+ const status = spawnSync2(command, Array.isArray(args) ? args : args.split(" "), {
95
111
  ...config,
96
112
  encoding: "utf8",
97
- env: {
98
- FORCE_COLOR: "3",
99
- ...process.env
100
- },
113
+ env: { FORCE_COLOR: "3", ...process.env },
101
114
  shell: true,
102
115
  stdio: "inherit"
103
116
  }).status ?? 0;
@@ -106,13 +119,13 @@ var runSteps = /* @__PURE__ */ __name((name, steps, exitOnFail = true, messages)
106
119
  }
107
120
  return totalStatus;
108
121
  }, !!exitOnFail);
109
- }, "runSteps");
122
+ };
110
123
 
111
124
  // src/lib/runStepsAsync.ts
112
125
  import { spawn } from "node:child_process";
113
126
  import { existsSync as existsSync2 } from "node:fs";
114
127
  import chalk4 from "chalk";
115
- var runStepAsync = /* @__PURE__ */ __name((name, step, exitOnFail = true, message) => {
128
+ var runStepAsync = (name, step, exitOnFail = true, message) => {
116
129
  return new Promise((resolve) => {
117
130
  const [command, args, config] = step;
118
131
  if (message) {
@@ -124,15 +137,18 @@ var runStepAsync = /* @__PURE__ */ __name((name, step, exitOnFail = true, messag
124
137
  }
125
138
  spawn(command, Array.isArray(args) ? args : args.split(" "), {
126
139
  ...config,
127
- env: {
128
- FORCE_COLOR: "3",
129
- ...process.env
130
- },
140
+ env: { FORCE_COLOR: "3", ...process.env },
131
141
  shell: true,
132
142
  stdio: "inherit"
133
143
  }).on("close", (code) => {
134
144
  if (code) {
135
- console.error(chalk4.red(`Command Exited With Non-Zero Result [${chalk4.gray(code)}] | ${chalk4.yellow(command)} ${chalk4.white(Array.isArray(args) ? args.join(" ") : args)}`));
145
+ console.error(
146
+ chalk4.red(
147
+ `Command Exited With Non-Zero Result [${chalk4.gray(code)}] | ${chalk4.yellow(command)} ${chalk4.white(
148
+ Array.isArray(args) ? args.join(" ") : args
149
+ )}`
150
+ )
151
+ );
136
152
  checkResult(name, code, "error", exitOnFail);
137
153
  resolve(code);
138
154
  } else {
@@ -140,8 +156,8 @@ var runStepAsync = /* @__PURE__ */ __name((name, step, exitOnFail = true, messag
140
156
  }
141
157
  });
142
158
  });
143
- }, "runStepAsync");
144
- var runStepsAsync = /* @__PURE__ */ __name(async (name, steps, exitOnFail = true, messages) => {
159
+ };
160
+ var runStepsAsync = async (name, steps, exitOnFail = true, messages) => {
145
161
  return await safeExitAsync(async () => {
146
162
  const pkgName = process.env.npm_package_name;
147
163
  console.log(chalk4.green(`${name} [${pkgName}]`));
@@ -151,38 +167,21 @@ var runStepsAsync = /* @__PURE__ */ __name(async (name, steps, exitOnFail = true
151
167
  }
152
168
  return result;
153
169
  });
154
- }, "runStepsAsync");
170
+ };
155
171
 
156
172
  // src/actions/cycle.ts
157
173
  import { cruise } from "dependency-cruiser";
158
- var cycle = /* @__PURE__ */ __name(async ({ verbose, pkg } = {}) => {
159
- return pkg ? cyclePackage({
160
- pkg,
161
- verbose
162
- }) : await cycleAll({
163
- verbose
164
- });
165
- }, "cycle");
166
- var cyclePackage = /* @__PURE__ */ __name(({ pkg, verbose }) => {
167
- const verboseOptions = verbose ? [
168
- "--verbose"
169
- ] : [
170
- "--no-verbose"
171
- ];
172
- return runSteps(`Cycle [${pkg}]`, [
173
- [
174
- "yarn",
175
- [
176
- "workspace",
177
- pkg,
178
- "run",
179
- "package-cycle",
180
- ...verboseOptions
181
- ]
182
- ]
183
- ]);
184
- }, "cyclePackage");
185
- var cycleAll = /* @__PURE__ */ __name(async ({ verbose = false }) => {
174
+ var cycle = async ({ verbose, pkg } = {}) => {
175
+ return pkg ? cyclePackage({ pkg, verbose }) : await cycleAll({ verbose });
176
+ };
177
+ var cyclePackage = ({ pkg, verbose }) => {
178
+ const verboseOptions = verbose ? ["--verbose"] : ["--no-verbose"];
179
+ return runSteps(
180
+ `Cycle [${pkg}]`,
181
+ [["yarn", ["workspace", pkg, "run", "package-cycle", ...verboseOptions]]]
182
+ );
183
+ };
184
+ var cycleAll = async ({ verbose = false }) => {
186
185
  const pkgName = process.env.npm_package_name;
187
186
  const cruiseOptions = {
188
187
  ruleSet: {
@@ -192,26 +191,20 @@ var cycleAll = /* @__PURE__ */ __name(async ({ verbose = false }) => {
192
191
  severity: "error",
193
192
  comment: "This dependency creates a circular reference",
194
193
  from: {},
195
- to: {
196
- circular: true
197
- }
194
+ to: { circular: true }
198
195
  }
199
196
  ]
200
197
  },
201
198
  exclude: "node_modules|packages/.*/packages",
202
199
  validate: true,
203
- doNotFollow: {
204
- path: "node_modules|packages/.*/packages"
205
- },
200
+ doNotFollow: { path: "node_modules|packages/.*/packages" },
206
201
  tsPreCompilationDeps: false,
207
202
  combinedDependencies: true,
208
203
  outputType: verbose ? "text" : "err"
209
204
  };
210
205
  const target = "**/src";
211
206
  console.log(`Checking for circular dependencies in ${target}...`);
212
- const result = await cruise([
213
- target
214
- ], cruiseOptions);
207
+ const result = await cruise([target], cruiseOptions);
215
208
  if (result.output) {
216
209
  console.log(result.output);
217
210
  }
@@ -221,264 +214,392 @@ var cycleAll = /* @__PURE__ */ __name(async ({ verbose = false }) => {
221
214
  console.error(`${pkgName} \u274C Dependency violations found`);
222
215
  }
223
216
  return result.exitCode;
224
- }, "cycleAll");
217
+ };
225
218
 
226
- // src/actions/lint.ts
219
+ // src/actions/deplint.ts
220
+ import fs from "node:fs";
221
+ import path from "node:path";
227
222
  import chalk5 from "chalk";
228
- var lintPackage = /* @__PURE__ */ __name(({ pkg, fix: fix2 }) => {
229
- console.log(chalk5.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
223
+ import { globSync } from "glob";
224
+ import ts from "typescript";
225
+ function getDependenciesFromPackageJson(packageJsonPath) {
226
+ const packageJsonFullPath = path.resolve(packageJsonPath);
227
+ const rawContent = fs.readFileSync(packageJsonFullPath, "utf8");
228
+ const packageJson = JSON.parse(rawContent);
229
+ const dependencies = packageJson.dependencies ? Object.keys(packageJson.dependencies) : [];
230
+ const devDependencies = packageJson.devDependencies ? Object.keys(packageJson.devDependencies) : [];
231
+ const peerDependencies = packageJson.peerDependencies ? Object.keys(packageJson.peerDependencies) : [];
232
+ return {
233
+ dependencies,
234
+ devDependencies,
235
+ peerDependencies
236
+ };
237
+ }
238
+ function getBasePackageName(importName) {
239
+ if (importName.startsWith("@")) {
240
+ const parts = importName.split("/");
241
+ return parts.length >= 2 ? `${parts[0]}/${parts[1]}` : importName;
242
+ }
243
+ return importName.split("/")[0];
244
+ }
245
+ function getImportsFromFile(filePath, importPaths) {
246
+ const sourceCode = fs.readFileSync(filePath, "utf8");
247
+ const sourceFile = ts.createSourceFile(
248
+ path.basename(filePath),
249
+ sourceCode,
250
+ ts.ScriptTarget.Latest,
251
+ true
252
+ );
253
+ const imports = [];
254
+ function visit(node) {
255
+ if (ts.isImportDeclaration(node) || ts.isExportDeclaration(node)) {
256
+ const moduleSpecifier = node.moduleSpecifier?.getFullText();
257
+ if (moduleSpecifier) {
258
+ const trimmed = moduleSpecifier.split("'").at(1) ?? moduleSpecifier;
259
+ imports.push(trimmed);
260
+ }
261
+ }
262
+ ts.forEachChild(node, visit);
263
+ }
264
+ visit(sourceFile);
265
+ const cleanedImports = imports.filter((imp) => !imp.startsWith(".") && !imp.startsWith("#") && !imp.startsWith("node:")).map(getBasePackageName);
266
+ for (const imp of cleanedImports) {
267
+ importPaths[imp] = importPaths[imp] || [];
268
+ importPaths[imp].push(filePath);
269
+ }
270
+ return cleanedImports;
271
+ }
272
+ function findFilesByGlob(cwd, pattern) {
273
+ return globSync(pattern, { cwd, absolute: true });
274
+ }
275
+ function findFiles(path2) {
276
+ const allSourceInclude = ["./src/**/*.{ts,tsx}"];
277
+ const prodExcludeEndswith = [".spec.ts", ".stories.tsx"];
278
+ const prodExcludeIncludes = ["/spec/", "/stories/", "/scripts/"];
279
+ const allSourceFiles = allSourceInclude.flatMap((pattern) => findFilesByGlob(path2, pattern));
280
+ const prodSourceFiles = allSourceFiles.filter((file) => !prodExcludeEndswith.some((ext) => file.endsWith(ext)) && !prodExcludeIncludes.some((excl) => file.includes(excl)));
281
+ const devSourceFiles = allSourceFiles.filter((file) => !prodSourceFiles.includes(file));
282
+ return {
283
+ allSourceFiles,
284
+ prodSourceFiles,
285
+ devSourceFiles
286
+ };
287
+ }
288
+ function getExternalImportsFromFiles({ prodSourceFiles, devSourceFiles }) {
289
+ const prodImportPaths = {};
290
+ const prodImports = prodSourceFiles.flatMap((path2) => getImportsFromFile(path2, prodImportPaths));
291
+ const devImportPaths = {};
292
+ const devImports = devSourceFiles.flatMap((path2) => getImportsFromFile(path2, devImportPaths));
293
+ const externalProdImports = prodImports.filter((imp) => !imp.startsWith(".") && !imp.startsWith("#") && !imp.startsWith("node:"));
294
+ const externalDevImports = devImports.filter((imp) => !imp.startsWith(".") && !imp.startsWith("#") && !imp.startsWith("node:"));
295
+ return {
296
+ prodImports,
297
+ devImports,
298
+ prodImportPaths,
299
+ devImportPaths,
300
+ externalProdImports,
301
+ externalDevImports
302
+ };
303
+ }
304
+ function check({
305
+ name,
306
+ location,
307
+ devDeps = false,
308
+ peerDeps = false
309
+ }) {
310
+ const { prodSourceFiles, devSourceFiles } = findFiles(location);
311
+ const {
312
+ prodImportPaths,
313
+ devImportPaths,
314
+ externalProdImports,
315
+ externalDevImports
316
+ } = getExternalImportsFromFiles({ prodSourceFiles, devSourceFiles });
317
+ const {
318
+ dependencies,
319
+ devDependencies,
320
+ peerDependencies
321
+ } = getDependenciesFromPackageJson(`${location}/package.json`);
322
+ let unlistedDependencies = 0;
323
+ let unlistedDevDependencies = 0;
324
+ let unusedDependencies = 0;
325
+ for (const imp of externalProdImports) {
326
+ if (!dependencies.includes(imp) && !peerDependencies.includes(imp)) {
327
+ unlistedDependencies++;
328
+ console.log(`[${chalk5.blue(name)}] Missing dependency in package.json: ${chalk5.red(imp)}`);
329
+ console.log(` ${prodImportPaths[imp].join("\n")}`);
330
+ console.log("");
331
+ }
332
+ }
333
+ for (const dep of dependencies) {
334
+ if (!externalProdImports.includes(dep)) {
335
+ unusedDependencies++;
336
+ console.log(`[${chalk5.blue(name)}] Unused dependency in package.json: ${chalk5.red(dep)}`);
337
+ console.log(` ${location}/package.json
338
+ `);
339
+ console.log("");
340
+ }
341
+ }
342
+ if (peerDeps) {
343
+ for (const dep of peerDependencies) {
344
+ if (!externalProdImports.includes(dep)) {
345
+ unusedDependencies++;
346
+ console.log(`[${chalk5.blue(name)}] Unused peerDependency in package.json: ${chalk5.red(dep)}`);
347
+ console.log(` ${location}/package.json
348
+ `);
349
+ console.log("");
350
+ }
351
+ }
352
+ }
353
+ if (devDeps) {
354
+ for (const imp of externalDevImports) {
355
+ if (!devDependencies.includes(imp)) {
356
+ unlistedDevDependencies++;
357
+ console.log(`[${chalk5.blue(name)}] Missing devDependency in package.json: ${chalk5.red(imp)}`);
358
+ console.log(` Found in: ${devImportPaths[imp].join(", ")}`);
359
+ }
360
+ }
361
+ }
362
+ const totalErrors = unlistedDependencies + unlistedDevDependencies + unusedDependencies;
363
+ return totalErrors;
364
+ }
365
+ var deplint = ({ pkg }) => {
366
+ if (pkg) {
367
+ const { location, name } = yarnWorkspace(pkg);
368
+ console.log(`Running Deplint for ${name}`);
369
+ check({
370
+ name,
371
+ location,
372
+ devDeps: true
373
+ });
374
+ } else {
375
+ const workspaces = yarnWorkspaces();
376
+ console.log("Deplint Started...");
377
+ let totalErrors = 0;
378
+ for (const workspace of workspaces) {
379
+ totalErrors += check(workspace);
380
+ }
381
+ if (totalErrors > 0) {
382
+ console.log(`Found ${chalk5.red(totalErrors)} unlisted imports.`);
383
+ } else {
384
+ console.log(`No unlisted imports found. ${chalk5.green("\u2714")}`);
385
+ }
386
+ }
387
+ return 0;
388
+ };
389
+
390
+ // src/actions/lint.ts
391
+ import chalk6 from "chalk";
392
+ var lintPackage = ({ pkg, fix: fix2 }) => {
393
+ console.log(chalk6.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
230
394
  const start = Date.now();
231
395
  const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
232
- [
233
- "yarn",
234
- [
235
- "workspace",
236
- pkg,
237
- "run",
238
- fix2 ? "package-fix" : "package-lint"
239
- ]
240
- ]
396
+ ["yarn", [
397
+ "workspace",
398
+ pkg,
399
+ "run",
400
+ fix2 ? "package-fix" : "package-lint"
401
+ ]]
241
402
  ]);
242
- console.log(chalk5.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk5.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk5.gray("seconds")}`));
403
+ console.log(chalk6.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk6.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk6.gray("seconds")}`));
243
404
  return result;
244
- }, "lintPackage");
245
- var lint = /* @__PURE__ */ __name(({ pkg, verbose, incremental, fix: fix2 } = {}) => {
246
- return pkg ? lintPackage({
247
- pkg,
248
- fix: fix2
249
- }) : lintAllPackages({
405
+ };
406
+ var lint = ({
407
+ pkg,
408
+ verbose,
409
+ incremental,
410
+ fix: fix2
411
+ } = {}) => {
412
+ return pkg ? lintPackage({ pkg, fix: fix2 }) : lintAllPackages({
250
413
  verbose,
251
414
  incremental,
252
415
  fix: fix2
253
416
  });
254
- }, "lint");
255
- var lintAllPackages = /* @__PURE__ */ __name(({ fix: fix2 = false } = {}) => {
256
- console.log(chalk5.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
417
+ };
418
+ var lintAllPackages = ({ fix: fix2 = false } = {}) => {
419
+ console.log(chalk6.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
257
420
  const start = Date.now();
258
- const fixOptions = fix2 ? [
259
- "--fix"
260
- ] : [];
421
+ const fixOptions = fix2 ? ["--fix"] : [];
261
422
  const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
262
- [
263
- "yarn",
264
- [
265
- "eslint",
266
- ...fixOptions
267
- ]
268
- ]
423
+ ["yarn", ["eslint", ...fixOptions]]
269
424
  ]);
270
- console.log(chalk5.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk5.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk5.gray("seconds")}`));
425
+ console.log(chalk6.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk6.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk6.gray("seconds")}`));
271
426
  return result;
272
- }, "lintAllPackages");
427
+ };
273
428
 
274
429
  // src/actions/fix.ts
275
- var fix = /* @__PURE__ */ __name((params) => {
276
- return lint({
277
- ...params,
278
- fix: true
279
- });
280
- }, "fix");
430
+ var fix = (params) => {
431
+ return lint({ ...params, fix: true });
432
+ };
281
433
 
282
434
  // src/actions/knip.ts
283
- var knip = /* @__PURE__ */ __name(() => {
284
- return runSteps("Knip", [
285
- [
286
- "yarn",
287
- [
288
- "knip",
289
- "--dependencies",
290
- "--no-exit-code"
291
- ]
292
- ]
293
- ]);
294
- }, "knip");
435
+ var knip = () => {
436
+ return runSteps("Knip", [["yarn", ["knip", "--dependencies", "--no-exit-code"]]]);
437
+ };
295
438
 
296
439
  // src/actions/publint.ts
297
- var publint = /* @__PURE__ */ __name(async ({ verbose, pkg }) => {
298
- return pkg ? await publintPackage({
299
- pkg,
300
- verbose
301
- }) : publintAll({
302
- verbose
303
- });
304
- }, "publint");
305
- var publintPackage = /* @__PURE__ */ __name(({ pkg }) => {
306
- return runStepsAsync(`Publint [${pkg}]`, [
307
- [
308
- "yarn",
309
- [
310
- "workspace",
311
- pkg,
312
- "run",
313
- "package-publint"
314
- ]
315
- ]
316
- ]);
317
- }, "publintPackage");
318
- var publintAll = /* @__PURE__ */ __name(({ verbose }) => {
319
- const verboseOptions = verbose ? [
320
- "--verbose"
321
- ] : [
322
- "--no-verbose"
323
- ];
324
- return runSteps("Publint", [
325
- [
326
- "yarn",
327
- [
328
- "workspaces",
329
- "foreach",
330
- "-pA",
331
- ...verboseOptions,
332
- "run",
333
- "package-publint"
334
- ]
335
- ]
336
- ]);
337
- }, "publintAll");
440
+ var publint = async ({ verbose, pkg }) => {
441
+ return pkg ? await publintPackage({ pkg, verbose }) : publintAll({ verbose });
442
+ };
443
+ var publintPackage = ({ pkg }) => {
444
+ return runStepsAsync(`Publint [${pkg}]`, [["yarn", ["workspace", pkg, "run", "package-publint"]]]);
445
+ };
446
+ var publintAll = ({ verbose }) => {
447
+ const verboseOptions = verbose ? ["--verbose"] : ["--no-verbose"];
448
+ return runSteps("Publint", [["yarn", ["workspaces", "foreach", "-pA", ...verboseOptions, "run", "package-publint"]]]);
449
+ };
338
450
 
339
451
  // src/actions/relint.ts
340
- import chalk6 from "chalk";
341
- var relintPackage = /* @__PURE__ */ __name(({ pkg }) => {
342
- console.log(chalk6.gray(`${"Relint"} [All-Packages]`));
452
+ import chalk7 from "chalk";
453
+ var relintPackage = ({ pkg }) => {
454
+ console.log(chalk7.gray(`${"Relint"} [All-Packages]`));
343
455
  const start = Date.now();
344
456
  const result = runSteps("Relint [All-Packages]", [
345
- [
346
- "yarn",
347
- [
348
- "workspace",
349
- pkg,
350
- "run",
351
- "package-relint"
352
- ]
353
- ]
457
+ ["yarn", [
458
+ "workspace",
459
+ pkg,
460
+ "run",
461
+ "package-relint"
462
+ ]]
354
463
  ]);
355
- console.log(chalk6.gray(`${"Relinted in"} [${chalk6.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk6.gray("seconds")}`));
464
+ console.log(chalk7.gray(`${"Relinted in"} [${chalk7.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk7.gray("seconds")}`));
356
465
  return result;
357
- }, "relintPackage");
358
- var relint = /* @__PURE__ */ __name(({ pkg, verbose, incremental } = {}) => {
359
- return pkg ? relintPackage({
360
- pkg
361
- }) : relintAllPackages({
362
- verbose,
363
- incremental
364
- });
365
- }, "relint");
366
- var relintAllPackages = /* @__PURE__ */ __name(({ verbose = true, incremental } = {}) => {
367
- console.log(chalk6.gray(`${"Relint"} [All-Packages]`));
466
+ };
467
+ var relint = ({
468
+ pkg,
469
+ verbose,
470
+ incremental
471
+ } = {}) => {
472
+ return pkg ? relintPackage({ pkg }) : relintAllPackages({ verbose, incremental });
473
+ };
474
+ var relintAllPackages = ({ verbose = true, incremental } = {}) => {
475
+ console.log(chalk7.gray(`${"Relint"} [All-Packages]`));
368
476
  const start = Date.now();
369
- const verboseOptions = verbose ? [
370
- "--verbose"
371
- ] : [
372
- "--no-verbose"
373
- ];
374
- const incrementalOptions = incremental ? [
375
- "--since",
376
- "-Ap"
377
- ] : [
378
- "--parallel",
379
- "-Ap"
380
- ];
477
+ const verboseOptions = verbose ? ["--verbose"] : ["--no-verbose"];
478
+ const incrementalOptions = incremental ? ["--since", "-Ap"] : ["--parallel", "-Ap"];
381
479
  const result = runSteps(`${"Relint"} [All-Packages]`, [
382
- [
383
- "yarn",
384
- [
385
- "workspaces",
386
- "foreach",
387
- ...verboseOptions,
388
- ...incrementalOptions,
389
- "run",
390
- "package-relint"
391
- ]
392
- ]
480
+ ["yarn", [
481
+ "workspaces",
482
+ "foreach",
483
+ ...verboseOptions,
484
+ ...incrementalOptions,
485
+ "run",
486
+ "package-relint"
487
+ ]]
393
488
  ]);
394
- console.log(chalk6.gray(`Relinted in [${chalk6.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk6.gray("seconds")}`));
489
+ console.log(chalk7.gray(`Relinted in [${chalk7.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk7.gray("seconds")}`));
395
490
  return result;
396
- }, "relintAllPackages");
491
+ };
397
492
 
398
493
  // src/actions/sonar.ts
399
- var sonar = /* @__PURE__ */ __name(() => {
400
- return runSteps("Sonar", [
401
- [
402
- "yarn",
403
- [
404
- "eslint",
405
- "-c",
406
- "sonar.eslintrc",
407
- "."
408
- ]
409
- ]
410
- ]);
411
- }, "sonar");
494
+ var sonar = () => {
495
+ return runSteps("Sonar", [["yarn", ["eslint", "-c", "sonar.eslintrc", "."]]]);
496
+ };
412
497
 
413
498
  // src/xy/param.ts
414
- var packagePositionalParam = /* @__PURE__ */ __name((yargs) => {
415
- return yargs.positional("package", {
416
- describe: "Specific package to target"
417
- });
418
- }, "packagePositionalParam");
499
+ var packagePositionalParam = (yargs) => {
500
+ return yargs.positional("package", { describe: "Specific package to target" });
501
+ };
419
502
 
420
503
  // src/xy/xyLintCommands.ts
421
- var xyLintCommands = /* @__PURE__ */ __name((args) => {
422
- return args.command("cycle [package]", "Cycle - Check for dependency cycles", (yargs) => {
423
- return packagePositionalParam(yargs);
424
- }, async (argv) => {
425
- const start = Date.now();
426
- if (argv.verbose) console.log("Cycle");
427
- process.exitCode = await cycle({
428
- pkg: argv.package
429
- });
430
- console.log(chalk7.blue(`Finished in ${Date.now() - start}ms`));
431
- }).command("lint [package]", "Lint - Run Eslint", (yargs) => {
432
- return packagePositionalParam(yargs);
433
- }, (argv) => {
434
- if (argv.verbose) console.log("Lint");
435
- const start = Date.now();
436
- process.exitCode = argv.fix ? fix({
437
- pkg: argv.package
438
- }) : lint({
439
- pkg: argv.package
440
- });
441
- console.log(chalk7.blue(`Finished in ${Date.now() - start}ms`));
442
- }).command("fix [package]", "Fix - Run Eslint w/fix", (yargs) => {
443
- return packagePositionalParam(yargs);
444
- }, (argv) => {
445
- const start = Date.now();
446
- if (argv.verbose) console.log("Fix");
447
- process.exitCode = fix();
448
- console.log(chalk7.blue(`Finished in ${Date.now() - start}ms`));
449
- }).command("relint [package]", "Relint - Clean & Lint", (yargs) => {
450
- return packagePositionalParam(yargs);
451
- }, (argv) => {
452
- if (argv.verbose) console.log("Relinting");
453
- const start = Date.now();
454
- process.exitCode = relint();
455
- console.log(chalk7.blue(`Finished in ${Date.now() - start}ms`));
456
- }).command("publint [package]", "Publint - Run Publint", (yargs) => {
457
- return packagePositionalParam(yargs);
458
- }, async (argv) => {
459
- if (argv.verbose) console.log("Publint");
460
- const start = Date.now();
461
- process.exitCode = await publint({
462
- pkg: argv.package,
463
- verbose: !!argv.verbose
464
- });
465
- console.log(chalk7.blue(`Finished in ${Date.now() - start}ms`));
466
- }).command("knip", "Knip - Run Knip", (yargs) => {
467
- return packagePositionalParam(yargs);
468
- }, (argv) => {
469
- if (argv.verbose) console.log("Knip");
470
- const start = Date.now();
471
- process.exitCode = knip();
472
- console.log(chalk7.blue(`Knip finished in ${Date.now() - start}ms`));
473
- }).command("sonar", "Sonar - Run Sonar Check", (yargs) => {
474
- return packagePositionalParam(yargs);
475
- }, (argv) => {
476
- const start = Date.now();
477
- if (argv.verbose) console.log("Sonar Check");
478
- process.exitCode = sonar();
479
- console.log(chalk7.blue(`Finished in ${Date.now() - start}ms`));
480
- });
481
- }, "xyLintCommands");
504
+ var xyLintCommands = (args) => {
505
+ return args.command(
506
+ "cycle [package]",
507
+ "Cycle - Check for dependency cycles",
508
+ (yargs) => {
509
+ return packagePositionalParam(yargs);
510
+ },
511
+ async (argv) => {
512
+ const start = Date.now();
513
+ if (argv.verbose) console.log("Cycle");
514
+ process.exitCode = await cycle({ pkg: argv.package });
515
+ console.log(chalk8.blue(`Finished in ${Date.now() - start}ms`));
516
+ }
517
+ ).command(
518
+ "lint [package]",
519
+ "Lint - Run Eslint",
520
+ (yargs) => {
521
+ return packagePositionalParam(yargs);
522
+ },
523
+ (argv) => {
524
+ if (argv.verbose) console.log("Lint");
525
+ const start = Date.now();
526
+ process.exitCode = argv.fix ? fix({ pkg: argv.package }) : lint({ pkg: argv.package });
527
+ console.log(chalk8.blue(`Finished in ${Date.now() - start}ms`));
528
+ }
529
+ ).command(
530
+ "deplint [package]",
531
+ "Deplint - Run Deplint",
532
+ (yargs) => {
533
+ return packagePositionalParam(yargs);
534
+ },
535
+ (argv) => {
536
+ if (argv.verbose) console.log("Deplint");
537
+ const start = Date.now();
538
+ process.exitCode = deplint({ pkg: argv.package });
539
+ console.log(chalk8.blue(`Finished in ${Date.now() - start}ms`));
540
+ }
541
+ ).command(
542
+ "fix [package]",
543
+ "Fix - Run Eslint w/fix",
544
+ (yargs) => {
545
+ return packagePositionalParam(yargs);
546
+ },
547
+ (argv) => {
548
+ const start = Date.now();
549
+ if (argv.verbose) console.log("Fix");
550
+ process.exitCode = fix();
551
+ console.log(chalk8.blue(`Finished in ${Date.now() - start}ms`));
552
+ }
553
+ ).command(
554
+ "relint [package]",
555
+ "Relint - Clean & Lint",
556
+ (yargs) => {
557
+ return packagePositionalParam(yargs);
558
+ },
559
+ (argv) => {
560
+ if (argv.verbose) console.log("Relinting");
561
+ const start = Date.now();
562
+ process.exitCode = relint();
563
+ console.log(chalk8.blue(`Finished in ${Date.now() - start}ms`));
564
+ }
565
+ ).command(
566
+ "publint [package]",
567
+ "Publint - Run Publint",
568
+ (yargs) => {
569
+ return packagePositionalParam(yargs);
570
+ },
571
+ async (argv) => {
572
+ if (argv.verbose) console.log("Publint");
573
+ const start = Date.now();
574
+ process.exitCode = await publint({ pkg: argv.package, verbose: !!argv.verbose });
575
+ console.log(chalk8.blue(`Finished in ${Date.now() - start}ms`));
576
+ }
577
+ ).command(
578
+ "knip",
579
+ "Knip - Run Knip",
580
+ (yargs) => {
581
+ return packagePositionalParam(yargs);
582
+ },
583
+ (argv) => {
584
+ if (argv.verbose) console.log("Knip");
585
+ const start = Date.now();
586
+ process.exitCode = knip();
587
+ console.log(chalk8.blue(`Knip finished in ${Date.now() - start}ms`));
588
+ }
589
+ ).command(
590
+ "sonar",
591
+ "Sonar - Run Sonar Check",
592
+ (yargs) => {
593
+ return packagePositionalParam(yargs);
594
+ },
595
+ (argv) => {
596
+ const start = Date.now();
597
+ if (argv.verbose) console.log("Sonar Check");
598
+ process.exitCode = sonar();
599
+ console.log(chalk8.blue(`Finished in ${Date.now() - start}ms`));
600
+ }
601
+ );
602
+ };
482
603
  export {
483
604
  xyLintCommands
484
605
  };