@xylabs/ts-scripts-yarn3 6.3.4 → 6.4.0

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 +191 -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 -50
  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 +860 -1237
  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 -44
  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 +1082 -1233
  160. package/dist/bin/xy.mjs.map +1 -1
  161. package/dist/index.d.ts +5 -1
  162. package/dist/index.mjs +1334 -1579
  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 +1082 -1234
  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 +1082 -1234
  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 +409 -288
  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 +5 -24
@@ -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,260 +214,388 @@ 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
+ }) {
309
+ const { prodSourceFiles, devSourceFiles } = findFiles(location);
310
+ const {
311
+ prodImportPaths,
312
+ devImportPaths,
313
+ externalProdImports,
314
+ externalDevImports
315
+ } = getExternalImportsFromFiles({ prodSourceFiles, devSourceFiles });
316
+ const {
317
+ dependencies,
318
+ devDependencies,
319
+ peerDependencies
320
+ } = getDependenciesFromPackageJson(`${location}/package.json`);
321
+ let unlistedDependencies = 0;
322
+ let unlistedDevDependencies = 0;
323
+ for (const imp of externalProdImports) {
324
+ if (!dependencies.includes(imp) && !peerDependencies.includes(imp)) {
325
+ unlistedDependencies++;
326
+ console.log(`[${chalk5.blue(name)}] Missing dependency in package.json: ${chalk5.red(imp)}`);
327
+ console.log(` ${prodImportPaths[imp].join("\n")}`);
328
+ console.log("");
329
+ }
330
+ }
331
+ for (const dep of dependencies) {
332
+ if (!externalProdImports.includes(dep)) {
333
+ unlistedDependencies++;
334
+ console.log(`[${chalk5.blue(name)}] Unused dependency in package.json: ${chalk5.red(dep)}`);
335
+ console.log(` ${location}/package.json
336
+ `);
337
+ console.log("");
338
+ }
339
+ }
340
+ for (const dep of peerDependencies) {
341
+ if (!externalProdImports.includes(dep)) {
342
+ unlistedDependencies++;
343
+ console.log(`[${chalk5.blue(name)}] Unused peerDependency in package.json: ${chalk5.red(dep)}`);
344
+ console.log(` ${location}/package.json
345
+ `);
346
+ console.log("");
347
+ }
348
+ }
349
+ if (devDeps) {
350
+ for (const imp of externalDevImports) {
351
+ if (!devDependencies.includes(imp)) {
352
+ unlistedDevDependencies++;
353
+ console.log(`[${chalk5.blue(name)}] Missing devDependency in package.json: ${chalk5.red(imp)}`);
354
+ console.log(` Found in: ${devImportPaths[imp].join(", ")}`);
355
+ }
356
+ }
357
+ }
358
+ const totalErrors = unlistedDependencies + unlistedDevDependencies;
359
+ return totalErrors;
360
+ }
361
+ var deplint = ({ pkg }) => {
362
+ if (pkg) {
363
+ const { location, name } = yarnWorkspace(pkg);
364
+ console.log(`Running Deplint for ${name}`);
365
+ check({
366
+ name,
367
+ location,
368
+ devDeps: true
369
+ });
370
+ } else {
371
+ const workspaces = yarnWorkspaces();
372
+ console.log("Deplint Started...");
373
+ let totalErrors = 0;
374
+ for (const workspace of workspaces) {
375
+ totalErrors += check(workspace);
376
+ }
377
+ if (totalErrors > 0) {
378
+ console.log(`Found ${chalk5.red(totalErrors)} unlisted imports.`);
379
+ } else {
380
+ console.log(`No unlisted imports found. ${chalk5.green("\u2714")}`);
381
+ }
382
+ }
383
+ return 0;
384
+ };
385
+
386
+ // src/actions/lint.ts
387
+ import chalk6 from "chalk";
388
+ var lintPackage = ({ pkg, fix: fix2 }) => {
389
+ console.log(chalk6.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
230
390
  const start = Date.now();
231
391
  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
- ]
392
+ ["yarn", [
393
+ "workspace",
394
+ pkg,
395
+ "run",
396
+ fix2 ? "package-fix" : "package-lint"
397
+ ]]
241
398
  ]);
