@xylabs/ts-scripts-yarn3 6.0.5 → 6.0.7

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 (316) hide show
  1. package/dist/actions/build.mjs +11 -0
  2. package/dist/actions/build.mjs.map +1 -1
  3. package/dist/actions/compile-types.mjs +2 -2
  4. package/dist/actions/compile-types.mjs.map +1 -1
  5. package/dist/actions/compile.mjs +7 -9
  6. package/dist/actions/compile.mjs.map +1 -1
  7. package/dist/actions/index.mjs +198 -214
  8. package/dist/actions/index.mjs.map +1 -1
  9. package/dist/actions/package/compile/compile.mjs +97 -169
  10. package/dist/actions/package/compile/compile.mjs.map +1 -1
  11. package/dist/actions/package/compile/compileTypes.mjs +16 -31
  12. package/dist/actions/package/compile/compileTypes.mjs.map +1 -1
  13. package/dist/actions/package/compile/index.mjs +152 -177
  14. package/dist/actions/package/compile/index.mjs.map +1 -1
  15. package/dist/actions/package/compile/packageCompileTscTypes.mjs +14 -29
  16. package/dist/actions/package/compile/packageCompileTscTypes.mjs.map +1 -1
  17. package/dist/actions/package/compile/packageCompileTsup.mjs +94 -82
  18. package/dist/actions/package/compile/packageCompileTsup.mjs.map +1 -1
  19. package/dist/actions/package/index.mjs +168 -193
  20. package/dist/actions/package/index.mjs.map +1 -1
  21. package/dist/actions/package/recompile.mjs +97 -169
  22. package/dist/actions/package/recompile.mjs.map +1 -1
  23. package/dist/bin/package/build-only.mjs +100 -172
  24. package/dist/bin/package/build-only.mjs.map +1 -1
  25. package/dist/bin/package/build.mjs +100 -172
  26. package/dist/bin/package/build.mjs.map +1 -1
  27. package/dist/bin/package/clean-outputs.mjs +1 -6
  28. package/dist/bin/package/clean-outputs.mjs.map +1 -1
  29. package/dist/bin/package/clean-typescript.mjs +1 -6
  30. package/dist/bin/package/clean-typescript.mjs.map +1 -1
  31. package/dist/bin/package/compile-only.mjs +99 -171
  32. package/dist/bin/package/compile-only.mjs.map +1 -1
  33. package/dist/bin/package/compile-tsup.mjs +110 -96
  34. package/dist/bin/package/compile-tsup.mjs.map +1 -1
  35. package/dist/bin/package/compile-types.mjs +44 -55
  36. package/dist/bin/package/compile-types.mjs.map +1 -1
  37. package/dist/bin/package/compile.mjs +99 -171
  38. package/dist/bin/package/compile.mjs.map +1 -1
  39. package/dist/bin/package/recompile.mjs +99 -171
  40. package/dist/bin/package/recompile.mjs.map +1 -1
  41. package/dist/bin/xy.mjs +20 -12
  42. package/dist/bin/xy.mjs.map +1 -1
  43. package/dist/index.d.ts +6 -11
  44. package/dist/index.mjs +208 -225
  45. package/dist/index.mjs.map +1 -1
  46. package/dist/types/actions/build.d.ts +9 -0
  47. package/dist/types/actions/build.d.ts.map +1 -0
  48. package/dist/types/actions/clean-docs.d.ts +2 -0
  49. package/dist/types/actions/clean-docs.d.ts.map +1 -0
  50. package/dist/types/actions/clean-eslint.d.ts +2 -0
  51. package/dist/types/actions/clean-eslint.d.ts.map +1 -0
  52. package/dist/types/actions/clean-jest.d.ts +2 -0
  53. package/dist/types/actions/clean-jest.d.ts.map +1 -0
  54. package/dist/types/actions/clean.d.ts +12 -0
  55. package/dist/types/actions/clean.d.ts.map +1 -0
  56. package/dist/types/actions/compile-types.d.ts +16 -0
  57. package/dist/types/actions/compile-types.d.ts.map +1 -0
  58. package/dist/types/actions/compile.d.ts +19 -0
  59. package/dist/types/actions/compile.d.ts.map +1 -0
  60. package/dist/types/actions/copy-assets.d.ts +6 -0
  61. package/dist/types/actions/copy-assets.d.ts.map +1 -0
  62. package/dist/types/actions/cycle.d.ts +2 -0
  63. package/dist/types/actions/cycle.d.ts.map +1 -0
  64. package/dist/types/actions/dead.d.ts +2 -0
  65. package/dist/types/actions/dead.d.ts.map +1 -0
  66. package/dist/types/actions/deploy-major.d.ts +2 -0
  67. package/dist/types/actions/deploy-major.d.ts.map +1 -0
  68. package/dist/types/actions/deploy-minor.d.ts +2 -0
  69. package/dist/types/actions/deploy-minor.d.ts.map +1 -0
  70. package/dist/types/actions/deploy-next.d.ts +2 -0
  71. package/dist/types/actions/deploy-next.d.ts.map +1 -0
  72. package/dist/types/actions/deploy.d.ts +2 -0
  73. package/dist/types/actions/deploy.d.ts.map +1 -0
  74. package/dist/types/actions/deps.d.ts +13 -0
  75. package/dist/types/actions/deps.d.ts.map +1 -0
  76. package/dist/types/actions/dupdeps.d.ts +2 -0
  77. package/dist/types/actions/dupdeps.d.ts.map +1 -0
  78. package/dist/types/actions/fix.d.ts +3 -0
  79. package/dist/types/actions/fix.d.ts.map +1 -0
  80. package/dist/types/actions/gen-docs.d.ts +11 -0
  81. package/dist/types/actions/gen-docs.d.ts.map +1 -0
  82. package/dist/types/actions/gitignore-gen.d.ts +2 -0
  83. package/dist/types/actions/gitignore-gen.d.ts.map +1 -0
  84. package/dist/types/actions/gitlint-fix.d.ts +2 -0
  85. package/dist/types/actions/gitlint-fix.d.ts.map +1 -0
  86. package/dist/types/actions/gitlint.d.ts +2 -0
  87. package/dist/types/actions/gitlint.d.ts.map +1 -0
  88. package/dist/types/actions/index.d.ts +38 -0
  89. package/dist/types/actions/index.d.ts.map +1 -0
  90. package/dist/types/actions/license.d.ts +2 -0
  91. package/dist/types/actions/license.d.ts.map +1 -0
  92. package/dist/types/actions/lint.d.ts +14 -0
  93. package/dist/types/actions/lint.d.ts.map +1 -0
  94. package/dist/types/actions/npmignore-gen.d.ts +2 -0
  95. package/dist/types/actions/npmignore-gen.d.ts.map +1 -0
  96. package/dist/types/actions/package/clean-outputs.d.ts +2 -0
  97. package/dist/types/actions/package/clean-outputs.d.ts.map +1 -0
  98. package/dist/types/actions/package/clean-typescript.d.ts +2 -0
  99. package/dist/types/actions/package/clean-typescript.d.ts.map +1 -0
  100. package/dist/types/actions/package/clean.d.ts +2 -0
  101. package/dist/types/actions/package/clean.d.ts.map +1 -0
  102. package/dist/types/actions/package/compile/XyConfig.d.ts +58 -0
  103. package/dist/types/actions/package/compile/XyConfig.d.ts.map +1 -0
  104. package/dist/types/actions/package/compile/buildEntries.d.ts +3 -0
  105. package/dist/types/actions/package/compile/buildEntries.d.ts.map +1 -0
  106. package/dist/types/actions/package/compile/compile.d.ts +3 -0
  107. package/dist/types/actions/package/compile/compile.d.ts.map +1 -0
  108. package/dist/types/actions/package/compile/compileTypes.d.ts +3 -0
  109. package/dist/types/actions/package/compile/compileTypes.d.ts.map +1 -0
  110. package/dist/types/actions/package/compile/copyTypeFiles.d.ts +3 -0
  111. package/dist/types/actions/package/compile/copyTypeFiles.d.ts.map +1 -0
  112. package/dist/types/actions/package/compile/deepMerge.d.ts +4 -0
  113. package/dist/types/actions/package/compile/deepMerge.d.ts.map +1 -0
  114. package/dist/types/actions/package/compile/getCompilerOptions.d.ts +3 -0
  115. package/dist/types/actions/package/compile/getCompilerOptions.d.ts.map +1 -0
  116. package/dist/types/actions/package/compile/index.d.ts +7 -0
  117. package/dist/types/actions/package/compile/index.d.ts.map +1 -0
  118. package/dist/types/actions/package/compile/inputs.d.ts +2 -0
  119. package/dist/types/actions/package/compile/inputs.d.ts.map +1 -0
  120. package/dist/types/actions/package/compile/packageCompileTsc.d.ts +4 -0
  121. package/dist/types/actions/package/compile/packageCompileTsc.d.ts.map +1 -0
  122. package/dist/types/actions/package/compile/packageCompileTscTypes.d.ts +4 -0
  123. package/dist/types/actions/package/compile/packageCompileTscTypes.d.ts.map +1 -0
  124. package/dist/types/actions/package/compile/packageCompileTsup.d.ts +5 -0
  125. package/dist/types/actions/package/compile/packageCompileTsup.d.ts.map +1 -0
  126. package/dist/types/actions/package/copy-assets.d.ts +5 -0
  127. package/dist/types/actions/package/copy-assets.d.ts.map +1 -0
  128. package/dist/types/actions/package/deps.d.ts +2 -0
  129. package/dist/types/actions/package/deps.d.ts.map +1 -0
  130. package/dist/types/actions/package/gen-docs.d.ts +2 -0
  131. package/dist/types/actions/package/gen-docs.d.ts.map +1 -0
  132. package/dist/types/actions/package/index.d.ts +11 -0
  133. package/dist/types/actions/package/index.d.ts.map +1 -0
  134. package/dist/types/actions/package/lint.d.ts +2 -0
  135. package/dist/types/actions/package/lint.d.ts.map +1 -0
  136. package/dist/types/actions/package/publint.d.ts +5 -0
  137. package/dist/types/actions/package/publint.d.ts.map +1 -0
  138. package/dist/types/actions/package/recompile.d.ts +2 -0
  139. package/dist/types/actions/package/recompile.d.ts.map +1 -0
  140. package/dist/types/actions/publint.d.ts +12 -0
  141. package/dist/types/actions/publint.d.ts.map +1 -0
  142. package/dist/types/actions/rebuild.d.ts +6 -0
  143. package/dist/types/actions/rebuild.d.ts.map +1 -0
  144. package/dist/types/actions/recompile.d.ts +16 -0
  145. package/dist/types/actions/recompile.d.ts.map +1 -0
  146. package/dist/types/actions/reinstall.d.ts +2 -0
  147. package/dist/types/actions/reinstall.d.ts.map +1 -0
  148. package/dist/types/actions/relint.d.ts +13 -0
  149. package/dist/types/actions/relint.d.ts.map +1 -0
  150. package/dist/types/actions/retest.d.ts +2 -0
  151. package/dist/types/actions/retest.d.ts.map +1 -0
  152. package/dist/types/actions/sonar.d.ts +2 -0
  153. package/dist/types/actions/sonar.d.ts.map +1 -0
  154. package/dist/types/actions/statics.d.ts +2 -0
  155. package/dist/types/actions/statics.d.ts.map +1 -0
  156. package/dist/types/actions/test.d.ts +2 -0
  157. package/dist/types/actions/test.d.ts.map +1 -0
  158. package/dist/types/actions/up.d.ts +2 -0
  159. package/dist/types/actions/up.d.ts.map +1 -0
  160. package/dist/types/actions/updo.d.ts +2 -0
  161. package/dist/types/actions/updo.d.ts.map +1 -0
  162. package/dist/types/actions/upplug.d.ts +2 -0
  163. package/dist/types/actions/upplug.d.ts.map +1 -0
  164. package/dist/types/actions/upyarn.d.ts +2 -0
  165. package/dist/types/actions/upyarn.d.ts.map +1 -0
  166. package/dist/types/actions/yarn3only.d.ts +2 -0
  167. package/dist/types/actions/yarn3only.d.ts.map +1 -0
  168. package/dist/types/bin/package/build-only.d.ts +3 -0
  169. package/dist/types/bin/package/build-only.d.ts.map +1 -0
  170. package/dist/types/bin/package/build.d.ts +3 -0
  171. package/dist/types/bin/package/build.d.ts.map +1 -0
  172. package/dist/types/bin/package/clean-outputs.d.ts +3 -0
  173. package/dist/types/bin/package/clean-outputs.d.ts.map +1 -0
  174. package/dist/types/bin/package/clean-typescript.d.ts +3 -0
  175. package/dist/types/bin/package/clean-typescript.d.ts.map +1 -0
  176. package/dist/types/bin/package/clean.d.ts +3 -0
  177. package/dist/types/bin/package/clean.d.ts.map +1 -0
  178. package/dist/types/bin/package/compile-only.d.ts +3 -0
  179. package/dist/types/bin/package/compile-only.d.ts.map +1 -0
  180. package/dist/types/bin/package/compile-tsup.d.ts +3 -0
  181. package/dist/types/bin/package/compile-tsup.d.ts.map +1 -0
  182. package/dist/types/bin/package/compile-types.d.ts +3 -0
  183. package/dist/types/bin/package/compile-types.d.ts.map +1 -0
  184. package/dist/types/bin/package/compile.d.ts +3 -0
  185. package/dist/types/bin/package/compile.d.ts.map +1 -0
  186. package/dist/types/bin/package/copy-assets-cjs.d.ts +3 -0
  187. package/dist/types/bin/package/copy-assets-cjs.d.ts.map +1 -0
  188. package/dist/types/bin/package/copy-assets-esm.d.ts +3 -0
  189. package/dist/types/bin/package/copy-assets-esm.d.ts.map +1 -0
  190. package/dist/types/bin/package/deps.d.ts +3 -0
  191. package/dist/types/bin/package/deps.d.ts.map +1 -0
  192. package/dist/types/bin/package/fix.d.ts +3 -0
  193. package/dist/types/bin/package/fix.d.ts.map +1 -0
  194. package/dist/types/bin/package/gen-docs.d.ts +3 -0
  195. package/dist/types/bin/package/gen-docs.d.ts.map +1 -0
  196. package/dist/types/bin/package/lint.d.ts +3 -0
  197. package/dist/types/bin/package/lint.d.ts.map +1 -0
  198. package/dist/types/bin/package/publint.d.ts +3 -0
  199. package/dist/types/bin/package/publint.d.ts.map +1 -0
  200. package/dist/types/bin/package/recompile.d.ts +3 -0
  201. package/dist/types/bin/package/recompile.d.ts.map +1 -0
  202. package/dist/types/bin/package/relint.d.ts +3 -0
  203. package/dist/types/bin/package/relint.d.ts.map +1 -0
  204. package/dist/types/bin/xy.d.ts +3 -0
  205. package/dist/types/bin/xy.d.ts.map +1 -0
  206. package/dist/types/index.d.ts +5 -0
  207. package/dist/types/index.d.ts.map +1 -0
  208. package/dist/types/lib/checkResult.d.ts +2 -0
  209. package/dist/types/lib/checkResult.d.ts.map +1 -0
  210. package/dist/types/lib/createBuildConfig.d.ts +2 -0
  211. package/dist/types/lib/createBuildConfig.d.ts.map +1 -0
  212. package/dist/types/lib/defaultBuildConfig.d.ts +9 -0
  213. package/dist/types/lib/defaultBuildConfig.d.ts.map +1 -0
  214. package/dist/types/lib/deleteGlob.d.ts +2 -0
  215. package/dist/types/lib/deleteGlob.d.ts.map +1 -0
  216. package/dist/types/lib/dependencies/DuplicateDetector.d.ts +9 -0
  217. package/dist/types/lib/dependencies/DuplicateDetector.d.ts.map +1 -0
  218. package/dist/types/lib/dependencies/detectDuplicateDependencies.d.ts +2 -0
  219. package/dist/types/lib/dependencies/detectDuplicateDependencies.d.ts.map +1 -0
  220. package/dist/types/lib/dependencies/index.d.ts +3 -0
  221. package/dist/types/lib/dependencies/index.d.ts.map +1 -0
  222. package/dist/types/lib/file/ReadFileSyncOptions.d.ts +6 -0
  223. package/dist/types/lib/file/ReadFileSyncOptions.d.ts.map +1 -0
  224. package/dist/types/lib/file/constants.d.ts +3 -0
  225. package/dist/types/lib/file/constants.d.ts.map +1 -0
  226. package/dist/types/lib/file/fileLines.d.ts +6 -0
  227. package/dist/types/lib/file/fileLines.d.ts.map +1 -0
  228. package/dist/types/lib/file/index.d.ts +5 -0
  229. package/dist/types/lib/file/index.d.ts.map +1 -0
  230. package/dist/types/lib/file/tryReadFileSync.d.ts +4 -0
  231. package/dist/types/lib/file/tryReadFileSync.d.ts.map +1 -0
  232. package/dist/types/lib/generateIgnoreFiles.d.ts +2 -0
  233. package/dist/types/lib/generateIgnoreFiles.d.ts.map +1 -0
  234. package/dist/types/lib/index.d.ts +21 -0
  235. package/dist/types/lib/index.d.ts.map +1 -0
  236. package/dist/types/lib/jsonFormatters.d.ts +2 -0
  237. package/dist/types/lib/jsonFormatters.d.ts.map +1 -0
  238. package/dist/types/lib/loadConfig.d.ts +2 -0
  239. package/dist/types/lib/loadConfig.d.ts.map +1 -0
  240. package/dist/types/lib/parsedPackageJSON.d.ts +2 -0
  241. package/dist/types/lib/parsedPackageJSON.d.ts.map +1 -0
  242. package/dist/types/lib/processEx.d.ts +2 -0
  243. package/dist/types/lib/processEx.d.ts.map +1 -0
  244. package/dist/types/lib/runSteps.d.ts +4 -0
  245. package/dist/types/lib/runSteps.d.ts.map +1 -0
  246. package/dist/types/lib/runStepsAsync.d.ts +4 -0
  247. package/dist/types/lib/runStepsAsync.d.ts.map +1 -0
  248. package/dist/types/lib/runXy.d.ts +2 -0
  249. package/dist/types/lib/runXy.d.ts.map +1 -0
  250. package/dist/types/lib/runXyWithWarning.d.ts +2 -0
  251. package/dist/types/lib/runXyWithWarning.d.ts.map +1 -0
  252. package/dist/types/lib/safeExit.d.ts +5 -0
  253. package/dist/types/lib/safeExit.d.ts.map +1 -0
  254. package/dist/types/lib/string/empty.d.ts +3 -0
  255. package/dist/types/lib/string/empty.d.ts.map +1 -0
  256. package/dist/types/lib/string/index.d.ts +3 -0
  257. package/dist/types/lib/string/index.d.ts.map +1 -0
  258. package/dist/types/lib/string/union.d.ts +2 -0
  259. package/dist/types/lib/string/union.d.ts.map +1 -0
  260. package/dist/types/lib/withErrnoException.d.ts +2 -0
  261. package/dist/types/lib/withErrnoException.d.ts.map +1 -0
  262. package/dist/types/lib/withError.d.ts +2 -0
  263. package/dist/types/lib/withError.d.ts.map +1 -0
  264. package/dist/types/lib/yarn/index.d.ts +4 -0
  265. package/dist/types/lib/yarn/index.d.ts.map +1 -0
  266. package/dist/types/lib/yarn/isYarnVersionOrGreater.d.ts +2 -0
  267. package/dist/types/lib/yarn/isYarnVersionOrGreater.d.ts.map +1 -0
  268. package/dist/types/lib/yarn/workspace/Workspace.d.ts +5 -0
  269. package/dist/types/lib/yarn/workspace/Workspace.d.ts.map +1 -0
  270. package/dist/types/lib/yarn/workspace/index.d.ts +4 -0
  271. package/dist/types/lib/yarn/workspace/index.d.ts.map +1 -0
  272. package/dist/types/lib/yarn/workspace/yarnWorkspace.d.ts +3 -0
  273. package/dist/types/lib/yarn/workspace/yarnWorkspace.d.ts.map +1 -0
  274. package/dist/types/lib/yarn/workspace/yarnWorkspaces.d.ts +3 -0
  275. package/dist/types/lib/yarn/workspace/yarnWorkspaces.d.ts.map +1 -0
  276. package/dist/types/lib/yarn/yarnInitCwd.d.ts +2 -0
  277. package/dist/types/lib/yarn/yarnInitCwd.d.ts.map +1 -0
  278. package/dist/types/loadPackageConfig.d.ts +6 -0
  279. package/dist/types/loadPackageConfig.d.ts.map +1 -0
  280. package/dist/types/xy/index.d.ts +8 -0
  281. package/dist/types/xy/index.d.ts.map +1 -0
  282. package/dist/types/xy/param.d.ts +5 -0
  283. package/dist/types/xy/param.d.ts.map +1 -0
  284. package/dist/types/xy/xy.d.ts +10 -0
  285. package/dist/types/xy/xy.d.ts.map +1 -0
  286. package/dist/types/xy/xyBuildCommands.d.ts +3 -0
  287. package/dist/types/xy/xyBuildCommands.d.ts.map +1 -0
  288. package/dist/types/xy/xyCommonCommands.d.ts +3 -0
  289. package/dist/types/xy/xyCommonCommands.d.ts.map +1 -0
  290. package/dist/types/xy/xyDeployCommands.d.ts +3 -0
  291. package/dist/types/xy/xyDeployCommands.d.ts.map +1 -0
  292. package/dist/types/xy/xyInstallCommands.d.ts +3 -0
  293. package/dist/types/xy/xyInstallCommands.d.ts.map +1 -0
  294. package/dist/types/xy/xyLintCommands.d.ts +3 -0
  295. package/dist/types/xy/xyLintCommands.d.ts.map +1 -0
  296. package/dist/types/xy/xyParseOptions.d.ts +3 -0
  297. package/dist/types/xy/xyParseOptions.d.ts.map +1 -0
  298. package/dist/xy/index.mjs +20 -12
  299. package/dist/xy/index.mjs.map +1 -1
  300. package/dist/xy/xy.mjs +20 -12
  301. package/dist/xy/xy.mjs.map +1 -1
  302. package/dist/xy/xyBuildCommands.mjs +20 -12
  303. package/dist/xy/xyBuildCommands.mjs.map +1 -1
  304. package/package.json +4 -4
  305. package/src/actions/build.ts +1 -0
  306. package/src/actions/compile-types.ts +1 -1
  307. package/src/actions/compile.ts +7 -11
  308. package/src/actions/package/compile/XyConfig.ts +0 -4
  309. package/src/actions/package/compile/compile.ts +8 -17
  310. package/src/actions/package/compile/packageCompileTscTypes.ts +21 -29
  311. package/src/actions/package/compile/packageCompileTsup.ts +12 -19
  312. package/src/bin/package/build-only.ts +1 -1
  313. package/src/bin/package/build.ts +1 -1
  314. package/src/bin/package/clean-outputs.ts +1 -8
  315. package/src/bin/package/clean-typescript.ts +1 -8
  316. package/src/xy/xyBuildCommands.ts +0 -1
