@xylabs/ts-scripts-yarn3 3.15.15 → 4.0.0-rc.4

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 (335) hide show
  1. package/dist/actions/index.mjs +55 -186
  2. package/dist/actions/index.mjs.map +1 -1
  3. package/dist/actions/package/compile/compile.mjs +55 -186
  4. package/dist/actions/package/compile/compile.mjs.map +1 -1
  5. package/dist/actions/package/compile/index.mjs +55 -186
  6. package/dist/actions/package/compile/index.mjs.map +1 -1
  7. package/dist/actions/package/compile/packageCompileTsc.mjs +1 -1
  8. package/dist/actions/package/compile/packageCompileTsc.mjs.map +1 -1
  9. package/dist/actions/package/compile/packageCompileTscTypes.mjs +2 -36
  10. package/dist/actions/package/compile/packageCompileTscTypes.mjs.map +1 -1
  11. package/dist/actions/package/compile/packageCompileTsup.mjs +55 -186
  12. package/dist/actions/package/compile/packageCompileTsup.mjs.map +1 -1
  13. package/dist/actions/package/index.mjs +55 -186
  14. package/dist/actions/package/index.mjs.map +1 -1
  15. package/dist/actions/package/recompile.mjs +55 -186
  16. package/dist/actions/package/recompile.mjs.map +1 -1
  17. package/dist/bin/package/compile-only.mjs +55 -186
  18. package/dist/bin/package/compile-only.mjs.map +1 -1
  19. package/dist/bin/package/compile-tsup.mjs +55 -186
  20. package/dist/bin/package/compile-tsup.mjs.map +1 -1
  21. package/dist/bin/package/compile.mjs +55 -186
  22. package/dist/bin/package/compile.mjs.map +1 -1
  23. package/dist/bin/package/recompile.mjs +55 -186
  24. package/dist/bin/package/recompile.mjs.map +1 -1
  25. package/dist/index.mjs +55 -186
  26. package/dist/index.mjs.map +1 -1
  27. package/package.json +9 -19
  28. package/src/actions/package/compile/XyConfig.ts +2 -2
  29. package/src/actions/package/compile/packageCompileTsc.ts +1 -1
  30. package/src/actions/package/compile/packageCompileTscTypes.ts +3 -8
  31. package/src/actions/package/compile/packageCompileTsup.ts +51 -121
  32. package/tsup.config.ts +1 -1
  33. package/dist/actions/build.cjs +0 -208
  34. package/dist/actions/build.cjs.map +0 -1
  35. package/dist/actions/clean-docs.cjs +0 -74
  36. package/dist/actions/clean-docs.cjs.map +0 -1
  37. package/dist/actions/clean-eslint.cjs +0 -53
  38. package/dist/actions/clean-eslint.cjs.map +0 -1
  39. package/dist/actions/clean-jest.cjs +0 -147
  40. package/dist/actions/clean-jest.cjs.map +0 -1
  41. package/dist/actions/clean.cjs +0 -192
  42. package/dist/actions/clean.cjs.map +0 -1
  43. package/dist/actions/compile.cjs +0 -217
  44. package/dist/actions/compile.cjs.map +0 -1
  45. package/dist/actions/copy-assets.cjs +0 -121
  46. package/dist/actions/copy-assets.cjs.map +0 -1
  47. package/dist/actions/cycle.cjs +0 -156
  48. package/dist/actions/cycle.cjs.map +0 -1
  49. package/dist/actions/dead.cjs +0 -148
  50. package/dist/actions/dead.cjs.map +0 -1
  51. package/dist/actions/deploy-major.cjs +0 -160
  52. package/dist/actions/deploy-major.cjs.map +0 -1
  53. package/dist/actions/deploy-minor.cjs +0 -160
  54. package/dist/actions/deploy-minor.cjs.map +0 -1
  55. package/dist/actions/deploy-next.cjs +0 -160
  56. package/dist/actions/deploy-next.cjs.map +0 -1
  57. package/dist/actions/deploy.cjs +0 -160
  58. package/dist/actions/deploy.cjs.map +0 -1
  59. package/dist/actions/deps.cjs +0 -205
  60. package/dist/actions/deps.cjs.map +0 -1
  61. package/dist/actions/dupdeps.cjs +0 -226
  62. package/dist/actions/dupdeps.cjs.map +0 -1
  63. package/dist/actions/fix.cjs +0 -149
  64. package/dist/actions/fix.cjs.map +0 -1
  65. package/dist/actions/gen-docs.cjs +0 -186
  66. package/dist/actions/gen-docs.cjs.map +0 -1
  67. package/dist/actions/gitignore-gen.cjs +0 -138
  68. package/dist/actions/gitignore-gen.cjs.map +0 -1
  69. package/dist/actions/gitlint-fix.cjs +0 -69
  70. package/dist/actions/gitlint-fix.cjs.map +0 -1
  71. package/dist/actions/gitlint.cjs +0 -84
  72. package/dist/actions/gitlint.cjs.map +0 -1
  73. package/dist/actions/index.cjs +0 -2600
  74. package/dist/actions/index.cjs.map +0 -1
  75. package/dist/actions/license.cjs +0 -133
  76. package/dist/actions/license.cjs.map +0 -1
  77. package/dist/actions/lint-clean.cjs +0 -227
  78. package/dist/actions/lint-clean.cjs.map +0 -1
  79. package/dist/actions/lint-profile.cjs +0 -153
  80. package/dist/actions/lint-profile.cjs.map +0 -1
  81. package/dist/actions/lint.cjs +0 -217
  82. package/dist/actions/lint.cjs.map +0 -1
  83. package/dist/actions/npmignore-gen.cjs +0 -138
  84. package/dist/actions/npmignore-gen.cjs.map +0 -1
  85. package/dist/actions/package/clean-outputs.cjs +0 -56
  86. package/dist/actions/package/clean-outputs.cjs.map +0 -1
  87. package/dist/actions/package/clean-typescript.cjs +0 -56
  88. package/dist/actions/package/clean-typescript.cjs.map +0 -1
  89. package/dist/actions/package/clean.cjs +0 -83
  90. package/dist/actions/package/clean.cjs.map +0 -1
  91. package/dist/actions/package/compile/XyConfig.cjs +0 -19
  92. package/dist/actions/package/compile/XyConfig.cjs.map +0 -1
  93. package/dist/actions/package/compile/buildEntries.cjs +0 -68
  94. package/dist/actions/package/compile/buildEntries.cjs.map +0 -1
  95. package/dist/actions/package/compile/compile.cjs +0 -565
  96. package/dist/actions/package/compile/compile.cjs.map +0 -1
  97. package/dist/actions/package/compile/copyTypeFiles.cjs +0 -60
  98. package/dist/actions/package/compile/copyTypeFiles.cjs.map +0 -1
  99. package/dist/actions/package/compile/getCompilerOptions.cjs +0 -67
  100. package/dist/actions/package/compile/getCompilerOptions.cjs.map +0 -1
  101. package/dist/actions/package/compile/index.cjs +0 -571
  102. package/dist/actions/package/compile/index.cjs.map +0 -1
  103. package/dist/actions/package/compile/inputs.cjs +0 -79
  104. package/dist/actions/package/compile/inputs.cjs.map +0 -1
  105. package/dist/actions/package/compile/packageCompileTsc.cjs +0 -164
  106. package/dist/actions/package/compile/packageCompileTsc.cjs.map +0 -1
  107. package/dist/actions/package/compile/packageCompileTscTypes.cjs +0 -199
  108. package/dist/actions/package/compile/packageCompileTscTypes.cjs.map +0 -1
  109. package/dist/actions/package/compile/packageCompileTsup.cjs +0 -521
  110. package/dist/actions/package/compile/packageCompileTsup.cjs.map +0 -1
  111. package/dist/actions/package/copy-assets.cjs +0 -88
  112. package/dist/actions/package/copy-assets.cjs.map +0 -1
  113. package/dist/actions/package/deps.cjs +0 -214
  114. package/dist/actions/package/deps.cjs.map +0 -1
  115. package/dist/actions/package/gen-docs.cjs +0 -148
  116. package/dist/actions/package/gen-docs.cjs.map +0 -1
  117. package/dist/actions/package/index.cjs +0 -968
  118. package/dist/actions/package/index.cjs.map +0 -1
  119. package/dist/actions/package/publint.cjs +0 -80
  120. package/dist/actions/package/publint.cjs.map +0 -1
  121. package/dist/actions/package/recompile.cjs +0 -617
  122. package/dist/actions/package/recompile.cjs.map +0 -1
  123. package/dist/actions/publint.cjs +0 -237
  124. package/dist/actions/publint.cjs.map +0 -1
  125. package/dist/actions/rebuild.cjs +0 -148
  126. package/dist/actions/rebuild.cjs.map +0 -1
  127. package/dist/actions/recompile.cjs +0 -232
  128. package/dist/actions/recompile.cjs.map +0 -1
  129. package/dist/actions/reinstall.cjs +0 -183
  130. package/dist/actions/reinstall.cjs.map +0 -1
  131. package/dist/actions/relint.cjs +0 -185
  132. package/dist/actions/relint.cjs.map +0 -1
  133. package/dist/actions/retest.cjs +0 -154
  134. package/dist/actions/retest.cjs.map +0 -1
  135. package/dist/actions/sonar.cjs +0 -149
  136. package/dist/actions/sonar.cjs.map +0 -1
  137. package/dist/actions/statics.cjs +0 -234
  138. package/dist/actions/statics.cjs.map +0 -1
  139. package/dist/actions/test.cjs +0 -147
  140. package/dist/actions/test.cjs.map +0 -1
  141. package/dist/actions/up.cjs +0 -144
  142. package/dist/actions/up.cjs.map +0 -1
  143. package/dist/actions/updo.cjs +0 -152
  144. package/dist/actions/updo.cjs.map +0 -1
  145. package/dist/actions/upplug.cjs +0 -172
  146. package/dist/actions/upplug.cjs.map +0 -1
  147. package/dist/actions/upyarn.cjs +0 -148
  148. package/dist/actions/upyarn.cjs.map +0 -1
  149. package/dist/actions/yarn3only.cjs +0 -106
  150. package/dist/actions/yarn3only.cjs.map +0 -1
  151. package/dist/bin/build.cjs +0 -39
  152. package/dist/bin/build.cjs.map +0 -1
  153. package/dist/bin/clean.cjs +0 -39
  154. package/dist/bin/clean.cjs.map +0 -1
  155. package/dist/bin/compile-only.cjs +0 -39
  156. package/dist/bin/compile-only.cjs.map +0 -1
  157. package/dist/bin/compile.cjs +0 -39
  158. package/dist/bin/compile.cjs.map +0 -1
  159. package/dist/bin/cycle.cjs +0 -39
  160. package/dist/bin/cycle.cjs.map +0 -1
  161. package/dist/bin/dead.cjs +0 -39
  162. package/dist/bin/dead.cjs.map +0 -1
  163. package/dist/bin/deploy-major.cjs +0 -39
  164. package/dist/bin/deploy-major.cjs.map +0 -1
  165. package/dist/bin/deploy-minor.cjs +0 -39
  166. package/dist/bin/deploy-minor.cjs.map +0 -1
  167. package/dist/bin/deploy-next.cjs +0 -39
  168. package/dist/bin/deploy-next.cjs.map +0 -1
  169. package/dist/bin/deploy.cjs +0 -39
  170. package/dist/bin/deploy.cjs.map +0 -1
  171. package/dist/bin/deps.cjs +0 -39
  172. package/dist/bin/deps.cjs.map +0 -1
  173. package/dist/bin/fix.cjs +0 -39
  174. package/dist/bin/fix.cjs.map +0 -1
  175. package/dist/bin/gen-docs.cjs +0 -39
  176. package/dist/bin/gen-docs.cjs.map +0 -1
  177. package/dist/bin/gitlint-fix.cjs +0 -39
  178. package/dist/bin/gitlint-fix.cjs.map +0 -1
  179. package/dist/bin/gitlint.cjs +0 -39
  180. package/dist/bin/gitlint.cjs.map +0 -1
  181. package/dist/bin/license.cjs +0 -39
  182. package/dist/bin/license.cjs.map +0 -1
  183. package/dist/bin/lint-clean.cjs +0 -39
  184. package/dist/bin/lint-clean.cjs.map +0 -1
  185. package/dist/bin/lint-fast.cjs +0 -39
  186. package/dist/bin/lint-fast.cjs.map +0 -1
  187. package/dist/bin/lint-profile.cjs +0 -39
  188. package/dist/bin/lint-profile.cjs.map +0 -1
  189. package/dist/bin/lint.cjs +0 -39
  190. package/dist/bin/lint.cjs.map +0 -1
  191. package/dist/bin/package/clean-outputs.cjs +0 -51
  192. package/dist/bin/package/clean-outputs.cjs.map +0 -1
  193. package/dist/bin/package/clean-typescript.cjs +0 -51
  194. package/dist/bin/package/clean-typescript.cjs.map +0 -1
  195. package/dist/bin/package/clean.cjs +0 -76
  196. package/dist/bin/package/clean.cjs.map +0 -1
  197. package/dist/bin/package/compile-only.cjs +0 -564
  198. package/dist/bin/package/compile-only.cjs.map +0 -1
  199. package/dist/bin/package/compile-tsup.cjs +0 -519
  200. package/dist/bin/package/compile-tsup.cjs.map +0 -1
  201. package/dist/bin/package/compile.cjs +0 -567
  202. package/dist/bin/package/compile.cjs.map +0 -1
  203. package/dist/bin/package/copy-assets-cjs.cjs +0 -86
  204. package/dist/bin/package/copy-assets-cjs.cjs.map +0 -1
  205. package/dist/bin/package/copy-assets-esm.cjs +0 -86
  206. package/dist/bin/package/copy-assets-esm.cjs.map +0 -1
  207. package/dist/bin/package/deps.cjs +0 -208
  208. package/dist/bin/package/deps.cjs.map +0 -1
  209. package/dist/bin/package/gen-docs.cjs +0 -143
  210. package/dist/bin/package/gen-docs.cjs.map +0 -1
  211. package/dist/bin/package/publint.cjs +0 -77
  212. package/dist/bin/package/publint.cjs.map +0 -1
  213. package/dist/bin/package/recompile.cjs +0 -611
  214. package/dist/bin/package/recompile.cjs.map +0 -1
  215. package/dist/bin/publint.cjs +0 -39
  216. package/dist/bin/publint.cjs.map +0 -1
  217. package/dist/bin/rebuild.cjs +0 -39
  218. package/dist/bin/rebuild.cjs.map +0 -1
  219. package/dist/bin/recompile.cjs +0 -39
  220. package/dist/bin/recompile.cjs.map +0 -1
  221. package/dist/bin/reinstall.cjs +0 -39
  222. package/dist/bin/reinstall.cjs.map +0 -1
  223. package/dist/bin/relint.cjs +0 -39
  224. package/dist/bin/relint.cjs.map +0 -1
  225. package/dist/bin/sonar.cjs +0 -39
  226. package/dist/bin/sonar.cjs.map +0 -1
  227. package/dist/bin/test.cjs +0 -39
  228. package/dist/bin/test.cjs.map +0 -1
  229. package/dist/bin/up.cjs +0 -39
  230. package/dist/bin/up.cjs.map +0 -1
  231. package/dist/bin/updo.cjs +0 -39
  232. package/dist/bin/updo.cjs.map +0 -1
  233. package/dist/bin/upplug.cjs +0 -39
  234. package/dist/bin/upplug.cjs.map +0 -1
  235. package/dist/bin/upyarn.cjs +0 -39
  236. package/dist/bin/upyarn.cjs.map +0 -1
  237. package/dist/bin/xy-ts.cjs +0 -1890
  238. package/dist/bin/xy-ts.cjs.map +0 -1
  239. package/dist/bin/xy.cjs +0 -1890
  240. package/dist/bin/xy.cjs.map +0 -1
  241. package/dist/bin/yarn3only.cjs +0 -39
  242. package/dist/bin/yarn3only.cjs.map +0 -1
  243. package/dist/index.cjs +0 -3129
  244. package/dist/index.cjs.map +0 -1
  245. package/dist/index.d.cts +0 -359
  246. package/dist/lib/checkResult.cjs +0 -52
  247. package/dist/lib/checkResult.cjs.map +0 -1
  248. package/dist/lib/createBuildConfig.cjs +0 -93
  249. package/dist/lib/createBuildConfig.cjs.map +0 -1
  250. package/dist/lib/defaultBuildConfig.cjs +0 -52
  251. package/dist/lib/defaultBuildConfig.cjs.map +0 -1
  252. package/dist/lib/dependencies/DuplicateDetector.cjs +0 -124
  253. package/dist/lib/dependencies/DuplicateDetector.cjs.map +0 -1
  254. package/dist/lib/dependencies/detectDuplicateDependencies.cjs +0 -207
  255. package/dist/lib/dependencies/detectDuplicateDependencies.cjs.map +0 -1
  256. package/dist/lib/dependencies/index.cjs +0 -211
  257. package/dist/lib/dependencies/index.cjs.map +0 -1
  258. package/dist/lib/file/ReadFileSyncOptions.cjs +0 -33
  259. package/dist/lib/file/ReadFileSyncOptions.cjs.map +0 -1
  260. package/dist/lib/file/constants.cjs +0 -34
  261. package/dist/lib/file/constants.cjs.map +0 -1
  262. package/dist/lib/file/fileLines.cjs +0 -58
  263. package/dist/lib/file/fileLines.cjs.map +0 -1
  264. package/dist/lib/file/index.cjs +0 -74
  265. package/dist/lib/file/index.cjs.map +0 -1
  266. package/dist/lib/file/tryReadFileSync.cjs +0 -42
  267. package/dist/lib/file/tryReadFileSync.cjs.map +0 -1
  268. package/dist/lib/generateIgnoreFiles.cjs +0 -132
  269. package/dist/lib/generateIgnoreFiles.cjs.map +0 -1
  270. package/dist/lib/index.cjs +0 -614
  271. package/dist/lib/index.cjs.map +0 -1
  272. package/dist/lib/jsonFormatters.cjs +0 -37
  273. package/dist/lib/jsonFormatters.cjs.map +0 -1
  274. package/dist/lib/loadConfig.cjs +0 -59
  275. package/dist/lib/loadConfig.cjs.map +0 -1
  276. package/dist/lib/parsedPackageJSON.cjs +0 -37
  277. package/dist/lib/parsedPackageJSON.cjs.map +0 -1
  278. package/dist/lib/processEx.cjs +0 -72
  279. package/dist/lib/processEx.cjs.map +0 -1
  280. package/dist/lib/runSteps.cjs +0 -134
  281. package/dist/lib/runSteps.cjs.map +0 -1
  282. package/dist/lib/runStepsAsync.cjs +0 -147
  283. package/dist/lib/runStepsAsync.cjs.map +0 -1
  284. package/dist/lib/runXy.cjs +0 -150
  285. package/dist/lib/runXy.cjs.map +0 -1
  286. package/dist/lib/runXyWithWarning.cjs +0 -49
  287. package/dist/lib/runXyWithWarning.cjs.map +0 -1
  288. package/dist/lib/safeExit.cjs +0 -100
  289. package/dist/lib/safeExit.cjs.map +0 -1
  290. package/dist/lib/string/empty.cjs +0 -35
  291. package/dist/lib/string/empty.cjs.map +0 -1
  292. package/dist/lib/string/index.cjs +0 -45
  293. package/dist/lib/string/index.cjs.map +0 -1
  294. package/dist/lib/string/union.cjs +0 -35
  295. package/dist/lib/string/union.cjs.map +0 -1
  296. package/dist/lib/withErrnoException.cjs +0 -41
  297. package/dist/lib/withErrnoException.cjs.map +0 -1
  298. package/dist/lib/withError.cjs +0 -34
  299. package/dist/lib/withError.cjs.map +0 -1
  300. package/dist/lib/yarn/index.cjs +0 -93
  301. package/dist/lib/yarn/index.cjs.map +0 -1
  302. package/dist/lib/yarn/isYarnVersionOrGreater.cjs +0 -52
  303. package/dist/lib/yarn/isYarnVersionOrGreater.cjs.map +0 -1
  304. package/dist/lib/yarn/workspace/Workspace.cjs +0 -19
  305. package/dist/lib/yarn/workspace/Workspace.cjs.map +0 -1
  306. package/dist/lib/yarn/workspace/index.cjs +0 -60
  307. package/dist/lib/yarn/workspace/index.cjs.map +0 -1
  308. package/dist/lib/yarn/workspace/yarnWorkspace.cjs +0 -58
  309. package/dist/lib/yarn/workspace/yarnWorkspace.cjs.map +0 -1
  310. package/dist/lib/yarn/workspace/yarnWorkspaces.cjs +0 -49
  311. package/dist/lib/yarn/workspace/yarnWorkspaces.cjs.map +0 -1
  312. package/dist/lib/yarn/yarnInitCwd.cjs +0 -35
  313. package/dist/lib/yarn/yarnInitCwd.cjs.map +0 -1
  314. package/dist/loadPackageConfig.cjs +0 -39
  315. package/dist/loadPackageConfig.cjs.map +0 -1
  316. package/dist/types.d.cjs +0 -2
  317. package/dist/types.d.cjs.map +0 -1
  318. package/dist/xy/index.cjs +0 -1909
  319. package/dist/xy/index.cjs.map +0 -1
  320. package/dist/xy/param.cjs +0 -36
  321. package/dist/xy/param.cjs.map +0 -1
  322. package/dist/xy/xy.cjs +0 -1895
  323. package/dist/xy/xy.cjs.map +0 -1
  324. package/dist/xy/xyBuildCommands.cjs +0 -595
  325. package/dist/xy/xyBuildCommands.cjs.map +0 -1
  326. package/dist/xy/xyCommonCommands.cjs +0 -723
  327. package/dist/xy/xyCommonCommands.cjs.map +0 -1
  328. package/dist/xy/xyDeployCommands.cjs +0 -263
  329. package/dist/xy/xyDeployCommands.cjs.map +0 -1
  330. package/dist/xy/xyInstallCommands.cjs +0 -508
  331. package/dist/xy/xyInstallCommands.cjs.map +0 -1
  332. package/dist/xy/xyLintCommands.cjs +0 -466
  333. package/dist/xy/xyLintCommands.cjs.map +0 -1
  334. package/dist/xy/xyParseOptions.cjs +0 -84
  335. package/dist/xy/xyParseOptions.cjs.map +0 -1