242
- console.log(chalk5.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk5.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk5.gray("seconds")}`));
399
+ console.log(chalk6.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk6.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk6.gray("seconds")}`));
243
400
  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({
401
+ };
402
+ var lint = ({
403
+ pkg,
404
+ verbose,
405
+ incremental,
406
+ fix: fix2
407
+ } = {}) => {
408
+ return pkg ? lintPackage({ pkg, fix: fix2 }) : lintAllPackages({
250
409
  verbose,
251
410
  incremental,
252
411
  fix: fix2
253
412
  });
254
- }, "lint");
255
- var lintAllPackages = /* @__PURE__ */ __name(({ fix: fix2 = false } = {}) => {
256
- console.log(chalk5.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
413
+ };
414
+ var lintAllPackages = ({ fix: fix2 = false } = {}) => {
415
+ console.log(chalk6.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
257
416
  const start = Date.now();
417
+ const fixOptions = fix2 ? ["--fix"] : [];
258
418
  const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
259
- [
260
- "yarn",
261
- [
262
- "eslint"
263
- ]
264
- ]
419
+ ["yarn", ["eslint", ...fixOptions]]
265
420
  ]);
266
- console.log(chalk5.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk5.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk5.gray("seconds")}`));
421
+ console.log(chalk6.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk6.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk6.gray("seconds")}`));
267
422
  return result;
268
- }, "lintAllPackages");
423
+ };
269
424
 
270
425
  // src/actions/fix.ts
271
- var fix = /* @__PURE__ */ __name((params) => {
272
- return lint({
273
- ...params,
274
- fix: true
275
- });
276
- }, "fix");
426
+ var fix = (params) => {
427
+ return lint({ ...params, fix: true });
428
+ };
277
429
 
278
430
  // src/actions/knip.ts
279
- var knip = /* @__PURE__ */ __name(() => {
280
- return runSteps("Knip", [
281
- [
282
- "yarn",
283
- [
284
- "knip",
285
- "--dependencies",
286
- "--no-exit-code"
287
- ]
288
- ]
289
- ]);
290
- }, "knip");
431
+ var knip = () => {
432
+ return runSteps("Knip", [["yarn", ["knip", "--dependencies", "--no-exit-code"]]]);
433
+ };
291
434
 
292
435
  // src/actions/publint.ts
293
- var publint = /* @__PURE__ */ __name(async ({ verbose, pkg }) => {
294
- return pkg ? await publintPackage({
295
- pkg,
296
- verbose
297
- }) : publintAll({
298
- verbose
299
- });
300
- }, "publint");
301
- var publintPackage = /* @__PURE__ */ __name(({ pkg }) => {
302
- return runStepsAsync(`Publint [${pkg}]`, [
303
- [
304
- "yarn",
305
- [
306
- "workspace",
307
- pkg,
308
- "run",
309
- "package-publint"
310
- ]
311
- ]
312
- ]);
313
- }, "publintPackage");
314
- var publintAll = /* @__PURE__ */ __name(({ verbose }) => {
315
- const verboseOptions = verbose ? [
316
- "--verbose"
317
- ] : [
318
- "--no-verbose"
319
- ];
320
- return runSteps("Publint", [
321
- [
322
- "yarn",
323
- [
324
- "workspaces",
325
- "foreach",
326
- "-pA",
327
- ...verboseOptions,
328
- "run",
329
- "package-publint"
330
- ]
331
- ]
332
- ]);
333
- }, "publintAll");
436
+ var publint = async ({ verbose, pkg }) => {
437
+ return pkg ? await publintPackage({ pkg, verbose }) : publintAll({ verbose });
438
+ };
439
+ var publintPackage = ({ pkg }) => {
440
+ return runStepsAsync(`Publint [${pkg}]`, [["yarn", ["workspace", pkg, "run", "package-publint"]]]);
441
+ };
442
+ var publintAll = ({ verbose }) => {
443
+ const verboseOptions = verbose ? ["--verbose"] : ["--no-verbose"];
444
+ return runSteps("Publint", [["yarn", ["workspaces", "foreach", "-pA", ...verboseOptions, "run", "package-publint"]]]);
445
+ };
334
446
 