@@ -166,6 +166,17 @@ var build = /* @__PURE__ */ __name(async ({ incremental, jobs, target, verbose,
166
166
  ...jobsOptions,
167
167
  ...incrementalOptions
168
168
  ]
169
+ ],
170
+ [
171
+ "yarn",
172
+ [
173
+ "xy",
174
+ "publint",
175
+ ...pkgOptions,
176
+ ...verboseOptions,
177
+ ...jobsOptions,
178
+ ...incrementalOptions
179
+ ]
169
180
  ]
170
181
  ]);
171
182
  console.log(`${chalk4.gray("Built in")} [${chalk4.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk4.gray("seconds")}`);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/actions/build.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 BuildParams {\n incremental?: boolean\n jobs?: number\n pkg?: string\n target?: 'esm' | 'cjs'\n verbose?: boolean\n}\n\nexport const build = async ({\n incremental, jobs, target, verbose, pkg,\n}: BuildParams) => {\n const start = Date.now()\n const pkgOptions = pkg ? [pkg] : [] // must go first\n const incrementalOptions = incremental ? ['-i'] : []\n const verboseOptions = verbose ? ['-v'] : []\n const targetOptions = target ? ['-t', target] : []\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(`Build${incremental ? '-Incremental' : ''} [${pkg ?? 'All'}]`, [\n ['yarn', ['xy', 'compile', ...pkgOptions, ...targetOptions, ...verboseOptions, ...jobsOptions, ...incrementalOptions, '--types', 'tsup']],\n ['yarn', ['xy', 'lint', ...pkgOptions, ...verboseOptions, ...incrementalOptions]],\n ['yarn', ['xy', 'deps', ...pkgOptions, ...verboseOptions, ...jobsOptions, ...incrementalOptions]],\n ])\n console.log(`${chalk.gray('Built 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 && !!ex.message),\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>(\n ex: unknown, closure: (error: T) => number,\n) => {\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 type { 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,OAAOA,YAAW;;;ACAlB,OAAOC,WAAW;AAEX,IAAMC,cAAc,wBAACC,MAAcC,QAAgBC,QAA0B,SAASC,aAAa,UAAK;AAC7G,MAAIF,QAAQ;AACV,UAAMG,UAAUD,aAAa,sBAAsB;AACnD,UAAME,YAAYH,UAAU,UAAUI,MAAMC,MAAMD,MAAME;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,OAAOW,YAAW;;;ACAX,IAAMC,YAAY,wBAEvBC,IACAC,SACAC,YAAY,CAACF,QAAW,CAAC,CAACA,IAAGG,QAAQ,CAAC,CAACH,IAAGI,YAAQ;AAElD,SAAOF,UAAUF,EAAAA,IAAWC,QAAQD,EAAAA,IAAWK;AACjD,GAPyB;;;ACElB,IAAMC,qBAAqB,wBAChCC,IAAaC,YAAAA;AAEb,SAAOC,UAAaF,IAAIC,SAAS,CAACD,QAAiBA,IAA6BG,UAAUC,MAAAA;AAC5F,GAJkC;;;AFG3B,IAAMC,YAAY,wBAACC,OAAAA;AACxB,QAAMC,QAAQ,OAAOD,OAAO,WAAW,IAAIE,MAAMF,EAAAA,IAAMA;AACvD,QAAMG,WACFC,mBAAmBH,OAAO,CAACA,WAAAA;AAC3B,QAAIA,OAAMI,SAAS,UAAU;AAC3BC,cAAQL,MAAMM,OAAMC,IAAI,IAAIP,OAAMQ,IAAI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AA;AAC1C,QAAMQ,gBAAgBT,SAAS;IAAC;IAAMA;MAAU,CAAA;AAChD,QAAMU,cAAcX,OAAO;IAAC;IAAM,GAAGA,IAAAA;MAAU,CAAA;AAC/C,MAAIA,MAAM;AACRY,YAAQC,IAAIC,OAAMC,KAAK,gBAAgBf,IAAAA,GAAO,CAAA;EAChD;AAEA,QAAMgB,SAAS,MAAMC,cAAc,QAAQlB,cAAc,iBAAiB,EAAA,KAAOI,OAAO,KAAA,KAAU;IAChG;MAAC;MAAQ;QAAC;QAAM;WAAcI;WAAeG;WAAkBD;WAAmBE;WAAgBH;QAAoB;QAAW;;;IACjI;MAAC;MAAQ;QAAC;QAAM;WAAWD;WAAeE;WAAmBD;;;IAC7D;MAAC;MAAQ;QAAC;QAAM;WAAWD;WAAeE;WAAmBE;WAAgBH;;;GAC9E;AACDI,UAAQC,IAAI,GAAGC,OAAMI,KAAK,UAAA,CAAA,KAAgBJ,OAAMK,UAAUd,KAAKC,IAAG,IAAKF,SAAS,KAAMgB,QAAQ,CAAA,CAAA,CAAA,KAAQN,OAAMI,KAAK,SAAA,CAAA,EAAY;AAC7H,SAAOF;AACT,GApBqB;","names":["chalk","chalk","checkResult","name","result","level","exitOnFail","exiting","chalkFunc","chalk","red","yellow","console","process","exit","chalk","withError","ex","closure","predicate","name","message","undefined","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","spawn","existsSync","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","build","incremental","jobs","target","verbose","pkg","start","Date","now","pkgOptions","incrementalOptions","verboseOptions","targetOptions","jobsOptions","console","log","chalk","blue","result","runStepsAsync","gray","magenta","toFixed"]}
1
+ {"version":3,"sources":["../../src/actions/build.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 BuildParams {\n incremental?: boolean\n jobs?: number\n pkg?: string\n target?: 'esm' | 'cjs'\n verbose?: boolean\n}\n\nexport const build = async ({\n incremental, jobs, target, verbose, pkg,\n}: BuildParams) => {\n const start = Date.now()\n const pkgOptions = pkg ? [pkg] : [] // must go first\n const incrementalOptions = incremental ? ['-i'] : []\n const verboseOptions = verbose ? ['-v'] : []\n const targetOptions = target ? ['-t', target] : []\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(`Build${incremental ? '-Incremental' : ''} [${pkg ?? 'All'}]`, [\n ['yarn', ['xy', 'compile', ...pkgOptions, ...targetOptions, ...verboseOptions, ...jobsOptions, ...incrementalOptions, '--types', 'tsup']],\n ['yarn', ['xy', 'lint', ...pkgOptions, ...verboseOptions, ...incrementalOptions]],\n ['yarn', ['xy', 'deps', ...pkgOptions, ...verboseOptions, ...jobsOptions, ...incrementalOptions]],\n ['yarn', ['xy', 'publint', ...pkgOptions, ...verboseOptions, ...jobsOptions, ...incrementalOptions]],\n ])\n console.log(`${chalk.gray('Built 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 && !!ex.message),\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>(\n ex: unknown, closure: (error: T) => number,\n) => {\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 type { 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,OAAOA,YAAW;;;ACAlB,OAAOC,WAAW;AAEX,IAAMC,cAAc,wBAACC,MAAcC,QAAgBC,QAA0B,SAASC,aAAa,UAAK;AAC7G,MAAIF,QAAQ;AACV,UAAMG,UAAUD,aAAa,sBAAsB;AACnD,UAAME,YAAYH,UAAU,UAAUI,MAAMC,MAAMD,MAAME;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,OAAOW,YAAW;;;ACAX,IAAMC,YAAY,wBAEvBC,IACAC,SACAC,YAAY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KAAQN,OAAMI,KAAK,SAAA,CAAA,EAAY;AAC7H,SAAOF;AACT,GArBqB;","names":["chalk","chalk","checkResult","name","result","level","exitOnFail","exiting","chalkFunc","chalk","red","yellow","console","process","exit","chalk","withError","ex","closure","predicate","name","message","undefined","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","spawn","existsSync","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","build","incremental","jobs","target","verbose","pkg","start","Date","now","pkgOptions","incrementalOptions","verboseOptions","targetOptions","jobsOptions","console","log","chalk","blue","result","runStepsAsync","gray","magenta","toFixed"]}
@@ -139,10 +139,10 @@ var compileTypesAll = /* @__PURE__ */ __name(({ jobs, verbose, incremental }) =>
139
139
  ];
140
140
  const incrementalOptions = incremental ? [
141
141
  "--since",
142
- "-Ap"
142
+ "-Apt"
143
143
  ] : [
144
144
  "--parallel",
145
- "-Ap"
145
+ "-Apt"
146
146
  ];
147
147
  const jobsOptions = jobs ? [
148
148
  "-j",
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/actions/compile-types.ts","../../src/lib/checkResult.ts","../../src/lib/processEx.ts","../../src/lib/withError.ts","../../src/lib/withErrnoException.ts","../../src/lib/safeExit.ts","../../src/lib/runSteps.ts"],"sourcesContent":["import chalk from 'chalk'\n\nimport { runSteps } from '../lib/index.ts'\n\nexport interface CompileTypesParams {\n incremental?: boolean\n jobs?: number\n pkg?: string\n verbose?: boolean\n}\n\ninterface CompileTypesPackageParams {\n pkg: string\n publint?: boolean\n verbose?: boolean\n}\n\nexport const compileTypes = ({\n verbose, pkg, incremental, jobs,\n}: CompileTypesParams) => {\n if (verbose) {\n console.log(chalk.gray('Compiling Types'))\n }\n return pkg\n ? compileTypesPackage({ pkg, verbose })\n : compileTypesAll({\n incremental, verbose, jobs,\n })\n}\n\nexport const compileTypesPackage = ({ verbose, pkg }: CompileTypesPackageParams) => {\n if (verbose) {\n console.log(chalk.gray('Compiling Types [Package]'))\n }\n return runSteps(\n `Compile [${pkg}]`,\n [['yarn', ['workspace', pkg, 'run', 'package-compile-types']]],\n )\n}\n\nexport const compileTypesAll = ({\n jobs, verbose, incremental,\n}: CompileTypesParams) => {\n if (verbose) {\n console.log(chalk.gray('Compiling Types [All]'))\n }\n const start = Date.now()\n const verboseOptions = verbose ? ['--verbose'] : ['--no-verbose']\n const incrementalOptions = incremental ? ['--since', '-Ap'] : ['--parallel', '-Ap']\n const jobsOptions = jobs ? ['-j', `${jobs}`] : []\n if (jobs) {\n console.log(chalk.blue(`Jobs set to [${jobs}]`))\n }\n\n const result = runSteps(`Compile Types ${incremental ? '[Incremental]' : ''} [All]`, [\n ['yarn', ['workspaces',\n 'foreach',\n ...incrementalOptions,\n ...jobsOptions,\n ...verboseOptions,\n 'run',\n 'package-compile-types',\n ]],\n ])\n console.log(`${chalk.gray('Types Compiled 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 && !!ex.message),\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>(\n ex: unknown, closure: (error: T) => number,\n) => {\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 type { SpawnSyncOptionsWithBufferEncoding } from 'node:child_process'\nimport { spawnSync } 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,OAAOA,YAAW;;;ACAlB,OAAOC,WAAW;AAEX,IAAMC,cAAc,wBAACC,MAAcC,QAAgBC,QAA0B,SAASC,aAAa,UAAK;AAC7G,MAAIF,QAAQ;AACV,UAAMG,UAAUD,aAAa,sBAAsB;AACnD,UAAME,YAAYH,UAAU,UAAUI,MAAMC,MAAMD,MAAME;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,OAAOW,YAAW;;;ACAX,IAAMC,YAAY,wBAEvBC,IACAC,SACAC,YAAY,CAACF,QAAW,CAAC,CAACA,IAAGG,QAAQ,CAAC,CAACH,IAAGI,YAAQ;AAElD,SAAOF,UAAUF,EAAAA,IAAWC,QAAQD,EAAAA,IAAWK;AACjD,GAPyB;;;ACElB,IAAMC,qBAAqB,wBAChCC,IAAaC,YAAAA;AAEb,SAAOC,UAAaF,IAAIC,SAAS,CAACD,QAAiBA,IAA6BG,UAAUC,MAAAA;AAC5F,GAJkC;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Q,kBAAkB,wBAAC,EAC9BN,MAAMH,SAASE,YAAW,MACP;AACnB,MAAIF,SAAS;AACXI,YAAQC,IAAIC,OAAMC,KAAK,uBAAA,CAAA;EACzB;AACA,QAAMI,QAAQC,KAAKC,IAAG;AACtB,QAAMC,iBAAiBd,UAAU;IAAC;MAAe;IAAC;;AAClD,QAAMe,qBAAqBb,cAAc;IAAC;IAAW;MAAS;IAAC;IAAc;;AAC7E,QAAMc,cAAcb,OAAO;IAAC;IAAM,GAAGA,IAAAA;MAAU,CAAA;AAC/C,MAAIA,MAAM;AACRC,YAAQC,IAAIC,OAAMW,KAAK,gBAAgBd,IAAAA,GAAO,CAAA;EAChD;AAEA,QAAMe,SAASR,SAAS,iBAAiBR,cAAc,kBAAkB,EAAA,UAAY;IACnF;MAAC;MAAQ;QAAC;QACR;WACGa;WACAC;WACAF;QACH;QACA;;;GAEH;AACDV,UAAQC,IAAI,GAAGC,OAAMC,KAAK,mBAAA,CAAA,KAAyBD,OAAMa,UAAUP,KAAKC,IAAG,IAAKF,SAAS,KAAMS,QAAQ,CAAA,CAAA,CAAA,KAAQd,OAAMC,KAAK,SAAA,CAAA,EAAY;AACtI,SAAOW;AACT,GA1B+B;","names":["chalk","chalk","checkResult","name","result","level","exitOnFail","exiting","chalkFunc","chalk","red","yellow","console","process","exit","chalk","withError","ex","closure","predicate","name","message","undefined","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","spawnSync","existsSync","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","compileTypes","verbose","pkg","incremental","jobs","console","log","chalk","gray","compileTypesPackage","compileTypesAll","runSteps","start","Date","now","verboseOptions","incrementalOptions","jobsOptions","blue","result","magenta","toFixed"]}
1
+ {"version":3,"sources":["../../src/actions/compile-types.ts","../../src/lib/checkResult.ts","../../src/lib/processEx.ts","../../src/lib/withError.ts","../../src/lib/withErrnoException.ts","../../src/lib/safeExit.ts","../../src/lib/runSteps.ts"],"sourcesContent":["import chalk from 'chalk'\n\nimport { runSteps } from '../lib/index.ts'\n\nexport interface CompileTypesParams {\n incremental?: boolean\n jobs?: number\n pkg?: string\n verbose?: boolean\n}\n\ninterface CompileTypesPackageParams {\n pkg: string\n publint?: boolean\n verbose?: boolean\n}\n\nexport const compileTypes = ({\n verbose, pkg, incremental, jobs,\n}: CompileTypesParams) => {\n if (verbose) {\n console.log(chalk.gray('Compiling Types'))\n }\n return pkg\n ? compileTypesPackage({ pkg, verbose })\n : compileTypesAll({\n incremental, verbose, jobs,\n })\n}\n\nexport const compileTypesPackage = ({ verbose, pkg }: CompileTypesPackageParams) => {\n if (verbose) {\n console.log(chalk.gray('Compiling Types [Package]'))\n }\n return runSteps(\n `Compile [${pkg}]`,\n [['yarn', ['workspace', pkg, 'run', 'package-compile-types']]],\n )\n}\n\nexport const compileTypesAll = ({\n jobs, verbose, incremental,\n}: CompileTypesParams) => {\n if (verbose) {\n console.log(chalk.gray('Compiling Types [All]'))\n }\n const start = Date.now()\n const verboseOptions = verbose ? ['--verbose'] : ['--no-verbose']\n const incrementalOptions = incremental ? ['--since', '-Apt'] : ['--parallel', '-Apt']\n const jobsOptions = jobs ? ['-j', `${jobs}`] : []\n if (jobs) {\n console.log(chalk.blue(`Jobs set to [${jobs}]`))\n }\n\n const result = runSteps(`Compile Types ${incremental ? '[Incremental]' : ''} [All]`, [\n ['yarn', ['workspaces',\n 'foreach',\n ...incrementalOptions,\n ...jobsOptions,\n ...verboseOptions,\n 'run',\n 'package-compile-types',\n ]],\n ])\n console.log(`${chalk.gray('Types Compiled 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 && !!ex.message),\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>(\n ex: unknown, closure: (error: T) => number,\n) => {\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 type { SpawnSyncOptionsWithBufferEncoding } from 'node:child_process'\nimport { spawnSync } 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,OAAOA,YAAW;;;ACAlB,OAAOC,WAAW;AAEX,IAAMC,cAAc,wBAACC,MAAcC,QAAgBC,QAA0B,SAASC,aAAa,UAAK;AAC7G,MAAIF,QAAQ;AACV,UAAMG,UAAUD,aAAa,sBAAsB;AACnD,UAAME,YAAYH,UAAU,UAAUI,MAAMC,MAAMD,MAAME;AACxDC,YAAQP,KAAAA,EAAOG,UAAU,GAAGL,IAAAA,QAAYC,MAAAA,aAAmBG,OAAAA,EAAS,CAAA;AACpE,QA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AQC,IAAIC,OAAMC,KAAK,iBAAA,CAAA;EACzB;AACA,SAAON,MACHO,oBAAoB;IAAEP;IAAKD;EAAQ,CAAA,IACnCS,gBAAgB;IACdP;IAAaF;IAASG;EACxB,CAAA;AACN,GAX4B;AAarB,IAAMK,sBAAsB,wBAAC,EAAER,SAASC,IAAG,MAA6B;AAC7E,MAAID,SAAS;AACXI,YAAQC,IAAIC,OAAMC,KAAK,2BAAA,CAAA;EACzB;AACA,SAAOG,SACL,YAAYT,GAAAA,KACZ;IAAC;MAAC;MAAQ;QAAC;QAAaA;QAAK;QAAO;;;GAA0B;AAElE,GARmC;AAU5B,IAAMQ,kBAAkB,wBAAC,EAC9BN,MAAMH,SAASE,YAAW,MACP;AACnB,MAAIF,SAAS;AACXI,YAAQC,IAAIC,OAAMC,KAAK,uBAAA,CAAA;EACzB;AACA,QAAMI,QAAQC,KAAKC,IAAG;AACtB,QAAMC,iBAAiBd,UAAU;IAAC;MAAe;IAAC;;AAClD,QAAMe,qBAAqBb,cAAc;IAAC;IAAW;MAAU;IAAC;IAAc;;AAC9E,QAAMc,cAAcb,OAAO;IAAC;IAAM,GAAGA,IAAAA;MAAU,CAAA;AAC/C,MAAIA,MAAM;AACRC,YAAQC,IAAIC,OAAMW,KAAK,gBAAgBd,IAAAA,GAAO,CAAA;EAChD;AAEA,QAAMe,SAASR,SAAS,iBAAiBR,cAAc,kBAAkB,EAAA,UAAY;IACnF;MAAC;MAAQ;QAAC;QACR;WACGa;WACAC;WACAF;QACH;QACA;;;GAEH;AACDV,UAAQC,IAAI,GAAGC,OAAMC,KAAK,mBAAA,CAAA,KAAyBD,OAAMa,UAAUP,KAAKC,IAAG,IAAKF,SAAS,KAAMS,QAAQ,CAAA,CAAA,CAAA,KAAQd,OAAMC,KAAK,SAAA,CAAA,EAAY;AACtI,SAAOW;AACT,GA1B+B;","names":["chalk","chalk","checkResult","name","result","level","exitOnFail","exiting","chalkFunc","chalk","red","yellow","console","process","exit","chalk","withError","ex","closure","predicate","name","message","undefined","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","spawnSync","existsSync","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","compileTypes","verbose","pkg","incremental","jobs","console","log","chalk","gray","compileTypesPackage","compileTypesAll","runSteps","start","Date","now","verboseOptions","incrementalOptions","jobsOptions","blue","result","magenta","toFixed"]}
@@ -98,23 +98,21 @@ var runSteps = /* @__PURE__ */ __name((name, steps, exitOnFail = true, messages)
98
98
  }, "runSteps");
99
99
 
100
100
  // src/actions/compile.ts
101
- var compile = /* @__PURE__ */ __name(({ verbose, target, pkg, incremental, publint, jobs, types }) => {
101
+ var compile = /* @__PURE__ */ __name(({ verbose, target, pkg, incremental, publint, jobs }) => {
102
102
  return pkg ? compilePackage({
103
103
  pkg,
104
104
  publint,
105
105
  target,
106
- verbose,
107
- types
106
+ verbose
108
107
  }) : compileAll({
109
108
  incremental,
110
109
  publint,
111
110
  target,
112
111
  verbose,
113
- jobs,
114
- types
112
+ jobs
115
113
  });
116
114
  }, "compile");
117
- var compilePackage = /* @__PURE__ */ __name(({ target, pkg, types }) => {
115
+ var compilePackage = /* @__PURE__ */ __name(({ target, pkg }) => {
118
116
  const targetOptions = target ? [
119
117
  "-t",
120
118
  target
@@ -126,13 +124,13 @@ var compilePackage = /* @__PURE__ */ __name(({ target, pkg, types }) => {
126
124
  "workspace",
127
125
  pkg,
128
126
  "run",
129
- types === "tsup" ? "package-compile" : "package-build",
127
+ "package-compile",
130
128
  ...targetOptions
131
129
  ]
132
130
  ]
133
131
  ]);
134
132
  }, "compilePackage");
135
- var compileAll = /* @__PURE__ */ __name(({ jobs, verbose, target, incremental, types }) => {
133
+ var compileAll = /* @__PURE__ */ __name(({ jobs, verbose, target, incremental }) => {
136
134
  const start = Date.now();
137
135
  const verboseOptions = verbose ? [
138
136
  "--verbose"
@@ -169,7 +167,7 @@ var compileAll = /* @__PURE__ */ __name(({ jobs, verbose, target, incremental, t
169
167
  ...jobsOptions,
170
168
  ...verboseOptions,
171
169
  "run",
172
- types === "tsup" ? "package-compile" : "package-build",
170
+ "package-compile",
173
171
  ...targetOptions
174
172
  ]
175
173
  ]
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/actions/compile.ts","../../src/lib/checkResult.ts","../../src/lib/processEx.ts","../../src/lib/withError.ts","../../src/lib/withErrnoException.ts","../../src/lib/safeExit.ts","../../src/lib/runSteps.ts"],"sourcesContent":["import chalk from 'chalk'\n\nimport { runSteps } from '../lib/index.ts'\n\nexport interface CompileParams {\n incremental?: boolean\n jobs?: number\n pkg?: string\n publint?: boolean\n target?: 'esm' | 'cjs'\n types?: 'tsc' | 'tsup'\n verbose?: boolean\n}\n\ninterface CompilePackageParams {\n pkg: string\n publint?: boolean\n target?: 'esm' | 'cjs'\n types?: 'tsc' | 'tsup'\n verbose?: boolean\n}\n\nexport const compile = ({\n verbose, target, pkg, incremental, publint, jobs, types,\n}: CompileParams) => {\n return pkg\n ? compilePackage({\n pkg, publint, target, verbose, types,\n })\n : compileAll({\n incremental, publint, target, verbose, jobs, types,\n })\n}\n\nexport const compilePackage = ({\n target, pkg, types,\n}: CompilePackageParams) => {\n const targetOptions = target ? ['-t', target] : []\n\n return runSteps(\n `Compile [${pkg}]`,\n [['yarn', ['workspace', pkg, 'run', types === 'tsup' ? 'package-compile' : 'package-build', ...targetOptions]]],\n )\n}\n\nexport const compileAll = ({\n jobs, verbose, target, incremental, types,\n}: CompileParams) => {\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 = runSteps(`Compile${incremental ? '-Incremental' : ''} [All]`, [\n ['yarn', ['workspaces',\n 'foreach',\n ...incrementalOptions,\n ...jobsOptions,\n ...verboseOptions,\n 'run',\n types === 'tsup' ? 'package-compile' : 'package-build',\n ...targetOptions,\n ]],\n ])\n console.log(`${chalk.gray('Compiled 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 && !!ex.message),\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>(\n ex: unknown, closure: (error: T) => number,\n) => {\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 type { SpawnSyncOptionsWithBufferEncoding } from 'node:child_process'\nimport { spawnSync } 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 totalSt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,SAAS,UAAUP,cAAc,iBAAiB,EAAA,UAAY;IAC3E;MAAC;MAAQ;QAAC;QACR;WACGY;WACAC;WACAF;QACH;QACAR,UAAU,SAAS,oBAAoB;WACpCG;;;GAEN;AACDQ,UAAQC,IAAI,GAAGC,OAAMG,KAAK,aAAA,CAAA,KAAmBH,OAAMI,UAAUX,KAAKC,IAAG,IAAKF,SAAS,KAAMa,QAAQ,CAAA,CAAA,CAAA,KAAQL,OAAMG,KAAK,SAAA,CAAA,EAAY;AAChI,SAAOD;AACT,GAzB0B;","names":["chalk","chalk","checkResult","name","result","level","exitOnFail","exiting","chalkFunc","chalk","red","yellow","console","process","exit","chalk","withError","ex","closure","predicate","name","message","undefined","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","spawnSync","existsSync","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","compile","verbose","target","pkg","incremental","publint","jobs","types","compilePackage","compileAll","targetOptions","runSteps","start","Date","now","verboseOptions","incrementalOptions","jobsOptions","console","log","chalk","blue","result","gray","magenta","toFixed"]}
1
+ {"version":3,"sources":["../../src/actions/compile.ts","../../src/lib/checkResult.ts","../../src/lib/processEx.ts","../../src/lib/withError.ts","../../src/lib/withErrnoException.ts","../../src/lib/safeExit.ts","../../src/lib/runSteps.ts"],"sourcesContent":["import chalk from 'chalk'\n\nimport { runSteps } from '../lib/index.ts'\n\nexport interface CompileParams {\n incremental?: boolean\n jobs?: number\n pkg?: string\n publint?: boolean\n target?: 'esm' | 'cjs'\n verbose?: boolean\n}\n\ninterface CompilePackageParams {\n pkg: string\n publint?: boolean\n target?: 'esm' | 'cjs'\n verbose?: boolean\n}\n\nexport const compile = ({\n verbose, target, pkg, incremental, publint, jobs,\n}: CompileParams) => {\n return pkg\n ? compilePackage({\n pkg, publint, target, verbose,\n })\n : compileAll({\n incremental, publint, target, verbose, jobs,\n })\n}\n\nexport const compilePackage = ({ target, pkg }: CompilePackageParams) => {\n const targetOptions = target ? ['-t', target] : []\n\n return runSteps(\n `Compile [${pkg}]`,\n [['yarn', ['workspace', pkg, 'run', 'package-compile', ...targetOptions]]],\n )\n}\n\nexport const compileAll = ({\n jobs, verbose, target, incremental,\n}: CompileParams) => {\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 = runSteps(`Compile${incremental ? '-Incremental' : ''} [All]`, [\n ['yarn', ['workspaces',\n 'foreach',\n ...incrementalOptions,\n ...jobsOptions,\n ...verboseOptions,\n 'run',\n 'package-compile',\n ...targetOptions,\n ]],\n ])\n console.log(`${chalk.gray('Compiled 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 && !!ex.message),\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>(\n ex: unknown, closure: (error: T) => number,\n) => {\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 type { SpawnSyncOptionsWithBufferEncoding } from 'node:child_process'\nimport { spawnSync } 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,OAAOA,YAAW;;;ACAlB,OAAOC,WAAW;AAEX,IAAMC,cAAc,wBAACC,MAAcC,QAAgBC,QAA0B,SAASC,aAAa,UAAK;AAC7G,MAAIF,QAAQ;AACV,UAAMG,UAAUD,aAAa,sBAAsB;AACnD,UAAME,YAAYH,UAAU,UAAUI,MAAMC,MAAMD,MAAME;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,OAAOW,YAAW;;;ACAX,IAAMC,YAAY,wBAEvBC,IACAC,SACAC,YAAY,CAACF,QAAW,CAAC,CAACA,IAAGG,QAAQ,CAAC,CAACH,IAAGI,YAAQ;AAElD,SAAOF,UAAUF,EAAAA,IAAWC,QAAQD,EAAAA,IAAWK;AACjD,GAPyB;;;ACElB,IAAMC,qBAAqB,wBAChCC,IAAaC,YAAAA;AAEb,SAAOC,UAAaF,IAAIC,SAAS,CAACD,QAAiBA,IAA6BG,UAAUC,MAAAA;AAC5F,GAJkC;;;AFG3B,IAAMC,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d,QAAMO,QAAQC,KAAKC,IAAG;AACtB,QAAMC,iBAAiBb,UAAU;IAAC;MAAe;IAAC;;AAClD,QAAMQ,gBAAgBP,SAAS;IAAC;IAAMA;MAAU,CAAA;AAChD,QAAMa,qBAAqBX,cAAc;IAAC;IAAW;IAAQ;MAAuB;IAAC;IAAc;IAAQ;;AAC3G,QAAMY,cAAcV,OAAO;IAAC;IAAM,GAAGA,IAAAA;MAAU,CAAA;AAC/C,MAAIA,MAAM;AACRW,YAAQC,IAAIC,OAAMC,KAAK,gBAAgBd,IAAAA,GAAO,CAAA;EAChD;AAEA,QAAMe,SAASX,SAAS,UAAUN,cAAc,iBAAiB,EAAA,UAAY;IAC3E;MAAC;MAAQ;QAAC;QACR;WACGW;WACAC;WACAF;QACH;QACA;WACGL;;;GAEN;AACDQ,UAAQC,IAAI,GAAGC,OAAMG,KAAK,aAAA,CAAA,KAAmBH,OAAMI,UAAUX,KAAKC,IAAG,IAAKF,SAAS,KAAMa,QAAQ,CAAA,CAAA,CAAA,KAAQL,OAAMG,KAAK,SAAA,CAAA,EAAY;AAChI,SAAOD;AACT,GAzB0B;","names":["chalk","chalk","checkResult","name","result","level","exitOnFail","exiting","chalkFunc","chalk","red","yellow","console","process","exit","chalk","withError","ex","closure","predicate","name","message","undefined","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","spawnSync","existsSync","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","compile","verbose","target","pkg","incremental","publint","jobs","compilePackage","compileAll","targetOptions","runSteps","start","Date","now","verboseOptions","incrementalOptions","jobsOptions","console","log","chalk","blue","result","gray","magenta","toFixed"]}