@xylabs/ts-scripts-yarn3 3.15.16 → 4.0.0-rc.11

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 (360) hide show
  1. package/dist/actions/compile.mjs +3 -2
  2. package/dist/actions/compile.mjs.map +1 -1
  3. package/dist/actions/cycle.mjs +32 -110
  4. package/dist/actions/cycle.mjs.map +1 -1
  5. package/dist/actions/index.mjs +131 -307
  6. package/dist/actions/index.mjs.map +1 -1
  7. package/dist/actions/package/compile/compile.mjs +57 -259
  8. package/dist/actions/package/compile/compile.mjs.map +1 -1
  9. package/dist/actions/package/compile/index.mjs +57 -259
  10. package/dist/actions/package/compile/index.mjs.map +1 -1
  11. package/dist/actions/package/compile/packageCompileTsc.mjs +1 -1
  12. package/dist/actions/package/compile/packageCompileTsc.mjs.map +1 -1
  13. package/dist/actions/package/compile/packageCompileTscTypes.mjs +2 -36
  14. package/dist/actions/package/compile/packageCompileTscTypes.mjs.map +1 -1
  15. package/dist/actions/package/compile/packageCompileTsup.mjs +54 -339
  16. package/dist/actions/package/compile/packageCompileTsup.mjs.map +1 -1
  17. package/dist/actions/package/index.mjs +72 -277
  18. package/dist/actions/package/index.mjs.map +1 -1
  19. package/dist/actions/package/recompile.mjs +58 -263
  20. package/dist/actions/package/recompile.mjs.map +1 -1
  21. package/dist/actions/recompile.mjs +14 -1
  22. package/dist/actions/recompile.mjs.map +1 -1
  23. package/dist/bin/package/compile-only.mjs +59 -261
  24. package/dist/bin/package/compile-only.mjs.map +1 -1
  25. package/dist/bin/package/compile-tsup.mjs +56 -341
  26. package/dist/bin/package/compile-tsup.mjs.map +1 -1
  27. package/dist/bin/package/compile.mjs +59 -261
  28. package/dist/bin/package/compile.mjs.map +1 -1
  29. package/dist/bin/package/recompile.mjs +60 -265
  30. package/dist/bin/package/recompile.mjs.map +1 -1
  31. package/dist/bin/xy-ts.mjs +56 -27
  32. package/dist/bin/xy-ts.mjs.map +1 -1
  33. package/dist/bin/xy.mjs +56 -27
  34. package/dist/bin/xy.mjs.map +1 -1
  35. package/dist/index.d.ts +2 -2
  36. package/dist/index.mjs +143 -319
  37. package/dist/index.mjs.map +1 -1
  38. package/dist/xy/index.mjs +56 -27
  39. package/dist/xy/index.mjs.map +1 -1
  40. package/dist/xy/xy.mjs +56 -27
  41. package/dist/xy/xy.mjs.map +1 -1
  42. package/dist/xy/xyBuildCommands.mjs +17 -3
  43. package/dist/xy/xyBuildCommands.mjs.map +1 -1
  44. package/dist/xy/xyLintCommands.mjs +37 -22
  45. package/dist/xy/xyLintCommands.mjs.map +1 -1
  46. package/package.json +11 -20
  47. package/src/actions/compile.ts +2 -2
  48. package/src/actions/cycle.ts +21 -4
  49. package/src/actions/package/compile/XyConfig.ts +2 -2
  50. package/src/actions/package/compile/packageCompileTsc.ts +1 -1
  51. package/src/actions/package/compile/packageCompileTscTypes.ts +3 -8
  52. package/src/actions/package/compile/packageCompileTsup.ts +54 -130
  53. package/src/actions/package/recompile.ts +1 -1
  54. package/src/actions/recompile.ts +2 -1
  55. package/src/types.d.ts +23 -0
  56. package/src/xy/xyLintCommands.ts +2 -2
  57. package/tsup.config.ts +1 -1
  58. package/dist/actions/build.cjs +0 -208
  59. package/dist/actions/build.cjs.map +0 -1
  60. package/dist/actions/clean-docs.cjs +0 -74
  61. package/dist/actions/clean-docs.cjs.map +0 -1
  62. package/dist/actions/clean-eslint.cjs +0 -53
  63. package/dist/actions/clean-eslint.cjs.map +0 -1
  64. package/dist/actions/clean-jest.cjs +0 -147
  65. package/dist/actions/clean-jest.cjs.map +0 -1
  66. package/dist/actions/clean.cjs +0 -192
  67. package/dist/actions/clean.cjs.map +0 -1
  68. package/dist/actions/compile.cjs +0 -217
  69. package/dist/actions/compile.cjs.map +0 -1
  70. package/dist/actions/copy-assets.cjs +0 -121
  71. package/dist/actions/copy-assets.cjs.map +0 -1
  72. package/dist/actions/cycle.cjs +0 -156
  73. package/dist/actions/cycle.cjs.map +0 -1
  74. package/dist/actions/dead.cjs +0 -148
  75. package/dist/actions/dead.cjs.map +0 -1
  76. package/dist/actions/deploy-major.cjs +0 -160
  77. package/dist/actions/deploy-major.cjs.map +0 -1
  78. package/dist/actions/deploy-minor.cjs +0 -160
  79. package/dist/actions/deploy-minor.cjs.map +0 -1
  80. package/dist/actions/deploy-next.cjs +0 -160
  81. package/dist/actions/deploy-next.cjs.map +0 -1
  82. package/dist/actions/deploy.cjs +0 -160
  83. package/dist/actions/deploy.cjs.map +0 -1
  84. package/dist/actions/deps.cjs +0 -205
  85. package/dist/actions/deps.cjs.map +0 -1
  86. package/dist/actions/dupdeps.cjs +0 -226
  87. package/dist/actions/dupdeps.cjs.map +0 -1
  88. package/dist/actions/fix.cjs +0 -149
  89. package/dist/actions/fix.cjs.map +0 -1
  90. package/dist/actions/gen-docs.cjs +0 -186
  91. package/dist/actions/gen-docs.cjs.map +0 -1
  92. package/dist/actions/gitignore-gen.cjs +0 -138
  93. package/dist/actions/gitignore-gen.cjs.map +0 -1
  94. package/dist/actions/gitlint-fix.cjs +0 -69
  95. package/dist/actions/gitlint-fix.cjs.map +0 -1
  96. package/dist/actions/gitlint.cjs +0 -84
  97. package/dist/actions/gitlint.cjs.map +0 -1
  98. package/dist/actions/index.cjs +0 -2600
  99. package/dist/actions/index.cjs.map +0 -1
  100. package/dist/actions/license.cjs +0 -133
  101. package/dist/actions/license.cjs.map +0 -1
  102. package/dist/actions/lint-clean.cjs +0 -227
  103. package/dist/actions/lint-clean.cjs.map +0 -1
  104. package/dist/actions/lint-profile.cjs +0 -153
  105. package/dist/actions/lint-profile.cjs.map +0 -1
  106. package/dist/actions/lint.cjs +0 -217
  107. package/dist/actions/lint.cjs.map +0 -1
  108. package/dist/actions/npmignore-gen.cjs +0 -138
  109. package/dist/actions/npmignore-gen.cjs.map +0 -1
  110. package/dist/actions/package/clean-outputs.cjs +0 -56
  111. package/dist/actions/package/clean-outputs.cjs.map +0 -1
  112. package/dist/actions/package/clean-typescript.cjs +0 -56
  113. package/dist/actions/package/clean-typescript.cjs.map +0 -1
  114. package/dist/actions/package/clean.cjs +0 -83
  115. package/dist/actions/package/clean.cjs.map +0 -1
  116. package/dist/actions/package/compile/XyConfig.cjs +0 -19
  117. package/dist/actions/package/compile/XyConfig.cjs.map +0 -1
  118. package/dist/actions/package/compile/buildEntries.cjs +0 -68
  119. package/dist/actions/package/compile/buildEntries.cjs.map +0 -1
  120. package/dist/actions/package/compile/compile.cjs +0 -565
  121. package/dist/actions/package/compile/compile.cjs.map +0 -1
  122. package/dist/actions/package/compile/copyTypeFiles.cjs +0 -60
  123. package/dist/actions/package/compile/copyTypeFiles.cjs.map +0 -1
  124. package/dist/actions/package/compile/getCompilerOptions.cjs +0 -67
  125. package/dist/actions/package/compile/getCompilerOptions.cjs.map +0 -1
  126. package/dist/actions/package/compile/index.cjs +0 -571
  127. package/dist/actions/package/compile/index.cjs.map +0 -1
  128. package/dist/actions/package/compile/inputs.cjs +0 -79
  129. package/dist/actions/package/compile/inputs.cjs.map +0 -1
  130. package/dist/actions/package/compile/packageCompileTsc.cjs +0 -164
  131. package/dist/actions/package/compile/packageCompileTsc.cjs.map +0 -1
  132. package/dist/actions/package/compile/packageCompileTscTypes.cjs +0 -199
  133. package/dist/actions/package/compile/packageCompileTscTypes.cjs.map +0 -1
  134. package/dist/actions/package/compile/packageCompileTsup.cjs +0 -521
  135. package/dist/actions/package/compile/packageCompileTsup.cjs.map +0 -1
  136. package/dist/actions/package/copy-assets.cjs +0 -88
  137. package/dist/actions/package/copy-assets.cjs.map +0 -1
  138. package/dist/actions/package/deps.cjs +0 -214
  139. package/dist/actions/package/deps.cjs.map +0 -1
  140. package/dist/actions/package/gen-docs.cjs +0 -148
  141. package/dist/actions/package/gen-docs.cjs.map +0 -1
  142. package/dist/actions/package/index.cjs +0 -968
  143. package/dist/actions/package/index.cjs.map +0 -1
  144. package/dist/actions/package/publint.cjs +0 -80
  145. package/dist/actions/package/publint.cjs.map +0 -1
  146. package/dist/actions/package/recompile.cjs +0 -617
  147. package/dist/actions/package/recompile.cjs.map +0 -1
  148. package/dist/actions/publint.cjs +0 -237
  149. package/dist/actions/publint.cjs.map +0 -1
  150. package/dist/actions/rebuild.cjs +0 -148
  151. package/dist/actions/rebuild.cjs.map +0 -1
  152. package/dist/actions/recompile.cjs +0 -232
  153. package/dist/actions/recompile.cjs.map +0 -1
  154. package/dist/actions/reinstall.cjs +0 -183
  155. package/dist/actions/reinstall.cjs.map +0 -1
  156. package/dist/actions/relint.cjs +0 -185
  157. package/dist/actions/relint.cjs.map +0 -1
  158. package/dist/actions/retest.cjs +0 -154
  159. package/dist/actions/retest.cjs.map +0 -1
  160. package/dist/actions/sonar.cjs +0 -149
  161. package/dist/actions/sonar.cjs.map +0 -1
  162. package/dist/actions/statics.cjs +0 -234
  163. package/dist/actions/statics.cjs.map +0 -1
  164. package/dist/actions/test.cjs +0 -147
  165. package/dist/actions/test.cjs.map +0 -1
  166. package/dist/actions/up.cjs +0 -144
  167. package/dist/actions/up.cjs.map +0 -1
  168. package/dist/actions/updo.cjs +0 -152
  169. package/dist/actions/updo.cjs.map +0 -1
  170. package/dist/actions/upplug.cjs +0 -172
  171. package/dist/actions/upplug.cjs.map +0 -1
  172. package/dist/actions/upyarn.cjs +0 -148
  173. package/dist/actions/upyarn.cjs.map +0 -1
  174. package/dist/actions/yarn3only.cjs +0 -106
  175. package/dist/actions/yarn3only.cjs.map +0 -1
  176. package/dist/bin/build.cjs +0 -39
  177. package/dist/bin/build.cjs.map +0 -1
  178. package/dist/bin/clean.cjs +0 -39
  179. package/dist/bin/clean.cjs.map +0 -1
  180. package/dist/bin/compile-only.cjs +0 -39
  181. package/dist/bin/compile-only.cjs.map +0 -1
  182. package/dist/bin/compile.cjs +0 -39
  183. package/dist/bin/compile.cjs.map +0 -1
  184. package/dist/bin/cycle.cjs +0 -39
  185. package/dist/bin/cycle.cjs.map +0 -1
  186. package/dist/bin/dead.cjs +0 -39
  187. package/dist/bin/dead.cjs.map +0 -1
  188. package/dist/bin/deploy-major.cjs +0 -39
  189. package/dist/bin/deploy-major.cjs.map +0 -1
  190. package/dist/bin/deploy-minor.cjs +0 -39
  191. package/dist/bin/deploy-minor.cjs.map +0 -1
  192. package/dist/bin/deploy-next.cjs +0 -39
  193. package/dist/bin/deploy-next.cjs.map +0 -1
  194. package/dist/bin/deploy.cjs +0 -39
  195. package/dist/bin/deploy.cjs.map +0 -1
  196. package/dist/bin/deps.cjs +0 -39
  197. package/dist/bin/deps.cjs.map +0 -1
  198. package/dist/bin/fix.cjs +0 -39
  199. package/dist/bin/fix.cjs.map +0 -1
  200. package/dist/bin/gen-docs.cjs +0 -39
  201. package/dist/bin/gen-docs.cjs.map +0 -1
  202. package/dist/bin/gitlint-fix.cjs +0 -39
  203. package/dist/bin/gitlint-fix.cjs.map +0 -1
  204. package/dist/bin/gitlint.cjs +0 -39
  205. package/dist/bin/gitlint.cjs.map +0 -1
  206. package/dist/bin/license.cjs +0 -39
  207. package/dist/bin/license.cjs.map +0 -1
  208. package/dist/bin/lint-clean.cjs +0 -39
  209. package/dist/bin/lint-clean.cjs.map +0 -1
  210. package/dist/bin/lint-fast.cjs +0 -39
  211. package/dist/bin/lint-fast.cjs.map +0 -1
  212. package/dist/bin/lint-profile.cjs +0 -39
  213. package/dist/bin/lint-profile.cjs.map +0 -1
  214. package/dist/bin/lint.cjs +0 -39
  215. package/dist/bin/lint.cjs.map +0 -1
  216. package/dist/bin/package/clean-outputs.cjs +0 -51
  217. package/dist/bin/package/clean-outputs.cjs.map +0 -1
  218. package/dist/bin/package/clean-typescript.cjs +0 -51
  219. package/dist/bin/package/clean-typescript.cjs.map +0 -1
  220. package/dist/bin/package/clean.cjs +0 -76
  221. package/dist/bin/package/clean.cjs.map +0 -1
  222. package/dist/bin/package/compile-only.cjs +0 -564
  223. package/dist/bin/package/compile-only.cjs.map +0 -1
  224. package/dist/bin/package/compile-tsup.cjs +0 -519
  225. package/dist/bin/package/compile-tsup.cjs.map +0 -1
  226. package/dist/bin/package/compile.cjs +0 -567
  227. package/dist/bin/package/compile.cjs.map +0 -1
  228. package/dist/bin/package/copy-assets-cjs.cjs +0 -86
  229. package/dist/bin/package/copy-assets-cjs.cjs.map +0 -1
  230. package/dist/bin/package/copy-assets-esm.cjs +0 -86
  231. package/dist/bin/package/copy-assets-esm.cjs.map +0 -1
  232. package/dist/bin/package/deps.cjs +0 -208
  233. package/dist/bin/package/deps.cjs.map +0 -1
  234. package/dist/bin/package/gen-docs.cjs +0 -143
  235. package/dist/bin/package/gen-docs.cjs.map +0 -1
  236. package/dist/bin/package/publint.cjs +0 -77
  237. package/dist/bin/package/publint.cjs.map +0 -1
  238. package/dist/bin/package/recompile.cjs +0 -611
  239. package/dist/bin/package/recompile.cjs.map +0 -1
  240. package/dist/bin/publint.cjs +0 -39
  241. package/dist/bin/publint.cjs.map +0 -1
  242. package/dist/bin/rebuild.cjs +0 -39
  243. package/dist/bin/rebuild.cjs.map +0 -1
  244. package/dist/bin/recompile.cjs +0 -39
  245. package/dist/bin/recompile.cjs.map +0 -1
  246. package/dist/bin/reinstall.cjs +0 -39
  247. package/dist/bin/reinstall.cjs.map +0 -1
  248. package/dist/bin/relint.cjs +0 -39
  249. package/dist/bin/relint.cjs.map +0 -1
  250. package/dist/bin/sonar.cjs +0 -39
  251. package/dist/bin/sonar.cjs.map +0 -1
  252. package/dist/bin/test.cjs +0 -39
  253. package/dist/bin/test.cjs.map +0 -1
  254. package/dist/bin/up.cjs +0 -39
  255. package/dist/bin/up.cjs.map +0 -1
  256. package/dist/bin/updo.cjs +0 -39
  257. package/dist/bin/updo.cjs.map +0 -1
  258. package/dist/bin/upplug.cjs +0 -39
  259. package/dist/bin/upplug.cjs.map +0 -1
  260. package/dist/bin/upyarn.cjs +0 -39
  261. package/dist/bin/upyarn.cjs.map +0 -1
  262. package/dist/bin/xy-ts.cjs +0 -1890
  263. package/dist/bin/xy-ts.cjs.map +0 -1
  264. package/dist/bin/xy.cjs +0 -1890
  265. package/dist/bin/xy.cjs.map +0 -1
  266. package/dist/bin/yarn3only.cjs +0 -39
  267. package/dist/bin/yarn3only.cjs.map +0 -1
  268. package/dist/index.cjs +0 -3129
  269. package/dist/index.cjs.map +0 -1
  270. package/dist/index.d.cts +0 -359
  271. package/dist/lib/checkResult.cjs +0 -52
  272. package/dist/lib/checkResult.cjs.map +0 -1
  273. package/dist/lib/createBuildConfig.cjs +0 -93
  274. package/dist/lib/createBuildConfig.cjs.map +0 -1
  275. package/dist/lib/defaultBuildConfig.cjs +0 -52
  276. package/dist/lib/defaultBuildConfig.cjs.map +0 -1
  277. package/dist/lib/dependencies/DuplicateDetector.cjs +0 -124
  278. package/dist/lib/dependencies/DuplicateDetector.cjs.map +0 -1
  279. package/dist/lib/dependencies/detectDuplicateDependencies.cjs +0 -207
  280. package/dist/lib/dependencies/detectDuplicateDependencies.cjs.map +0 -1
  281. package/dist/lib/dependencies/index.cjs +0 -211
  282. package/dist/lib/dependencies/index.cjs.map +0 -1
  283. package/dist/lib/file/ReadFileSyncOptions.cjs +0 -33
  284. package/dist/lib/file/ReadFileSyncOptions.cjs.map +0 -1
  285. package/dist/lib/file/constants.cjs +0 -34
  286. package/dist/lib/file/constants.cjs.map +0 -1
  287. package/dist/lib/file/fileLines.cjs +0 -58
  288. package/dist/lib/file/fileLines.cjs.map +0 -1
  289. package/dist/lib/file/index.cjs +0 -74
  290. package/dist/lib/file/index.cjs.map +0 -1
  291. package/dist/lib/file/tryReadFileSync.cjs +0 -42
  292. package/dist/lib/file/tryReadFileSync.cjs.map +0 -1
  293. package/dist/lib/generateIgnoreFiles.cjs +0 -132
  294. package/dist/lib/generateIgnoreFiles.cjs.map +0 -1
  295. package/dist/lib/index.cjs +0 -614
  296. package/dist/lib/index.cjs.map +0 -1
  297. package/dist/lib/jsonFormatters.cjs +0 -37
  298. package/dist/lib/jsonFormatters.cjs.map +0 -1
  299. package/dist/lib/loadConfig.cjs +0 -59
  300. package/dist/lib/loadConfig.cjs.map +0 -1
  301. package/dist/lib/parsedPackageJSON.cjs +0 -37
  302. package/dist/lib/parsedPackageJSON.cjs.map +0 -1
  303. package/dist/lib/processEx.cjs +0 -72
  304. package/dist/lib/processEx.cjs.map +0 -1
  305. package/dist/lib/runSteps.cjs +0 -134
  306. package/dist/lib/runSteps.cjs.map +0 -1
  307. package/dist/lib/runStepsAsync.cjs +0 -147
  308. package/dist/lib/runStepsAsync.cjs.map +0 -1
  309. package/dist/lib/runXy.cjs +0 -150
  310. package/dist/lib/runXy.cjs.map +0 -1
  311. package/dist/lib/runXyWithWarning.cjs +0 -49
  312. package/dist/lib/runXyWithWarning.cjs.map +0 -1
  313. package/dist/lib/safeExit.cjs +0 -100
  314. package/dist/lib/safeExit.cjs.map +0 -1
  315. package/dist/lib/string/empty.cjs +0 -35
  316. package/dist/lib/string/empty.cjs.map +0 -1
  317. package/dist/lib/string/index.cjs +0 -45
  318. package/dist/lib/string/index.cjs.map +0 -1
  319. package/dist/lib/string/union.cjs +0 -35
  320. package/dist/lib/string/union.cjs.map +0 -1
  321. package/dist/lib/withErrnoException.cjs +0 -41
  322. package/dist/lib/withErrnoException.cjs.map +0 -1
  323. package/dist/lib/withError.cjs +0 -34
  324. package/dist/lib/withError.cjs.map +0 -1
  325. package/dist/lib/yarn/index.cjs +0 -93
  326. package/dist/lib/yarn/index.cjs.map +0 -1
  327. package/dist/lib/yarn/isYarnVersionOrGreater.cjs +0 -52
  328. package/dist/lib/yarn/isYarnVersionOrGreater.cjs.map +0 -1
  329. package/dist/lib/yarn/workspace/Workspace.cjs +0 -19
  330. package/dist/lib/yarn/workspace/Workspace.cjs.map +0 -1
  331. package/dist/lib/yarn/workspace/index.cjs +0 -60
  332. package/dist/lib/yarn/workspace/index.cjs.map +0 -1
  333. package/dist/lib/yarn/workspace/yarnWorkspace.cjs +0 -58
  334. package/dist/lib/yarn/workspace/yarnWorkspace.cjs.map +0 -1
  335. package/dist/lib/yarn/workspace/yarnWorkspaces.cjs +0 -49
  336. package/dist/lib/yarn/workspace/yarnWorkspaces.cjs.map +0 -1
  337. package/dist/lib/yarn/yarnInitCwd.cjs +0 -35
  338. package/dist/lib/yarn/yarnInitCwd.cjs.map +0 -1
  339. package/dist/loadPackageConfig.cjs +0 -39
  340. package/dist/loadPackageConfig.cjs.map +0 -1
  341. package/dist/types.d.cjs +0 -2
  342. package/dist/types.d.cjs.map +0 -1
  343. package/dist/xy/index.cjs +0 -1909
  344. package/dist/xy/index.cjs.map +0 -1
  345. package/dist/xy/param.cjs +0 -36
  346. package/dist/xy/param.cjs.map +0 -1
  347. package/dist/xy/xy.cjs +0 -1895
  348. package/dist/xy/xy.cjs.map +0 -1
  349. package/dist/xy/xyBuildCommands.cjs +0 -595
  350. package/dist/xy/xyBuildCommands.cjs.map +0 -1
  351. package/dist/xy/xyCommonCommands.cjs +0 -723
  352. package/dist/xy/xyCommonCommands.cjs.map +0 -1
  353. package/dist/xy/xyDeployCommands.cjs +0 -263
  354. package/dist/xy/xyDeployCommands.cjs.map +0 -1
  355. package/dist/xy/xyInstallCommands.cjs +0 -508
  356. package/dist/xy/xyInstallCommands.cjs.map +0 -1
  357. package/dist/xy/xyLintCommands.cjs +0 -466
  358. package/dist/xy/xyLintCommands.cjs.map +0 -1
  359. package/dist/xy/xyParseOptions.cjs +0 -84
  360. package/dist/xy/xyParseOptions.cjs.map +0 -1