335
447
  // src/actions/relint.ts
336
- import chalk6 from "chalk";
337
- var relintPackage = /* @__PURE__ */ __name(({ pkg }) => {
338
- console.log(chalk6.gray(`${"Relint"} [All-Packages]`));
448
+ import chalk7 from "chalk";
449
+ var relintPackage = ({ pkg }) => {
450
+ console.log(chalk7.gray(`${"Relint"} [All-Packages]`));
339
451
  const start = Date.now();
340
452
  const result = runSteps("Relint [All-Packages]", [
341
- [
342
- "yarn",
343
- [
344
- "workspace",
345
- pkg,
346
- "run",
347
- "package-relint"
348
- ]
349
- ]
453
+ ["yarn", [
454
+ "workspace",
455
+ pkg,
456
+ "run",
457
+ "package-relint"
458
+ ]]
350
459
  ]);
351
- console.log(chalk6.gray(`${"Relinted in"} [${chalk6.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk6.gray("seconds")}`));
460
+ console.log(chalk7.gray(`${"Relinted in"} [${chalk7.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk7.gray("seconds")}`));
352
461
  return result;
353
- }, "relintPackage");
354
- var relint = /* @__PURE__ */ __name(({ pkg, verbose, incremental } = {}) => {
355
- return pkg ? relintPackage({
356
- pkg
357
- }) : relintAllPackages({
358
- verbose,
359
- incremental
360
- });
361
- }, "relint");
362
- var relintAllPackages = /* @__PURE__ */ __name(({ verbose = true, incremental } = {}) => {
363
- console.log(chalk6.gray(`${"Relint"} [All-Packages]`));
462
+ };
463
+ var relint = ({
464
+ pkg,
465
+ verbose,
466
+ incremental
467
+ } = {}) => {
468
+ return pkg ? relintPackage({ pkg }) : relintAllPackages({ verbose, incremental });
469
+ };
470
+ var relintAllPackages = ({ verbose = true, incremental } = {}) => {
471
+ console.log(chalk7.gray(`${"Relint"} [All-Packages]`));
364
472
  const start = Date.now();
365
- const verboseOptions = verbose ? [
366
- "--verbose"
367
- ] : [
368
- "--no-verbose"
369
- ];
370
- const incrementalOptions = incremental ? [
371
- "--since",
372
- "-Ap"
373
- ] : [
374
- "--parallel",
375
- "-Ap"
376
- ];
473
+ const verboseOptions = verbose ? ["--verbose"] : ["--no-verbose"];
474
+ const incrementalOptions = incremental ? ["--since", "-Ap"] : ["--parallel", "-Ap"];
377
475
  const result = runSteps(`${"Relint"} [All-Packages]`, [
378
- [
379
- "yarn",
380
- [
381
- "workspaces",
382
- "foreach",
383
- ...verboseOptions,
384
- ...incrementalOptions,
385
- "run",
386
- "package-relint"
387
- ]
388
- ]
476
+ ["yarn", [
477
+ "workspaces",
478
+ "foreach",
479
+ ...verboseOptions,
480
+ ...incrementalOptions,
481
+ "run",
482
+ "package-relint"
483
+ ]]
389
484
  ]);
390
- console.log(chalk6.gray(`Relinted in [${chalk6.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk6.gray("seconds")}`));
485
+ console.log(chalk7.gray(`Relinted in [${chalk7.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk7.gray("seconds")}`));
391
486
  return result;
392
- }, "relintAllPackages");
487
+ };
393
488
 
394
489
  // src/actions/sonar.ts