@@ -1,232 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
9
- var __export = (target, all) => {
10
- for (var name in all)
11
- __defProp(target, name, { get: all[name], enumerable: true });
12
- };
13
- var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") {
15
- for (let key of __getOwnPropNames(from))
16
- if (!__hasOwnProp.call(to, key) && key !== except)
17
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
- }
19
- return to;
20
- };
21
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
- // If the importer is in node compatibility mode or this is not an ESM
23
- // file that has been converted to a CommonJS file using a Babel-
24
- // compatible transform (i.e. "__esModule" has not been set), then set
25
- // "default" to the CommonJS "module.exports" for node compatibility.
26
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
- mod
28
- ));
29
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
-
31
- // src/actions/recompile.ts
32
- var recompile_exports = {};
33
- __export(recompile_exports, {
34
- recompile: () => recompile,
35
- recompileAll: () => recompileAll,
36
- recompilePackage: () => recompilePackage
37
- });
38
- module.exports = __toCommonJS(recompile_exports);
39
- var import_chalk4 = __toESM(require("chalk"), 1);
40
-
41
- // src/lib/checkResult.ts
42
- var import_chalk = __toESM(require("chalk"), 1);
43
- var checkResult = /* @__PURE__ */ __name((name, result, level = "error", exitOnFail = false) => {
44
- if (result) {
45
- const exiting = exitOnFail ? "[Exiting Process]" : "[Continuing]";
46
- const chalkFunc = level === "error" ? import_chalk.default.red : import_chalk.default.yellow;
47
- console[level](chalkFunc(`${name} had ${result} failures ${exiting}`));
48
- if (exitOnFail) {
49
- process.exit(result);
50
- }
51
- }
52
- }, "checkResult");
53
-
54
- // src/lib/processEx.ts
55
- var import_chalk2 = __toESM(require("chalk"), 1);
56
-
57
- // src/lib/withError.ts
58
- var withError = /* @__PURE__ */ __name((ex, closure, predicate = (ex2) => ex2.name !== void 0 && ex2.message !== void 0) => {
59
- return predicate(ex) ? closure(ex) : void 0;
60
- }, "withError");
61
-
62
- // src/lib/withErrnoException.ts
63
- var withErrnoException = /* @__PURE__ */ __name((ex, closure) => {
64
- return withError(ex, closure, (ex2) => ex2.errno !== void 0);
65
- }, "withErrnoException");
66
-
67
- // src/lib/processEx.ts
68
- var processEx = /* @__PURE__ */ __name((ex) => {
69
- const error = typeof ex === "string" ? new Error(ex) : ex;
70
- const exitCode = withErrnoException(error, (error2) => {
71
- if (error2.code === "ENOENT") {
72
- console.error(import_chalk2.default.red(`'${error2.path}' not found.`));
73
- } else {
74
- console.error(import_chalk2.default.red(`Errno: ${error2.code}`));
75
- }
76
- return error2.errno ?? -1;
77
- }) ?? withError(error, (error2) => {
78
- console.error(import_chalk2.default.red(`${error2.name}: ${error2.message}`));
79
- return -1;
80
- }) ?? (() => {
81
- console.error(import_chalk2.default.red(`Unexpected Error: ${JSON.stringify(ex, null, 2)}`));
82
- return -1;
83
- })();
84
- process.exit(process.exitCode ?? exitCode);
85
- }, "processEx");
86
-
87
- // src/lib/safeExit.ts
88
- var safeExitAsync = /* @__PURE__ */ __name(async (func, exitOnFail = true) => {
89
- try {
90
- const result = await func();
91
- if (result && exitOnFail) {
92
- process.exit(result);
93
- }
94
- return result;
95
- } catch (ex) {
96
- return processEx(ex);
97
- }
98
- }, "safeExitAsync");
99
-
100
- // src/lib/runStepsAsync.ts
101
- var import_node_child_process = require("child_process");
102
- var import_node_fs = require("fs");
103
- var import_chalk3 = __toESM(require("chalk"), 1);
104
- var runStepAsync = /* @__PURE__ */ __name((name, step, exitOnFail = true, message) => {
105
- return new Promise((resolve) => {
106
- const [command, args, config] = step;
107
- if (message) {
108
- console.log(import_chalk3.default.gray(message));
109
- }
110
- const argList = Array.isArray(args) ? args : args.split(" ");
111
- if (command === "node" && !(0, import_node_fs.existsSync)(argList[0])) {
112
- throw new Error(`File not found [${argList[0]}]`);
113
- }
114
- (0, import_node_child_process.spawn)(command, Array.isArray(args) ? args : args.split(" "), {
115
- ...config,
116
- env: {
117
- FORCE_COLOR: "3",
118
- ...process.env
119
- },
120
- shell: true,
121
- stdio: "inherit"
122
- }).on("close", (code) => {
123
- if (code) {
124
- console.error(import_chalk3.default.red(`Command Exited With Non-Zero Result [${import_chalk3.default.gray(code)}] | ${import_chalk3.default.yellow(command)} ${import_chalk3.default.white(Array.isArray(args) ? args.join(" ") : args)}`));
125
- checkResult(name, code, "error", exitOnFail);
126
- resolve(code);
127
- } else {
128
- resolve(0);
129
- }
130
- });
131
- });
132
- }, "runStepAsync");
133
- var runStepsAsync = /* @__PURE__ */ __name(async (name, steps, exitOnFail = true, messages) => {
134
- return await safeExitAsync(async () => {
135
- const pkgName = process.env.npm_package_name;
136
- console.log(import_chalk3.default.green(`${name} [${pkgName}]`));
137
- let result = 0;
138
- for (const [i, step] of steps.entries()) {
139
- result += await runStepAsync(name, step, exitOnFail, messages?.[i]);
140
- }
141
- return result;
142
- });
143
- }, "runStepsAsync");
144
-
145
- // src/actions/recompile.ts
146
- var recompile = /* @__PURE__ */ __name(async ({ verbose, target, pkg, incremental }) => {
147
- return pkg ? await recompilePackage({
148
- pkg,
149
- target,
150
- verbose
151
- }) : await recompileAll({
152
- incremental,
153
- target,
154
- verbose
155
- });
156
- }, "recompile");
157
- var recompilePackage = /* @__PURE__ */ __name(({ verbose, target, pkg }) => {
158
- const targetOptions = target ? [
159
- "-t",
160
- target
161
- ] : [];
162
- const verboseOptions = verbose ? [
163
- "--verbose"
164
- ] : [
165
- "--no-verbose"
166
- ];
167
- return runStepsAsync(`Recompile [${pkg}]`, [
168
- [
169
- "yarn",
170
- [
171
- "workspace",
172
- pkg,
173
- ...verboseOptions,
174
- "run",
175
- "package-recompile",
176
- ...targetOptions
177
- ]
178
- ]
179
- ]);
180
- }, "recompilePackage");
181
- var recompileAll = /* @__PURE__ */ __name(async ({ jobs, verbose, target, incremental }) => {
182
- const start = Date.now();
183
- const verboseOptions = verbose ? [
184
- "--verbose"
185
- ] : [
186
- "--no-verbose"
187
- ];
188
- const targetOptions = target ? [
189
- "-t",
190
- target
191
- ] : [];
192
- const incrementalOptions = incremental ? [
193
- "--since",
194
- "-Apt",
195
- "--topological-dev"
196
- ] : [
197
- "--parallel",
198
- "-Apt",
199
- "--topological-dev"
200
- ];
201
- const jobsOptions = jobs ? [
202
- "-j",
203
- `${jobs}`
204
- ] : [];
205
- if (jobs) {
206
- console.log(import_chalk4.default.blue(`Jobs set to [${jobs}]`));
207
- }
208
- const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
209
- [
210
- "yarn",
211
- [
212
- "workspaces",
213
- "foreach",
214
- ...incrementalOptions,
215
- ...jobsOptions,
216
- ...verboseOptions,
217
- "run",
218
- "package-recompile",
219
- ...targetOptions
220
- ]
221
- ]
222
- ]);
223
- console.log(`${import_chalk4.default.gray("Recompiled in")} [${import_chalk4.default.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${import_chalk4.default.gray("seconds")}`);
224
- return result;
225
- }, "recompileAll");
226
- // Annotate the CommonJS export names for ESM import in node:
227
- 0 && (module.exports = {
228
- recompile,
229
- recompileAll,
230
- recompilePackage
231
- });
232
- //# sourceMappingURL=recompile.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/actions/recompile.ts","../../src/lib/checkResult.ts","../../src/lib/processEx.ts","../../src/lib/withError.ts","../../src/lib/withErrnoException.ts","../../src/lib/safeExit.ts","../../src/lib/runStepsAsync.ts"],"sourcesContent":["import chalk from 'chalk'\n\nimport { runStepsAsync } from '../lib/index.ts'\n\nexport interface RecompileParams {\n incremental?: boolean\n jobs?: number\n pkg?: string\n target?: 'esm' | 'cjs'\n verbose?: boolean\n}\n\nexport interface RecompilePackageParams {\n pkg: string\n target?: 'esm' | 'cjs'\n verbose?: boolean\n}\n\nexport const recompile = async ({ verbose, target, pkg, incremental }: RecompileParams) => {\n return pkg ? await recompilePackage({ pkg, target, verbose }) : await recompileAll({ incremental, target, verbose })\n}\n\nexport const recompilePackage = ({ verbose, target, pkg }: RecompilePackageParams) => {\n const targetOptions = target ? ['-t', target] : []\n const verboseOptions = verbose ? ['--verbose'] : ['--no-verbose']\n\n return runStepsAsync(`Recompile [${pkg}]`, [['yarn', ['workspace', pkg, ...verboseOptions, 'run', 'package-recompile', ...targetOptions]]])\n}\n\nexport const recompileAll = async ({ jobs, verbose, target, incremental }: RecompileParams) => {\n const start = Date.now()\n const verboseOptions = verbose ? ['--verbose'] : ['--no-verbose']\n const targetOptions = target ? ['-t', target] : []\n const incrementalOptions = incremental ? ['--since', '-Apt', '--topological-dev'] : ['--parallel', '-Apt', '--topological-dev']\n const jobsOptions = jobs ? ['-j', `${jobs}`] : []\n if (jobs) {\n console.log(chalk.blue(`Jobs set to [${jobs}]`))\n }\n\n const result = await runStepsAsync(`Recompile${incremental ? '-Incremental' : ''} [All]`, [\n ['yarn', ['workspaces', 'foreach', ...incrementalOptions, ...jobsOptions, ...verboseOptions, 'run', 'package-recompile', ...targetOptions]],\n ])\n console.log(`${chalk.gray('Recompiled in')} [${chalk.magenta(((Date.now() - start) / 1000).toFixed(2))}] ${chalk.gray('seconds')}`)\n return result\n}\n","import chalk from 'chalk'\n\nexport const checkResult = (name: string, result: number, level: 'error' | 'warn' = 'error', exitOnFail = false) => {\n if (result) {\n const exiting = exitOnFail ? '[Exiting Process]' : '[Continuing]'\n const chalkFunc = level === 'error' ? chalk.red : chalk.yellow\n console[level](chalkFunc(`${name} had ${result} failures ${exiting}`))\n if (exitOnFail) {\n process.exit(result)\n }\n }\n}\n","import chalk from 'chalk'\n\nimport { withErrnoException } from './withErrnoException.ts'\nimport { withError } from './withError.ts'\n\nexport const processEx = (ex: unknown) => {\n const error = typeof ex === 'string' ? new Error(ex) : ex\n const exitCode\n = withErrnoException(error, (error) => {\n if (error.code === 'ENOENT') {\n console.error(chalk.red(`'${error.path}' not found.`))\n } else {\n console.error(chalk.red(`Errno: ${error.code}`))\n }\n return error.errno ?? -1\n })\n ?? withError(error, (error) => {\n console.error(chalk.red(`${error.name}: ${error.message}`))\n return -1\n })\n ?? (() => {\n console.error(chalk.red(`Unexpected Error: ${JSON.stringify(ex, null, 2)}`))\n return -1\n })()\n // This allows us to use a previously set exit code\n process.exit(process.exitCode ?? exitCode)\n}\n","export const withError = <T extends Error = Error>(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ex: any,\n closure: (error: T) => number,\n predicate = (ex: T) => ex.name !== undefined && ex.message !== undefined,\n) => {\n return predicate(ex as T) ? closure(ex as T) : undefined\n}\n","import { withError } from './withError.ts'\n\nexport const withErrnoException = <T extends NodeJS.ErrnoException = NodeJS.ErrnoException>(ex: unknown, closure: (error: T) => number) => {\n return withError<T>(ex, closure, (ex: unknown) => (ex as NodeJS.ErrnoException).errno !== undefined)\n}\n","/** Catch child process a crash and returns the code */\n\nimport { processEx } from './processEx.ts'\n\nconst safeExit = (func: () => number, exitOnFail = true): number => {\n try {\n const result = func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nconst safeExitAsync = async (func: () => Promise<number>, exitOnFail = true): Promise<number> => {\n try {\n const result = await func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nexport { safeExit, safeExitAsync }\n","import { spawn } from 'node:child_process'\nimport { existsSync } from 'node:fs'\n\nimport chalk from 'chalk'\n\nimport { checkResult } from './checkResult.ts'\nimport { ScriptStep } from './runSteps.ts'\nimport { safeExitAsync } from './safeExit.ts'\n\nexport const runStepAsync = (name: string, step: ScriptStep, exitOnFail = true, message?: string) => {\n return new Promise<number>((resolve) => {\n const [command, args, config] = step\n if (message) {\n console.log(chalk.gray(message))\n }\n const argList = Array.isArray(args) ? args : args.split(' ')\n if (command === 'node' && !existsSync(argList[0])) {\n throw new Error(`File not found [${argList[0]}]`)\n }\n spawn(command, Array.isArray(args) ? args : args.split(' '), {\n ...config,\n env: { FORCE_COLOR: '3', ...process.env },\n shell: true,\n stdio: 'inherit',\n }).on('close', (code) => {\n if (code) {\n console.error(\n chalk.red(\n `Command Exited With Non-Zero Result [${chalk.gray(code)}] | ${chalk.yellow(command)} ${chalk.white(\n Array.isArray(args) ? args.join(' ') : args,\n )}`,\n ),\n )\n checkResult(name, code, 'error', exitOnFail)\n resolve(code)\n } else {\n resolve(0)\n }\n })\n })\n}\n\nexport const runStepsAsync = async (name: string, steps: ScriptStep[], exitOnFail = true, messages?: string[]) => {\n return await safeExitAsync(async () => {\n const pkgName = process.env.npm_package_name\n console.log(chalk.green(`${name} [${pkgName}]`))\n let result = 0\n for (const [i, step] of steps.entries()) {\n result += await runStepAsync(name, step, exitOnFail, messages?.[i])\n }\n return result\n })\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;IAAAA,gBAAkB;;;ACAlB,mBAAkB;AAEX,IAAMC,cAAc,wBAACC,MAAcC,QAAgBC,QAA0B,SAASC,aAAa,UAAK;AAC7G,MAAIF,QAAQ;AACV,UAAMG,UAAUD,aAAa,sBAAsB;AACnD,UAAME,YAAYH,UAAU,UAAUI,aAAAA,QAAMC,MAAMD,aAAAA,QAAME;AACxDC,YAAQP,KAAAA,EAAOG,UAAU,GAAGL,IAAAA,QAAYC,MAAAA,aAAmBG,OAAAA,EAAS,CAAA;AACpE,QAAID,YAAY;AACdO,cAAQC,KAAKV,MAAAA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M,GAAGA,IAAAA;MAAU,CAAA;AAC/C,MAAIA,MAAM;AACRM,YAAQC,IAAIC,cAAAA,QAAMC,KAAK,gBAAgBT,IAAAA,GAAO,CAAA;EAChD;AAEA,QAAMU,SAAS,MAAMX,cAAc,YAAYL,cAAc,iBAAiB,EAAA,UAAY;IACxF;MAAC;MAAQ;QAAC;QAAc;WAAcU;WAAuBC;WAAgBP;QAAgB;QAAO;WAAwBD;;;GAC7H;AACDS,UAAQC,IAAI,GAAGC,cAAAA,QAAMG,KAAK,eAAA,CAAA,KAAqBH,cAAAA,QAAMI,UAAUV,KAAKC,IAAG,IAAKF,SAAS,KAAMY,QAAQ,CAAA,CAAA,CAAA,KAAQL,cAAAA,QAAMG,KAAK,SAAA,CAAA,EAAY;AAClI,SAAOD;AACT,GAf4B;","names":["import_chalk","checkResult","name","result","level","exitOnFail","exiting","chalkFunc","chalk","red","yellow","console","process","exit","import_chalk","withError","ex","closure","predicate","name","undefined","message","withErrnoException","ex","closure","withError","errno","undefined","processEx","ex","error","Error","exitCode","withErrnoException","code","console","chalk","red","path","errno","withError","name","message","JSON","stringify","process","exit","safeExitAsync","func","exitOnFail","result","process","exit","ex","processEx","import_chalk","runStepAsync","name","step","exitOnFail","message","Promise","resolve","command","args","config","console","log","chalk","gray","argList","Array","isArray","split","existsSync","Error","spawn","env","FORCE_COLOR","process","shell","stdio","on","code","error","red","yellow","white","join","checkResult","runStepsAsync","steps","messages","safeExitAsync","pkgName","npm_package_name","green","result","i","entries","recompile","verbose","target","pkg","incremental","recompilePackage","recompileAll","targetOptions","verboseOptions","runStepsAsync","jobs","start","Date","now","incrementalOptions","jobsOptions","console","log","chalk","blue","result","gray","magenta","toFixed"]}
@@ -1,183 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
9
- var __export = (target, all) => {
10
- for (var name in all)
11
- __defProp(target, name, { get: all[name], enumerable: true });
12
- };
13
- var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") {
15
- for (let key of __getOwnPropNames(from))
16
- if (!__hasOwnProp.call(to, key) && key !== except)
17
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
- }
19
- return to;
20
- };
21
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
- // If the importer is in node compatibility mode or this is not an ESM
23
- // file that has been converted to a CommonJS file using a Babel-
24
- // compatible transform (i.e. "__esModule" has not been set), then set
25
- // "default" to the CommonJS "module.exports" for node compatibility.
26
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
- mod
28
- ));
29
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
-
31
- // src/actions/reinstall.ts
32
- var reinstall_exports = {};
33
- __export(reinstall_exports, {
34
- reinstall: () => reinstall
35
- });
36
- module.exports = __toCommonJS(reinstall_exports);
37
- var import_node_fs2 = require("fs");
38
-
39
- // src/lib/checkResult.ts
40
- var import_chalk = __toESM(require("chalk"), 1);
41
- var checkResult = /* @__PURE__ */ __name((name, result, level = "error", exitOnFail = false) => {
42
- if (result) {
43
- const exiting = exitOnFail ? "[Exiting Process]" : "[Continuing]";
44
- const chalkFunc = level === "error" ? import_chalk.default.red : import_chalk.default.yellow;
45
- console[level](chalkFunc(`${name} had ${result} failures ${exiting}`));
46
- if (exitOnFail) {
47
- process.exit(result);
48
- }
49
- }
50
- }, "checkResult");
51
-
52
- // src/lib/processEx.ts
53
- var import_chalk2 = __toESM(require("chalk"), 1);
54
-
55
- // src/lib/withError.ts
56
- var withError = /* @__PURE__ */ __name((ex, closure, predicate = (ex2) => ex2.name !== void 0 && ex2.message !== void 0) => {
57
- return predicate(ex) ? closure(ex) : void 0;
58
- }, "withError");
59
-
60
- // src/lib/withErrnoException.ts
61
- var withErrnoException = /* @__PURE__ */ __name((ex, closure) => {
62
- return withError(ex, closure, (ex2) => ex2.errno !== void 0);
63
- }, "withErrnoException");
64
-
65
- // src/lib/processEx.ts
66
- var processEx = /* @__PURE__ */ __name((ex) => {
67
- const error = typeof ex === "string" ? new Error(ex) : ex;
68
- const exitCode = withErrnoException(error, (error2) => {
69
- if (error2.code === "ENOENT") {
70
- console.error(import_chalk2.default.red(`'${error2.path}' not found.`));
71
- } else {
72
- console.error(import_chalk2.default.red(`Errno: ${error2.code}`));
73
- }
74
- return error2.errno ?? -1;
75
- }) ?? withError(error, (error2) => {
76
- console.error(import_chalk2.default.red(`${error2.name}: ${error2.message}`));
77
- return -1;
78
- }) ?? (() => {
79
- console.error(import_chalk2.default.red(`Unexpected Error: ${JSON.stringify(ex, null, 2)}`));
80
- return -1;
81
- })();
82
- process.exit(process.exitCode ?? exitCode);
83
- }, "processEx");
84
-
85
- // src/lib/safeExit.ts
86
- var safeExit = /* @__PURE__ */ __name((func, exitOnFail = true) => {
87
- try {
88
- const result = func();
89
- if (result && exitOnFail) {
90
- process.exit(result);
91
- }
92
- return result;
93
- } catch (ex) {
94
- return processEx(ex);
95
- }
96
- }, "safeExit");
97
-
98
- // src/lib/yarn/workspace/yarnWorkspaces.ts
99
- var import_node_child_process = require("child_process");
100
- var yarnWorkspaces = /* @__PURE__ */ __name(() => {
101
- const result = (0, import_node_child_process.spawnSync)("yarn", [
102
- "workspaces",
103
- "list",
104
- "--json",
105
- "--recursive"
106
- ], {
107
- encoding: "utf8",
108
- shell: true
109
- });
110
- if (result.error) {
111
- throw result.error;
112
- }
113
- return result.stdout.toString().split("\n").slice(0, -1).map((item) => {
114
- return JSON.parse(item);
115
- });
116
- }, "yarnWorkspaces");
117
-
118
- // src/lib/runSteps.ts
119
- var import_node_child_process2 = require("child_process");
120
- var import_node_fs = require("fs");
121
- var import_chalk3 = __toESM(require("chalk"), 1);
122
- var runSteps = /* @__PURE__ */ __name((name, steps, exitOnFail = true, messages) => {
123
- return safeExit(() => {
124
- const pkgName = process.env.npm_package_name;
125
- console.log(import_chalk3.default.green(`${name} [${pkgName}]`));
126
- let totalStatus = 0;
127
- for (const [i, [command, args, config]] of steps.entries()) {
128
- if (messages?.[i]) {
129
- console.log(import_chalk3.default.gray(messages?.[i]));
130
- }
131
- const argList = Array.isArray(args) ? args : args.split(" ");
132
- if (command === "node" && !(0, import_node_fs.existsSync)(argList[0])) {
133
- throw new Error(`File not found [${argList[0]}]`);
134
- }
135
- const status = (0, import_node_child_process2.spawnSync)(command, Array.isArray(args) ? args : args.split(" "), {
136
- ...config,
137
- encoding: "utf8",
138
- env: {
139
- FORCE_COLOR: "3",
140
- ...process.env
141
- },
142
- shell: true,
143
- stdio: "inherit"
144
- }).status ?? 0;
145
- checkResult(name, status, "error", exitOnFail);
146
- totalStatus += status ?? 0;
147
- }
148
- return totalStatus;
149
- }, !!exitOnFail);
150
- }, "runSteps");
151
-
152
- // src/actions/reinstall.ts
153
- var reinstall = /* @__PURE__ */ __name(() => {
154
- console.log("Reinstall [Clear Lock File]");
155
- (0, import_node_fs2.closeSync)((0, import_node_fs2.openSync)("./yarn.lock", "w"));
156
- console.log("Reinstall [Clear Node Modules]");
157
- const workspaces = yarnWorkspaces();
158
- const result = workspaces.map(({ location, name }) => {
159
- const dist = `${location}/node_modules`;
160
- try {
161
- (0, import_node_fs2.rmSync)(dist, {
162
- force: true,
163
- recursive: true
164
- });
165
- return 0;
166
- } catch (ex) {
167
- const error = ex;
168
- console.error(`Reinstall [Clear Node Modules] Failed [${name}, ${error.message}]`);
169
- return 1;
170
- }
171
- }).reduce((prev, result2) => prev || result2, 0);
172
- return result || runSteps("Reinstall", [
173
- [
174
- "yarn",
175
- "install --network-timeout 10000"
176
- ]
177
- ]);
178
- }, "reinstall");
179
- // Annotate the CommonJS export names for ESM import in node:
180
- 0 && (module.exports = {
181
- reinstall
182
- });
183
- //# sourceMappingURL=reinstall.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/actions/reinstall.ts","../../src/lib/checkResult.ts","../../src/lib/processEx.ts","../../src/lib/withError.ts","../../src/lib/withErrnoException.ts","../../src/lib/safeExit.ts","../../src/lib/yarn/workspace/yarnWorkspaces.ts","../../src/lib/runSteps.ts"],"sourcesContent":["import { closeSync, openSync, rmSync } from 'node:fs'\n\nimport { runSteps, yarnWorkspaces } from '../lib/index.ts'\n\nexport const reinstall = () => {\n console.log('Reinstall [Clear Lock File]')\n closeSync(openSync('./yarn.lock', 'w'))\n\n console.log('Reinstall [Clear Node Modules]')\n const workspaces = yarnWorkspaces()\n const result = workspaces\n .map(({ location, name }) => {\n const dist = `${location}/node_modules`\n try {\n rmSync(dist, { force: true, recursive: true })\n return 0\n } catch (ex) {\n const error = ex as Error\n console.error(`Reinstall [Clear Node Modules] Failed [${name}, ${error.message}]`)\n return 1\n }\n })\n // eslint-disable-next-line unicorn/no-array-reduce\n .reduce((prev, result) => prev || result, 0)\n\n return result || runSteps('Reinstall', [['yarn', 'install --network-timeout 10000']])\n}\n","import chalk from 'chalk'\n\nexport const checkResult = (name: string, result: number, level: 'error' | 'warn' = 'error', exitOnFail = false) => {\n if (result) {\n const exiting = exitOnFail ? '[Exiting Process]' : '[Continuing]'\n const chalkFunc = level === 'error' ? chalk.red : chalk.yellow\n console[level](chalkFunc(`${name} had ${result} failures ${exiting}`))\n if (exitOnFail) {\n process.exit(result)\n }\n }\n}\n","import chalk from 'chalk'\n\nimport { withErrnoException } from './withErrnoException.ts'\nimport { withError } from './withError.ts'\n\nexport const processEx = (ex: unknown) => {\n const error = typeof ex === 'string' ? new Error(ex) : ex\n const exitCode\n = withErrnoException(error, (error) => {\n if (error.code === 'ENOENT') {\n console.error(chalk.red(`'${error.path}' not found.`))\n } else {\n console.error(chalk.red(`Errno: ${error.code}`))\n }\n return error.errno ?? -1\n })\n ?? withError(error, (error) => {\n console.error(chalk.red(`${error.name}: ${error.message}`))\n return -1\n })\n ?? (() => {\n console.error(chalk.red(`Unexpected Error: ${JSON.stringify(ex, null, 2)}`))\n return -1\n })()\n // This allows us to use a previously set exit code\n process.exit(process.exitCode ?? exitCode)\n}\n","export const withError = <T extends Error = Error>(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ex: any,\n closure: (error: T) => number,\n predicate = (ex: T) => ex.name !== undefined && ex.message !== undefined,\n) => {\n return predicate(ex as T) ? closure(ex as T) : undefined\n}\n","import { withError } from './withError.ts'\n\nexport const withErrnoException = <T extends NodeJS.ErrnoException = NodeJS.ErrnoException>(ex: unknown, closure: (error: T) => number) => {\n return withError<T>(ex, closure, (ex: unknown) => (ex as NodeJS.ErrnoException).errno !== undefined)\n}\n","/** Catch child process a crash and returns the code */\n\nimport { processEx } from './processEx.ts'\n\nconst safeExit = (func: () => number, exitOnFail = true): number => {\n try {\n const result = func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nconst safeExitAsync = async (func: () => Promise<number>, exitOnFail = true): Promise<number> => {\n try {\n const result = await func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nexport { safeExit, safeExitAsync }\n","import { spawnSync } from 'node:child_process'\n\nimport { Workspace } from './Workspace.ts'\n\nexport const yarnWorkspaces = (): Workspace[] => {\n const result = spawnSync('yarn', ['workspaces', 'list', '--json', '--recursive'], { encoding: 'utf8', shell: true })\n if (result.error) {\n throw result.error\n }\n return (\n result.stdout\n .toString()\n // NOTE: This probably doesn't work on Windows\n // TODO: Replace /r/n with /n first\n .split('\\n')\n .slice(0, -1)\n .map((item) => {\n return JSON.parse(item)\n })\n )\n}\n","import { spawnSync, SpawnSyncOptionsWithBufferEncoding } from 'node:child_process'\nimport { existsSync } from 'node:fs'\n\nimport chalk from 'chalk'\n\nimport { checkResult } from './checkResult.ts'\nimport { safeExit } from './safeExit.ts'\n\nexport type ScriptStep =\n | [/* command */ 'yarn' | 'node' | 'ts-node-script' | 'tsc' | 'jest', /* arg */ string | string[]]\n | [/* command */ string, /* arg */ string | string[], /* config */ SpawnSyncOptionsWithBufferEncoding]\n\nexport const runSteps = (name: string, steps: ScriptStep[], exitOnFail = true, messages?: string[]): number => {\n return safeExit(() => {\n const pkgName = process.env.npm_package_name\n console.log(chalk.green(`${name} [${pkgName}]`))\n let totalStatus = 0\n for (const [i, [command, args, config]] of steps.entries()) {\n if (messages?.[i]) {\n console.log(chalk.gray(messages?.[i]))\n }\n const argList = Array.isArray(args) ? args : args.split(' ')\n if (command === 'node' && !existsSync(argList[0])) {\n throw new Error(`File not found [${argList[0]}]`)\n }\n const status\n = spawnSync(command, Array.isArray(args) ? args : args.split(' '), {\n ...config,\n encoding: 'utf8',\n env: { FORCE_COLOR: '3', ...process.env },\n shell: true,\n stdio: 'inherit',\n }).status ?? 0\n checkResult(name, status, 'error', exitOnFail)\n totalStatus += status ?? 0\n }\n return totalStatus\n }, !!exitOnFail)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;IAAAA,kBAA4C;;;ACA5C,mBAAkB;AAEX,IAAMC,cAAc,wBAACC,MAAcC,QAAgBC,QAA0B,SAASC,aAAa,UAAK;AAC7G,MAAIF,QAAQ;AACV,UAAMG,UAAUD,aAAa,sBAAsB;AACnD,UAAME,YAAYH,UAAU,UAAUI,aAAAA,QAAMC,MAAMD,aAAAA,QAAME;AACxDC,YAAQP,KAAAA,EAAOG,UAAU,GAAGL,IAAAA,QAAYC,MAAAA,aAAmBG,OAAAA,EAAS,CAAA;AACpE,QAAID,YAAY;AACdO,cAAQC,KAAKV,MAAAA;IACf;EACF;AACF,GAT2B;;;ACF3B,IAAAW,gBAAkB;;;ACAX,IAAMC,YAAY,wBAEvBC,IACAC,SACAC,YAAY,CAACF,Q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ACPC,OAAO;MACT,CAAA,EAAGL,UAAU;AACfM,kBAAYhC,MAAM0B,QAAQ,SAASxB,UAAAA;AACnCW,qBAAea,UAAU;IAC3B;AACA,WAAOb;EACT,GAAG,CAAC,CAACX,UAAAA;AACP,GA1BwB;;;APRjB,IAAM+B,YAAY,6BAAA;AACvBC,UAAQC,IAAI,6BAAA;AACZC,qCAAUC,0BAAS,eAAe,GAAA,CAAA;AAElCH,UAAQC,IAAI,gCAAA;AACZ,QAAMG,aAAaC,eAAAA;AACnB,QAAMC,SAASF,WACZG,IAAI,CAAC,EAAEC,UAAUC,KAAI,MAAE;AACtB,UAAMC,OAAO,GAAGF,QAAAA;AAChB,QAAI;AACFG,kCAAOD,MAAM;QAAEE,OAAO;QAAMC,WAAW;MAAK,CAAA;AAC5C,aAAO;IACT,SAASC,IAAI;AACX,YAAMC,QAAQD;AACdd,cAAQe,MAAM,0CAA0CN,IAAAA,KAASM,MAAMC,OAAO,GAAG;AACjF,aAAO;IACT;EACF,CAAA,EAECC,OAAO,CAACC,MAAMZ,YAAWY,QAAQZ,SAAQ,CAAA;AAE5C,SAAOA,UAAUa,SAAS,aAAa;IAAC;MAAC;MAAQ;;GAAmC;AACtF,GAtByB;","names":["import_node_fs","checkResult","name","result","level","exitOnFail","exiting","chalkFunc","chalk","red","yellow","console","process","exit","import_chalk","withError","ex","closure","predicate","name","undefined","message","withErrnoException","ex","closure","withError","errno","undefined","processEx","ex","error","Error","exitCode","withErrnoException","code","console","chalk","red","path","errno","withError","name","message","JSON","stringify","process","exit","safeExit","func","exitOnFail","result","process","exit","ex","processEx","yarnWorkspaces","result","spawnSync","encoding","shell","error","stdout","toString","split","slice","map","item","JSON","parse","import_node_child_process","import_chalk","runSteps","name","steps","exitOnFail","messages","safeExit","pkgName","process","env","npm_package_name","console","log","chalk","green","totalStatus","i","command","args","config","entries","gray","argList","Array","isArray","split","existsSync","Error","status","spawnSync","encoding","FORCE_COLOR","shell","stdio","checkResult","reinstall","console","log","closeSync","openSync","workspaces","yarnWorkspaces","result","map","location","name","dist","rmSync","force","recursive","ex","error","message","reduce","prev","runSteps"]}
@@ -1,185 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
9
- var __export = (target, all) => {
10
- for (var name in all)
11
- __defProp(target, name, { get: all[name], enumerable: true });
12
- };
13
- var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") {
15
- for (let key of __getOwnPropNames(from))
16
- if (!__hasOwnProp.call(to, key) && key !== except)
17
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
- }
19
- return to;
20
- };
21
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
- // If the importer is in node compatibility mode or this is not an ESM
23
- // file that has been converted to a CommonJS file using a Babel-
24
- // compatible transform (i.e. "__esModule" has not been set), then set
25
- // "default" to the CommonJS "module.exports" for node compatibility.
26
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
- mod
28
- ));
29
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
-
31
- // src/actions/relint.ts
32
- var relint_exports = {};
33
- __export(relint_exports, {
34
- relint: () => relint
35
- });
36
- module.exports = __toCommonJS(relint_exports);
37
- var import_node_fs2 = require("fs");
38
-
39
- // src/lib/checkResult.ts
40
- var import_chalk = __toESM(require("chalk"), 1);
41
- var checkResult = /* @__PURE__ */ __name((name, result, level = "error", exitOnFail = false) => {
42
- if (result) {
43
- const exiting = exitOnFail ? "[Exiting Process]" : "[Continuing]";
44
- const chalkFunc = level === "error" ? import_chalk.default.red : import_chalk.default.yellow;
45
- console[level](chalkFunc(`${name} had ${result} failures ${exiting}`));
46
- if (exitOnFail) {
47
- process.exit(result);
48
- }
49
- }
50
- }, "checkResult");
51
-
52
- // src/lib/processEx.ts
53
- var import_chalk2 = __toESM(require("chalk"), 1);
54
-
55
- // src/lib/withError.ts
56
- var withError = /* @__PURE__ */ __name((ex, closure, predicate = (ex2) => ex2.name !== void 0 && ex2.message !== void 0) => {
57
- return predicate(ex) ? closure(ex) : void 0;
58
- }, "withError");
59
-
60
- // src/lib/withErrnoException.ts
61
- var withErrnoException = /* @__PURE__ */ __name((ex, closure) => {
62
- return withError(ex, closure, (ex2) => ex2.errno !== void 0);
63
- }, "withErrnoException");
64
-
65
- // src/lib/processEx.ts
66
- var processEx = /* @__PURE__ */ __name((ex) => {
67
- const error = typeof ex === "string" ? new Error(ex) : ex;
68
- const exitCode = withErrnoException(error, (error2) => {
69
- if (error2.code === "ENOENT") {
70
- console.error(import_chalk2.default.red(`'${error2.path}' not found.`));
71
- } else {
72
- console.error(import_chalk2.default.red(`Errno: ${error2.code}`));
73
- }
74
- return error2.errno ?? -1;
75
- }) ?? withError(error, (error2) => {
76
- console.error(import_chalk2.default.red(`${error2.name}: ${error2.message}`));
77
- return -1;
78
- }) ?? (() => {
79
- console.error(import_chalk2.default.red(`Unexpected Error: ${JSON.stringify(ex, null, 2)}`));
80
- return -1;
81
- })();
82
- process.exit(process.exitCode ?? exitCode);
83
- }, "processEx");
84
-
85
- // src/lib/safeExit.ts
86
- var safeExit = /* @__PURE__ */ __name((func, exitOnFail = true) => {
87
- try {
88
- const result = func();
89
- if (result && exitOnFail) {
90
- process.exit(result);
91
- }
92
- return result;
93
- } catch (ex) {
94
- return processEx(ex);
95
- }
96
- }, "safeExit");
97
-
98
- // src/lib/yarn/workspace/yarnWorkspaces.ts
99
- var import_node_child_process = require("child_process");
100
- var yarnWorkspaces = /* @__PURE__ */ __name(() => {
101
- const result = (0, import_node_child_process.spawnSync)("yarn", [
102
- "workspaces",
103
- "list",
104
- "--json",
105
- "--recursive"
106
- ], {
107
- encoding: "utf8",
108
- shell: true
109
- });
110
- if (result.error) {
111
- throw result.error;
112
- }
113
- return result.stdout.toString().split("\n").slice(0, -1).map((item) => {
114
- return JSON.parse(item);
115
- });
116
- }, "yarnWorkspaces");
117
-
118
- // src/lib/runSteps.ts
119
- var import_node_child_process2 = require("child_process");
120
- var import_node_fs = require("fs");
121
- var import_chalk3 = __toESM(require("chalk"), 1);
122
- var runSteps = /* @__PURE__ */ __name((name, steps, exitOnFail = true, messages) => {
123
- return safeExit(() => {
124
- const pkgName = process.env.npm_package_name;
125
- console.log(import_chalk3.default.green(`${name} [${pkgName}]`));
126
- let totalStatus = 0;
127
- for (const [i, [command, args, config]] of steps.entries()) {
128
- if (messages?.[i]) {
129
- console.log(import_chalk3.default.gray(messages?.[i]));
130
- }
131
- const argList = Array.isArray(args) ? args : args.split(" ");
132
- if (command === "node" && !(0, import_node_fs.existsSync)(argList[0])) {
133
- throw new Error(`File not found [${argList[0]}]`);
134
- }
135
- const status = (0, import_node_child_process2.spawnSync)(command, Array.isArray(args) ? args : args.split(" "), {
136
- ...config,
137
- encoding: "utf8",
138
- env: {
139
- FORCE_COLOR: "3",
140
- ...process.env
141
- },
142
- shell: true,
143
- stdio: "inherit"
144
- }).status ?? 0;
145
- checkResult(name, status, "error", exitOnFail);
146
- totalStatus += status ?? 0;
147
- }
148
- return totalStatus;
149
- }, !!exitOnFail);
150
- }, "runSteps");
151
-
152
- // src/actions/relint.ts
153
- var relint = /* @__PURE__ */ __name(() => {
154
- console.log("Relint - Cleaning [.eslintcache]");
155
- const workspaces = yarnWorkspaces();
156
- const result = workspaces.map(({ location, name }) => {
157
- const dist = `${location}/.eslintcache`;
158
- try {
159
- (0, import_node_fs2.rmSync)(dist, {
160
- force: true,
161
- recursive: true
162
- });
163
- return 0;
164
- } catch (ex) {
165
- const error = ex;
166
- console.error(`Relint - Cleaning [.eslintcache] Failed [${name}, ${error.message}]`);
167
- return 1;
168
- }
169
- }).reduce((prev, result2) => prev || result2, 0);
170
- return result || runSteps("Relint", [
171
- [
172
- "yarn",
173
- [
174
- "eslint",
175
- ".",
176
- "--cache"
177
- ]
178
- ]
179
- ]);
180
- }, "relint");
181
- // Annotate the CommonJS export names for ESM import in node:
182
- 0 && (module.exports = {
183
- relint
184
- });
185
- //# sourceMappingURL=relint.cjs.map