@@ -1,227 +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/lint-clean.ts
32
- var lint_clean_exports = {};
33
- __export(lint_clean_exports, {
34
- lintClean: () => lintClean
35
- });
36
- module.exports = __toCommonJS(lint_clean_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/lint.ts
153
- var import_chalk4 = __toESM(require("chalk"), 1);
154
- var import_eslint = require("eslint");
155
- var dumpMessages = /* @__PURE__ */ __name((lintResults) => {
156
- const colors = [
157
- "white",
158
- "yellow",
159
- "red"
160
- ];
161
- const severity = [
162
- "none",
163
- "warning",
164
- "error"
165
- ];
166
- for (const lintResult of lintResults) {
167
- if (lintResult.messages.length > 0) {
168
- console.log(import_chalk4.default.gray(`${lintResult.filePath}`));
169
- for (const message of lintResult.messages) {
170
- console.log(import_chalk4.default.gray(` ${message.line}:${message.column}`), import_chalk4.default[colors[message.severity]](` ${severity[message.severity]}`), import_chalk4.default.white(` ${message.message}`), import_chalk4.default.gray(` ${message.ruleId}`));
171
- }
172
- }
173
- }
174
- }, "dumpMessages");
175
- var lintPackage = /* @__PURE__ */ __name(async ({ pkg }) => {
176
- const workspace = yarnWorkspaces().find((workspace2) => workspace2.name === pkg);
177
- if (!workspace) {
178
- console.error(import_chalk4.default.red(`Unable to locate package [${import_chalk4.default.magenta(pkg)}]`));
179
- process.exit(1);
180
- }
181
- const engine = new import_eslint.ESLint({
182
- cache: true
183
- });
184
- const lintResults = await engine.lintFiles(workspace.location);
185
- dumpMessages(lintResults);
186
- return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0);
187
- }, "lintPackage");
188
- var lint = /* @__PURE__ */ __name(async ({ pkg } = {}) => {
189
- return pkg ? await lintPackage({
190
- pkg
191
- }) : runSteps("Lint-Caching [All]", [
192
- [
193
- "yarn",
194
- [
195
- "eslint",
196
- ".",
197
- "--cache"
198
- ]
199
- ]
200
- ]);
201
- }, "lint");
202
-
203
- // src/actions/lint-clean.ts
204
- var lintClean = /* @__PURE__ */ __name(() => {
205
- console.log("Lint Clean [.eslintcache]");
206
- const workspaces = yarnWorkspaces();
207
- const result = workspaces.map(({ location, name }) => {
208
- const dist = `${location}/.eslintcache`;
209
- try {
210
- (0, import_node_fs2.rmSync)(dist, {
211
- force: true,
212
- recursive: true
213
- });
214
- return 0;
215
- } catch (ex) {
216
- const error = ex;
217
- console.error(`Lint Clean [.eslintcache] Failed [${name}, ${error.message}]`);
218
- return 1;
219
- }
220
- }).reduce((prev, result2) => prev || result2, 0);
221
- return result || lint();
222
- }, "lintClean");
223
- // Annotate the CommonJS export names for ESM import in node:
224
- 0 && (module.exports = {
225
- lintClean
226
- });
227
- //# sourceMappingURL=lint-clean.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/actions/lint-clean.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","../../src/actions/lint.ts"],"sourcesContent":["import { rmSync } from 'node:fs'\n\nimport { yarnWorkspaces } from '../lib/index.ts'\nimport { lint } from './lint.ts'\n\nexport const lintClean = () => {\n console.log('Lint Clean [.eslintcache]')\n const workspaces = yarnWorkspaces()\n const result = workspaces\n .map(({ location, name }) => {\n const dist = `${location}/.eslintcache`\n try {\n rmSync(dist, { force: true, recursive: true })\n return 0\n } catch (ex) {\n const error = ex as Error\n console.error(`Lint Clean [.eslintcache] 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 return result || lint()\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","import chalk from 'chalk'\nimport { ESLint } from 'eslint'\n\nimport { runSteps, yarnWorkspaces } from '../lib/index.ts'\n\nexport interface LintParams {\n pkg?: string\n verbose?: boolean\n}\n\nexport interface LintPackageParams {\n pkg: string\n verbose?: boolean\n}\n\nconst dumpMessages = (lintResults: ESLint.LintResult[]) => {\n const colors: ('white' | 'red' | 'yellow')[] = ['white', 'yellow', 'red']\n const severity: string[] = ['none', 'warning', 'error']\n\n for (const lintResult of lintResults) {\n if (lintResult.messages.length > 0) {\n console.log(chalk.gray(`${lintResult.filePath}`))\n for (const message of lintResult.messages) {\n console.log(\n chalk.gray(`\\t${message.line}:${message.column}`),\n chalk[colors[message.severity]](`\\t${severity[message.severity]}`),\n chalk.white(`\\t${message.message}`),\n chalk.gray(`\\t${message.ruleId}`),\n )\n }\n }\n }\n}\n\nexport const lintPackage = async ({ pkg }: LintParams) => {\n const workspace = yarnWorkspaces().find(workspace => workspace.name === pkg)\n if (!workspace) {\n console.error(chalk.red(`Unable to locate package [${chalk.magenta(pkg)}]`))\n process.exit(1)\n }\n\n const engine = new ESLint({ cache: true })\n\n const lintResults = await engine.lintFiles(workspace.location)\n\n dumpMessages(lintResults)\n\n return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0)\n}\n\nexport const lintAll = async () => {\n const engine = new ESLint({ cache: true })\n\n const lintResults = await engine.lintFiles('./**/*.*')\n\n dumpMessages(lintResults)\n\n return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0)\n}\n\nexport const lint = async ({ pkg }: LintParams = {}) => {\n return pkg ? await lintPackage({ pkg }) : runSteps('Lint-Caching [All]', [['yarn', ['eslint', '.', '--cache']]])\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;IAAAA,kBAAuB;;;ACAvB,mBAAkB;AAEX,IAAMC,cAAc,wBAACC,MAAcC,QAAgBC,QAA0B,SAASC,a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ellow","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","import_chalk","dumpMessages","lintResults","colors","severity","lintResult","messages","length","console","log","chalk","gray","filePath","message","line","column","white","ruleId","lintPackage","pkg","workspace","yarnWorkspaces","find","name","error","red","magenta","process","exit","engine","ESLint","cache","lintFiles","location","reduce","prev","errorCount","lint","pkg","lintPackage","runSteps","lintClean","console","log","workspaces","yarnWorkspaces","result","map","location","name","dist","rmSync","force","recursive","ex","error","message","reduce","prev","lint"]}
@@ -1,153 +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/lint-profile.ts
32
- var lint_profile_exports = {};
33
- __export(lint_profile_exports, {
34
- lintProfile: () => lintProfile
35
- });
36
- module.exports = __toCommonJS(lint_profile_exports);
37
-
38
- // src/lib/checkResult.ts
39
- var import_chalk = __toESM(require("chalk"), 1);
40
- var checkResult = /* @__PURE__ */ __name((name, result, level = "error", exitOnFail = false) => {
41
- if (result) {
42
- const exiting = exitOnFail ? "[Exiting Process]" : "[Continuing]";
43
- const chalkFunc = level === "error" ? import_chalk.default.red : import_chalk.default.yellow;
44
- console[level](chalkFunc(`${name} had ${result} failures ${exiting}`));
45
- if (exitOnFail) {
46
- process.exit(result);
47
- }
48
- }
49
- }, "checkResult");
50
-
51
- // src/lib/processEx.ts
52
- var import_chalk2 = __toESM(require("chalk"), 1);
53
-
54
- // src/lib/withError.ts
55
- var withError = /* @__PURE__ */ __name((ex, closure, predicate = (ex2) => ex2.name !== void 0 && ex2.message !== void 0) => {
56
- return predicate(ex) ? closure(ex) : void 0;
57
- }, "withError");
58
-
59
- // src/lib/withErrnoException.ts
60
- var withErrnoException = /* @__PURE__ */ __name((ex, closure) => {
61
- return withError(ex, closure, (ex2) => ex2.errno !== void 0);
62
- }, "withErrnoException");
63
-
64
- // src/lib/processEx.ts
65
- var processEx = /* @__PURE__ */ __name((ex) => {
66
- const error = typeof ex === "string" ? new Error(ex) : ex;
67
- const exitCode = withErrnoException(error, (error2) => {
68
- if (error2.code === "ENOENT") {
69
- console.error(import_chalk2.default.red(`'${error2.path}' not found.`));
70
- } else {
71
- console.error(import_chalk2.default.red(`Errno: ${error2.code}`));
72
- }
73
- return error2.errno ?? -1;
74
- }) ?? withError(error, (error2) => {
75
- console.error(import_chalk2.default.red(`${error2.name}: ${error2.message}`));
76
- return -1;
77
- }) ?? (() => {
78
- console.error(import_chalk2.default.red(`Unexpected Error: ${JSON.stringify(ex, null, 2)}`));
79
- return -1;
80
- })();
81
- process.exit(process.exitCode ?? exitCode);
82
- }, "processEx");
83
-
84
- // src/lib/safeExit.ts
85
- var safeExit = /* @__PURE__ */ __name((func, exitOnFail = true) => {
86
- try {
87
- const result = func();
88
- if (result && exitOnFail) {
89
- process.exit(result);
90
- }
91
- return result;
92
- } catch (ex) {
93
- return processEx(ex);
94
- }
95
- }, "safeExit");
96
-
97
- // src/lib/runSteps.ts
98
- var import_node_child_process = require("child_process");
99
- var import_node_fs = require("fs");
100
- var import_chalk3 = __toESM(require("chalk"), 1);
101
- var runSteps = /* @__PURE__ */ __name((name, steps, exitOnFail = true, messages) => {
102
- return safeExit(() => {
103
- const pkgName = process.env.npm_package_name;
104
- console.log(import_chalk3.default.green(`${name} [${pkgName}]`));
105
- let totalStatus = 0;
106
- for (const [i, [command, args, config]] of steps.entries()) {
107
- if (messages?.[i]) {
108
- console.log(import_chalk3.default.gray(messages?.[i]));
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
- const status = (0, import_node_child_process.spawnSync)(command, Array.isArray(args) ? args : args.split(" "), {
115
- ...config,
116
- encoding: "utf8",
117
- env: {
118
- FORCE_COLOR: "3",
119
- ...process.env
120
- },
121
- shell: true,
122
- stdio: "inherit"
123
- }).status ?? 0;
124
- checkResult(name, status, "error", exitOnFail);
125
- totalStatus += status ?? 0;
126
- }
127
- return totalStatus;
128
- }, !!exitOnFail);
129
- }, "runSteps");
130
-
131
- // src/actions/lint-profile.ts
132
- var lintProfile = /* @__PURE__ */ __name(() => {
133
- return runSteps("Lint Profile", [
134
- [
135
- "yarn",
136
- [
137
- "xy",
138
- "lint"
139
- ],
140
- {
141
- env: {
142
- ...process.env,
143
- TIMING: "1"
144
- }
145
- }
146
- ]
147
- ]);
148
- }, "lintProfile");
149
- // Annotate the CommonJS export names for ESM import in node:
150
- 0 && (module.exports = {
151
- lintProfile
152
- });
153
- //# sourceMappingURL=lint-profile.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/actions/lint-profile.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 { runSteps } from '../lib/index.ts'\n\nexport const lintProfile = () => {\n return runSteps('Lint Profile', [['yarn', ['xy', 'lint'], { env: { ...process.env, TIMING: '1' } }]])\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, 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;;;;;;;ACAA,mBAAkB;AAEX,IAAMA,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,QAAUA,IAAGG,SAASC,UAAaJ,IAAGK,YAAYD,WAAS;AAExE,SAAOF,UAAUF,EAAAA,IAAWC,QAAQD,EAAAA,IAAWI;AACjD,GAPyB;;;ACElB,IAAME,qBAAqB,wBAA0DC,IAAaC,YAAAA;AACvG,SAAOC,UAAaF,IAAIC,SAAS,CAACD,QAAiBA,IAA6BG,UAAUC,MAAAA;AAC5F,GAFkC;;;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,cAAAA,QAAMC,IAAI,IAAIP,OAAMQ,IAAI,cAAc,CAAA;IACtD,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MAAM,GAAA;AACxD,UAAIR,YAAY,UAAU,KAACS,2BAAWJ,QAAQ,CAAA,CAAE,GAAG;AACjD,cAAM,IAAIK,MAAM,mBAAmBL,QAAQ,CAAA,CAAE,GAAG;MAClD;AACA,YAAMM,aACFC,qCAAUZ,SAASM,MAAMC,QAAQN,IAAAA,IAAQA,OAAOA,KAAKO,MAAM,GAAA,GAAM;QACjE,GAAGN;QACHW,UAAU;QACVrB,KAAK;UAAEsB,aAAa;UAAK,GAAGvB,QAAQC;QAAI;QACxCuB,OAAO;QACPC,OAAO;MACT,CAAA,EAAGL,UAAU;AACfM,kBAAYhC,MAAM0B,QAAQ,SAASxB,UAAAA;AACnCW,qBAAea,UAAU;IAC3B;AACA,WAAOb;EACT,GAAG,CAAC,CAACX,UAAAA;AACP,GA1BwB;;;ANVjB,IAAM+B,cAAc,6BAAA;AACzB,SAAOC,SAAS,gBAAgB;IAAC;MAAC;MAAQ;QAAC;QAAM;;MAAS;QAAEC,KAAK;UAAE,GAAGC,QAAQD;UAAKE,QAAQ;QAAI;MAAE;;GAAG;AACtG,GAF2B;","names":["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","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","lintProfile","runSteps","env","process","TIMING"]}
@@ -1,217 +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/lint.ts
32
- var lint_exports = {};
33
- __export(lint_exports, {
34
- lint: () => lint,
35
- lintAll: () => lintAll,
36
- lintPackage: () => lintPackage
37
- });
38
- module.exports = __toCommonJS(lint_exports);
39
- var import_chalk4 = __toESM(require("chalk"), 1);
40
- var import_eslint = require("eslint");
41
-
42
- // src/lib/checkResult.ts
43
- var import_chalk = __toESM(require("chalk"), 1);
44
- var checkResult = /* @__PURE__ */ __name((name, result, level = "error", exitOnFail = false) => {
45
- if (result) {
46
- const exiting = exitOnFail ? "[Exiting Process]" : "[Continuing]";
47
- const chalkFunc = level === "error" ? import_chalk.default.red : import_chalk.default.yellow;
48
- console[level](chalkFunc(`${name} had ${result} failures ${exiting}`));
49
- if (exitOnFail) {
50
- process.exit(result);
51
- }
52
- }
53
- }, "checkResult");
54
-
55
- // src/lib/processEx.ts
56
- var import_chalk2 = __toESM(require("chalk"), 1);
57
-
58
- // src/lib/withError.ts
59
- var withError = /* @__PURE__ */ __name((ex, closure, predicate = (ex2) => ex2.name !== void 0 && ex2.message !== void 0) => {
60
- return predicate(ex) ? closure(ex) : void 0;
61
- }, "withError");
62
-
63
- // src/lib/withErrnoException.ts
64
- var withErrnoException = /* @__PURE__ */ __name((ex, closure) => {
65
- return withError(ex, closure, (ex2) => ex2.errno !== void 0);
66
- }, "withErrnoException");
67
-
68
- // src/lib/processEx.ts
69
- var processEx = /* @__PURE__ */ __name((ex) => {
70
- const error = typeof ex === "string" ? new Error(ex) : ex;
71
- const exitCode = withErrnoException(error, (error2) => {
72
- if (error2.code === "ENOENT") {
73
- console.error(import_chalk2.default.red(`'${error2.path}' not found.`));
74
- } else {
75
- console.error(import_chalk2.default.red(`Errno: ${error2.code}`));
76
- }
77
- return error2.errno ?? -1;
78
- }) ?? withError(error, (error2) => {
79
- console.error(import_chalk2.default.red(`${error2.name}: ${error2.message}`));
80
- return -1;
81
- }) ?? (() => {
82
- console.error(import_chalk2.default.red(`Unexpected Error: ${JSON.stringify(ex, null, 2)}`));
83
- return -1;
84
- })();
85
- process.exit(process.exitCode ?? exitCode);
86
- }, "processEx");
87
-
88
- // src/lib/safeExit.ts
89
- var safeExit = /* @__PURE__ */ __name((func, exitOnFail = true) => {
90
- try {
91
- const result = func();
92
- if (result && exitOnFail) {
93
- process.exit(result);
94
- }
95
- return result;
96
- } catch (ex) {
97
- return processEx(ex);
98
- }
99
- }, "safeExit");
100
-
101
- // src/lib/yarn/workspace/yarnWorkspaces.ts
102
- var import_node_child_process = require("child_process");
103
- var yarnWorkspaces = /* @__PURE__ */ __name(() => {
104
- const result = (0, import_node_child_process.spawnSync)("yarn", [
105
- "workspaces",
106
- "list",
107
- "--json",
108
- "--recursive"
109
- ], {
110
- encoding: "utf8",
111
- shell: true
112
- });
113
- if (result.error) {
114
- throw result.error;
115
- }
116
- return result.stdout.toString().split("\n").slice(0, -1).map((item) => {
117
- return JSON.parse(item);
118
- });
119
- }, "yarnWorkspaces");
120
-
121
- // src/lib/runSteps.ts
122
- var import_node_child_process2 = require("child_process");
123
- var import_node_fs = require("fs");
124
- var import_chalk3 = __toESM(require("chalk"), 1);
125
- var runSteps = /* @__PURE__ */ __name((name, steps, exitOnFail = true, messages) => {
126
- return safeExit(() => {
127
- const pkgName = process.env.npm_package_name;
128
- console.log(import_chalk3.default.green(`${name} [${pkgName}]`));
129
- let totalStatus = 0;
130
- for (const [i, [command, args, config]] of steps.entries()) {
131
- if (messages?.[i]) {
132
- console.log(import_chalk3.default.gray(messages?.[i]));
133
- }
134
- const argList = Array.isArray(args) ? args : args.split(" ");
135
- if (command === "node" && !(0, import_node_fs.existsSync)(argList[0])) {
136
- throw new Error(`File not found [${argList[0]}]`);
137
- }
138
- const status = (0, import_node_child_process2.spawnSync)(command, Array.isArray(args) ? args : args.split(" "), {
139
- ...config,
140
- encoding: "utf8",
141
- env: {
142
- FORCE_COLOR: "3",
143
- ...process.env
144
- },
145
- shell: true,
146
- stdio: "inherit"
147
- }).status ?? 0;
148
- checkResult(name, status, "error", exitOnFail);
149
- totalStatus += status ?? 0;
150
- }
151
- return totalStatus;
152
- }, !!exitOnFail);
153
- }, "runSteps");
154
-
155
- // src/actions/lint.ts
156
- var dumpMessages = /* @__PURE__ */ __name((lintResults) => {
157
- const colors = [
158
- "white",
159
- "yellow",
160
- "red"
161
- ];
162
- const severity = [
163
- "none",
164
- "warning",
165
- "error"
166
- ];
167
- for (const lintResult of lintResults) {
168
- if (lintResult.messages.length > 0) {
169
- console.log(import_chalk4.default.gray(`${lintResult.filePath}`));
170
- for (const message of lintResult.messages) {
171
- console.log(import_chalk4.default.gray(` ${message.line}:${message.column}`), import_chalk4.default[colors[message.severity]](` ${severity[message.severity]}`), import_chalk4.default.white(` ${message.message}`), import_chalk4.default.gray(` ${message.ruleId}`));
172
- }
173
- }
174
- }
175
- }, "dumpMessages");
176
- var lintPackage = /* @__PURE__ */ __name(async ({ pkg }) => {
177
- const workspace = yarnWorkspaces().find((workspace2) => workspace2.name === pkg);
178
- if (!workspace) {
179
- console.error(import_chalk4.default.red(`Unable to locate package [${import_chalk4.default.magenta(pkg)}]`));
180
- process.exit(1);
181
- }
182
- const engine = new import_eslint.ESLint({
183
- cache: true
184
- });
185
- const lintResults = await engine.lintFiles(workspace.location);
186
- dumpMessages(lintResults);
187
- return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0);
188
- }, "lintPackage");
189
- var lintAll = /* @__PURE__ */ __name(async () => {
190
- const engine = new import_eslint.ESLint({
191
- cache: true
192
- });
193
- const lintResults = await engine.lintFiles("./**/*.*");
194
- dumpMessages(lintResults);
195
- return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0);
196
- }, "lintAll");
197
- var lint = /* @__PURE__ */ __name(async ({ pkg } = {}) => {
198
- return pkg ? await lintPackage({
199
- pkg
200
- }) : runSteps("Lint-Caching [All]", [
201
- [
202
- "yarn",
203
- [
204
- "eslint",
205
- ".",
206
- "--cache"
207
- ]
208
- ]
209
- ]);
210
- }, "lint");
211
- // Annotate the CommonJS export names for ESM import in node:
212
- 0 && (module.exports = {
213
- lint,
214
- lintAll,
215
- lintPackage
216
- });
217
- //# sourceMappingURL=lint.cjs.map