395
- var sonar = /* @__PURE__ */ __name(() => {
396
- return runSteps("Sonar", [
397
- [
398
- "yarn",
399
- [
400
- "eslint",
401
- "-c",
402
- "sonar.eslintrc",
403
- "."
404
- ]
405
- ]
406
- ]);
407
- }, "sonar");
490
+ var sonar = () => {
491
+ return runSteps("Sonar", [["yarn", ["eslint", "-c", "sonar.eslintrc", "."]]]);
492
+ };
408
493
 
409
494
  // src/xy/param.ts
410
- var packagePositionalParam = /* @__PURE__ */ __name((yargs) => {
411
- return yargs.positional("package", {
412
- describe: "Specific package to target"
413
- });
414
- }, "packagePositionalParam");
495
+ var packagePositionalParam = (yargs) => {
496
+ return yargs.positional("package", { describe: "Specific package to target" });
497
+ };
415
498
 
416
499
  // src/xy/xyLintCommands.ts
417
- var xyLintCommands = /* @__PURE__ */ __name((args) => {
418
- return args.command("cycle [package]", "Cycle - Check for dependency cycles", (yargs) => {
419
- return packagePositionalParam(yargs);
420
- }, async (argv) => {
421
- const start = Date.now();
422
- if (argv.verbose) console.log("Cycle");
423
- process.exitCode = await cycle({
424
- pkg: argv.package
425
- });
426
- console.log(chalk7.blue(`Finished in ${Date.now() - start}ms`));
427
- }).command("lint [package]", "Lint - Run Eslint", (yargs) => {
428
- return packagePositionalParam(yargs);
429
- }, (argv) => {
430
- if (argv.verbose) console.log("Lint");
431
- const start = Date.now();
432
- process.exitCode = argv.fix ? fix({
433
- pkg: argv.package
434
- }) : lint({
435
- pkg: argv.package
436
- });
437
- console.log(chalk7.blue(`Finished in ${Date.now() - start}ms`));
438
- }).command("fix [package]", "Fix - Run Eslint w/fix", (yargs) => {
439
- return packagePositionalParam(yargs);
440
- }, (argv) => {
441
- const start = Date.now();
442
- if (argv.verbose) console.log("Fix");
443
- process.exitCode = fix();
444
- console.log(chalk7.blue(`Finished in ${Date.now() - start}ms`));
445
- }).command("relint [package]", "Relint - Clean & Lint", (yargs) => {
446
- return packagePositionalParam(yargs);
447
- }, (argv) => {
448
- if (argv.verbose) console.log("Relinting");
449
- const start = Date.now();
450
- process.exitCode = relint();
451
- console.log(chalk7.blue(`Finished in ${Date.now() - start}ms`));
452
- }).command("publint [package]", "Publint - Run Publint", (yargs) => {
453
- return packagePositionalParam(yargs);
454
- }, async (argv) => {
455
- if (argv.verbose) console.log("Publint");
456
- const start = Date.now();
457
- process.exitCode = await publint({
458
- pkg: argv.package,
459
- verbose: !!argv.verbose
460
- });
461
- console.log(chalk7.blue(`Finished in ${Date.now() - start}ms`));
462
- }).command("knip", "Knip - Run Knip", (yargs) => {
463
- return packagePositionalParam(yargs);
464
- }, (argv) => {
465
- if (argv.verbose) console.log("Knip");
466
- const start = Date.now();
467
- process.exitCode = knip();
468
- console.log(chalk7.blue(`Knip finished in ${Date.now() - start}ms`));
469
- }).command("sonar", "Sonar - Run Sonar Check", (yargs) => {
470
- return packagePositionalParam(yargs);
471
- }, (argv) => {
472
- const start = Date.now();
473
- if (argv.verbose) console.log("Sonar Check");
474
- process.exitCode = sonar();
475
- console.log(chalk7.blue(`Finished in ${Date.now() - start}ms`));
476
- });
477
- }, "xyLintCommands");
500
+ var xyLintCommands = (args) => {
501
+ return args.command(
502
+ "cycle [package]",
503
+ "Cycle - Check for dependency cycles",
504
+ (yargs) => {
505
+ return packagePositionalParam(yargs);
506
+ },
507
+ async (argv) => {
508
+ const start = Date.now();
509
+ if (argv.verbose) console.log("Cycle");
510
+ process.exitCode = await cycle({ pkg: argv.package });
511
+ console.log(chalk8.blue(`Finished in ${Date.now() - start}ms`));
512
+ }
513
+ ).command(
514
+ "lint [package]",
515
+ "Lint - Run Eslint",
516
+ (yargs) => {
517
+ return packagePositionalParam(yargs);
518
+ },
519
+ (argv) => {
520
+ if (argv.verbose) console.log("Lint");
521
+ const start = Date.now();
522
+ process.exitCode = argv.fix ? fix({ pkg: argv.package }) : lint({ pkg: argv.package });
523
+ console.log(chalk8.blue(`Finished in ${Date.now() - start}ms`));
524
+ }
525
+ ).command(
526
+ "deplint [package]",
527
+ "Deplint - Run Deplint",
528
+ (yargs) => {
529
+ return packagePositionalParam(yargs);
530
+ },
531
+ (argv) => {
532
+ if (argv.verbose) console.log("Deplint");
533
+ const start = Date.now();
534
+ process.exitCode = deplint({ pkg: argv.package });
535
+ console.log(chalk8.blue(`Finished in ${Date.now() - start}ms`));
536
+ }
537
+ ).command(
538
+ "fix [package]",
539
+ "Fix - Run Eslint w/fix",
540
+ (yargs) => {
541
+ return packagePositionalParam(yargs);
542
+ },
543
+ (argv) => {
544
+ const start = Date.now();
545
+ if (argv.verbose) console.log("Fix");
546
+ process.exitCode = fix();
547
+ console.log(chalk8.blue(`Finished in ${Date.now() - start}ms`));
548
+ }
549
+ ).command(
550
+ "relint [package]",
551
+ "Relint - Clean & Lint",
552
+ (yargs) => {
553
+ return packagePositionalParam(yargs);
554
+ },
555
+ (argv) => {
556
+ if (argv.verbose) console.log("Relinting");
557
+ const start = Date.now();
558
+ process.exitCode = relint();
559
+ console.log(chalk8.blue(`Finished in ${Date.now() - start}ms`));
560
+ }
561
+ ).command(
562
+ "publint [package]",
563
+ "Publint - Run Publint",
564
+ (yargs) => {
565
+ return packagePositionalParam(yargs);
566
+ },
567
+ async (argv) => {
568
+ if (argv.verbose) console.log("Publint");
569
+ const start = Date.now();
570
+ process.exitCode = await publint({ pkg: argv.package, verbose: !!argv.verbose });
571
+ console.log(chalk8.blue(`Finished in ${Date.now() - start}ms`));
572
+ }
573
+ ).command(
574
+ "knip",
575
+ "Knip - Run Knip",
576
+ (yargs) => {
577
+ return packagePositionalParam(yargs);
578
+ },
579
+ (argv) => {
580
+ if (argv.verbose) console.log("Knip");
581
+ const start = Date.now();
582
+ process.exitCode = knip();
583
+ console.log(chalk8.blue(`Knip finished in ${Date.now() - start}ms`));
584
+ }
585
+ ).command(
586
+ "sonar",
587
+ "Sonar - Run Sonar Check",
588
+ (yargs) => {
589
+ return packagePositionalParam(yargs);
590
+ },
591
+ (argv) => {
592
+ const start = Date.now();
593
+ if (argv.verbose) console.log("Sonar Check");
594
+ process.exitCode = sonar();
595
+ console.log(chalk8.blue(`Finished in ${Date.now() - start}ms`));
596
+ }
597
+ );
598
+ };
478
599
  export {
479
600
  xyLintCommands
480
601
  };