skuba 13.0.3 → 14.0.0-esmify-skuba-20251031135439

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 (516) hide show
  1. package/config/eslint.js +1 -1
  2. package/config/prettier.js +10 -2
  3. package/lib/cli/adapter/eslint.js +10 -46
  4. package/lib/cli/adapter/eslint.js.map +2 -2
  5. package/lib/cli/adapter/prettier.js +40 -72
  6. package/lib/cli/adapter/prettier.js.map +2 -2
  7. package/lib/cli/build/args.js +7 -43
  8. package/lib/cli/build/args.js.map +2 -2
  9. package/lib/cli/build/assets.js +27 -62
  10. package/lib/cli/build/assets.js.map +2 -2
  11. package/lib/cli/build/esbuild.js +20 -55
  12. package/lib/cli/build/esbuild.js.map +3 -3
  13. package/lib/cli/build/index.js +20 -56
  14. package/lib/cli/build/index.js.map +2 -2
  15. package/lib/cli/build/tsc.js +24 -66
  16. package/lib/cli/build/tsc.js.map +2 -2
  17. package/lib/cli/buildPackage/index.js +7 -33
  18. package/lib/cli/buildPackage/index.js.map +1 -1
  19. package/lib/cli/configure/analyseConfiguration.js +15 -51
  20. package/lib/cli/configure/analyseConfiguration.js.map +2 -2
  21. package/lib/cli/configure/analyseDependencies.js +24 -60
  22. package/lib/cli/configure/analyseDependencies.js.map +3 -3
  23. package/lib/cli/configure/analysis/diff.js +4 -40
  24. package/lib/cli/configure/analysis/diff.js.map +2 -2
  25. package/lib/cli/configure/analysis/files.js +7 -43
  26. package/lib/cli/configure/analysis/files.js.map +2 -2
  27. package/lib/cli/configure/analysis/git.js +11 -47
  28. package/lib/cli/configure/analysis/git.js.map +2 -2
  29. package/lib/cli/configure/analysis/package.js +10 -48
  30. package/lib/cli/configure/analysis/package.js.map +3 -3
  31. package/lib/cli/configure/analysis/project.js +18 -53
  32. package/lib/cli/configure/analysis/project.js.map +2 -2
  33. package/lib/cli/configure/dependencies/index.js +5 -39
  34. package/lib/cli/configure/dependencies/index.js.map +1 -1
  35. package/lib/cli/configure/dependencies/seekDatadogCustomMetrics.js +3 -29
  36. package/lib/cli/configure/dependencies/seekDatadogCustomMetrics.js.map +1 -1
  37. package/lib/cli/configure/dependencies/seekKoala.js +3 -29
  38. package/lib/cli/configure/dependencies/seekKoala.js.map +1 -1
  39. package/lib/cli/configure/dependencies/skuba.js +3 -29
  40. package/lib/cli/configure/dependencies/skuba.js.map +1 -1
  41. package/lib/cli/configure/dependencies/skubaDeps.js +1 -27
  42. package/lib/cli/configure/dependencies/skubaDeps.js.map +1 -1
  43. package/lib/cli/configure/dependencies/skubaDive.js +4 -32
  44. package/lib/cli/configure/dependencies/skubaDive.js.map +1 -1
  45. package/lib/cli/configure/ensureTemplateCompletion.js +31 -61
  46. package/lib/cli/configure/ensureTemplateCompletion.js.map +3 -3
  47. package/lib/cli/configure/getEntryPoint.js +13 -49
  48. package/lib/cli/configure/getEntryPoint.js.map +3 -3
  49. package/lib/cli/configure/getProjectType.js +13 -36
  50. package/lib/cli/configure/getProjectType.js.map +2 -2
  51. package/lib/cli/configure/index.js +49 -85
  52. package/lib/cli/configure/index.js.map +3 -3
  53. package/lib/cli/configure/modules/eslint.js +9 -35
  54. package/lib/cli/configure/modules/eslint.js.map +1 -1
  55. package/lib/cli/configure/modules/ignore.js +7 -33
  56. package/lib/cli/configure/modules/ignore.js.map +1 -1
  57. package/lib/cli/configure/modules/index.js +17 -45
  58. package/lib/cli/configure/modules/index.js.map +2 -2
  59. package/lib/cli/configure/modules/nodemon.js +2 -28
  60. package/lib/cli/configure/modules/nodemon.js.map +1 -1
  61. package/lib/cli/configure/modules/package.js +9 -35
  62. package/lib/cli/configure/modules/package.js.map +1 -1
  63. package/lib/cli/configure/modules/prettier.js +10 -36
  64. package/lib/cli/configure/modules/prettier.js.map +1 -1
  65. package/lib/cli/configure/modules/renovate.js +17 -43
  66. package/lib/cli/configure/modules/renovate.js.map +2 -2
  67. package/lib/cli/configure/modules/serverless.js +1 -27
  68. package/lib/cli/configure/modules/serverless.js.map +1 -1
  69. package/lib/cli/configure/modules/tslint.js +2 -28
  70. package/lib/cli/configure/modules/tslint.js.map +1 -1
  71. package/lib/cli/configure/processing/configFile.js +4 -44
  72. package/lib/cli/configure/processing/configFile.js.map +1 -1
  73. package/lib/cli/configure/processing/deleteFiles.js +1 -27
  74. package/lib/cli/configure/processing/deleteFiles.js.map +1 -1
  75. package/lib/cli/configure/processing/javascript.js +2 -30
  76. package/lib/cli/configure/processing/javascript.js.map +1 -1
  77. package/lib/cli/configure/processing/json.js +6 -34
  78. package/lib/cli/configure/processing/json.js.map +1 -1
  79. package/lib/cli/configure/processing/loadFiles.js +1 -27
  80. package/lib/cli/configure/processing/loadFiles.js.map +1 -1
  81. package/lib/cli/configure/processing/module.js +2 -28
  82. package/lib/cli/configure/processing/module.js.map +1 -1
  83. package/lib/cli/configure/processing/package.js +10 -52
  84. package/lib/cli/configure/processing/package.js.map +3 -3
  85. package/lib/cli/configure/processing/prettier.js +3 -39
  86. package/lib/cli/configure/processing/prettier.js.map +2 -2
  87. package/lib/cli/configure/processing/record.js +4 -44
  88. package/lib/cli/configure/processing/record.js.map +2 -2
  89. package/lib/cli/configure/processing/typescript.js +28 -70
  90. package/lib/cli/configure/processing/typescript.js.map +2 -2
  91. package/lib/cli/configure/types.js +0 -15
  92. package/lib/cli/configure/types.js.map +3 -3
  93. package/lib/cli/format/index.js +19 -55
  94. package/lib/cli/format/index.js.map +2 -2
  95. package/lib/cli/help/index.js +5 -31
  96. package/lib/cli/help/index.js.map +1 -1
  97. package/lib/cli/init/getConfig.js +75 -107
  98. package/lib/cli/init/getConfig.js.map +3 -3
  99. package/lib/cli/init/git.js +16 -54
  100. package/lib/cli/init/git.js.map +3 -3
  101. package/lib/cli/init/index.js +66 -99
  102. package/lib/cli/init/index.js.map +2 -2
  103. package/lib/cli/init/prompts.js +20 -56
  104. package/lib/cli/init/prompts.js.map +3 -3
  105. package/lib/cli/init/types.js +6 -42
  106. package/lib/cli/init/types.js.map +1 -1
  107. package/lib/cli/init/validation.js +5 -39
  108. package/lib/cli/init/validation.js.map +1 -1
  109. package/lib/cli/init/writePackageJson.js +7 -43
  110. package/lib/cli/init/writePackageJson.js.map +2 -2
  111. package/lib/cli/lint/annotate/buildkite/eslint.js +2 -38
  112. package/lib/cli/lint/annotate/buildkite/eslint.js.map +1 -1
  113. package/lib/cli/lint/annotate/buildkite/index.js +10 -46
  114. package/lib/cli/lint/annotate/buildkite/index.js.map +1 -1
  115. package/lib/cli/lint/annotate/buildkite/internal.js +2 -38
  116. package/lib/cli/lint/annotate/buildkite/internal.js.map +1 -1
  117. package/lib/cli/lint/annotate/buildkite/prettier.js +2 -38
  118. package/lib/cli/lint/annotate/buildkite/prettier.js.map +1 -1
  119. package/lib/cli/lint/annotate/buildkite/tsc.js +2 -38
  120. package/lib/cli/lint/annotate/buildkite/tsc.js.map +1 -1
  121. package/lib/cli/lint/annotate/github/eslint.js +1 -27
  122. package/lib/cli/lint/annotate/github/eslint.js.map +1 -1
  123. package/lib/cli/lint/annotate/github/index.js +10 -46
  124. package/lib/cli/lint/annotate/github/index.js.map +1 -1
  125. package/lib/cli/lint/annotate/github/internal.js +1 -27
  126. package/lib/cli/lint/annotate/github/internal.js.map +1 -1
  127. package/lib/cli/lint/annotate/github/prettier.js +1 -27
  128. package/lib/cli/lint/annotate/github/prettier.js.map +1 -1
  129. package/lib/cli/lint/annotate/github/tsc.js +3 -29
  130. package/lib/cli/lint/annotate/github/tsc.js.map +2 -2
  131. package/lib/cli/lint/annotate/index.js +5 -31
  132. package/lib/cli/lint/annotate/index.js.map +1 -1
  133. package/lib/cli/lint/autofix.js +38 -78
  134. package/lib/cli/lint/autofix.js.map +3 -3
  135. package/lib/cli/lint/eslint.js +14 -52
  136. package/lib/cli/lint/eslint.js.map +3 -3
  137. package/lib/cli/lint/external.js +18 -53
  138. package/lib/cli/lint/external.js.map +2 -2
  139. package/lib/cli/lint/index.js +24 -50
  140. package/lib/cli/lint/index.js.map +1 -1
  141. package/lib/cli/lint/internal.js +17 -53
  142. package/lib/cli/lint/internal.js.map +2 -2
  143. package/lib/cli/lint/internalLints/detectBadCodeowners.js +8 -36
  144. package/lib/cli/lint/internalLints/detectBadCodeowners.js.map +1 -1
  145. package/lib/cli/lint/internalLints/noSkubaTemplateJs.js +10 -46
  146. package/lib/cli/lint/internalLints/noSkubaTemplateJs.js.map +3 -3
  147. package/lib/cli/lint/internalLints/patchRenovateConfig.js +20 -56
  148. package/lib/cli/lint/internalLints/patchRenovateConfig.js.map +2 -2
  149. package/lib/cli/lint/internalLints/refreshConfigFiles.js +33 -68
  150. package/lib/cli/lint/internalLints/refreshConfigFiles.js.map +2 -2
  151. package/lib/cli/lint/internalLints/upgrade/index.js +21 -54
  152. package/lib/cli/lint/internalLints/upgrade/index.js.map +3 -3
  153. package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/index.js +3 -29
  154. package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/index.js.map +1 -1
  155. package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/removeYarnIgnoreOptionalFlags.js +10 -46
  156. package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/removeYarnIgnoreOptionalFlags.js.map +2 -2
  157. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/index.js +5 -31
  158. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/index.js.map +1 -1
  159. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/migrateNpmrcToPnpmWorkspace.js +36 -73
  160. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/migrateNpmrcToPnpmWorkspace.js.map +3 -3
  161. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/stopBundlingInCDKTests.js +11 -49
  162. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/stopBundlingInCDKTests.js.map +2 -2
  163. package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/index.js +3 -29
  164. package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/index.js.map +1 -1
  165. package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/unhandledRejections.js +24 -64
  166. package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/unhandledRejections.js.map +2 -2
  167. package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/index.js +3 -29
  168. package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/index.js.map +1 -1
  169. package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/patchJestSnapshots.js +11 -49
  170. package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/patchJestSnapshots.js.map +2 -2
  171. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/index.js +5 -31
  172. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/index.js.map +1 -1
  173. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchApiTokenFromEnvironment.js +11 -49
  174. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchApiTokenFromEnvironment.js.map +2 -2
  175. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchDockerfileSyntaxDirective.js +11 -49
  176. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchDockerfileSyntaxDirective.js.map +2 -2
  177. package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/index.js +3 -29
  178. package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/index.js.map +1 -1
  179. package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/patchDockerfileCIVariable.js +11 -49
  180. package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/patchDockerfileCIVariable.js.map +2 -2
  181. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/configureTsConfigForESM.js +32 -76
  182. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/configureTsConfigForESM.js.map +2 -2
  183. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/index.js +9 -35
  184. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/index.js.map +1 -1
  185. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/patchApiDockerfiles.js +10 -46
  186. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/patchApiDockerfiles.js.map +2 -2
  187. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/rewriteSrcImports.js +28 -88
  188. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/rewriteSrcImports.js.map +2 -2
  189. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/updateLambdaConfigs.js +15 -53
  190. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/updateLambdaConfigs.js.map +2 -2
  191. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/addEmptyExports.js +16 -52
  192. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/addEmptyExports.js.map +2 -2
  193. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/index.js +9 -35
  194. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/index.js.map +1 -1
  195. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchDockerfile.js +9 -45
  196. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchDockerfile.js.map +2 -2
  197. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchServerListener.js +11 -47
  198. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchServerListener.js.map +2 -2
  199. package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/index.js +3 -29
  200. package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/index.js.map +1 -1
  201. package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/patchPnpmPackageManager.js +14 -50
  202. package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/patchPnpmPackageManager.js.map +2 -2
  203. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/collapseDuplicateMergeKeys.js +10 -46
  204. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/collapseDuplicateMergeKeys.js.map +2 -2
  205. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/index.js +9 -40
  206. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/index.js.map +2 -2
  207. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/moveNpmrcMounts.js +10 -46
  208. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/moveNpmrcMounts.js.map +2 -2
  209. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerCompose.js +10 -46
  210. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerCompose.js.map +2 -2
  211. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerImages.js +12 -48
  212. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerImages.js.map +2 -2
  213. package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/index.js +3 -29
  214. package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/index.js.map +1 -1
  215. package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/patchPnpmDockerImages.js +10 -46
  216. package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/patchPnpmDockerImages.js.map +2 -2
  217. package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/index.js +3 -29
  218. package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/index.js.map +1 -1
  219. package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/upgradeNode.js +7 -33
  220. package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/upgradeNode.js.map +1 -1
  221. package/lib/cli/lint/prettier.js +13 -51
  222. package/lib/cli/lint/prettier.js.map +3 -3
  223. package/lib/cli/lint/tsc.js +3 -29
  224. package/lib/cli/lint/tsc.js.map +1 -1
  225. package/lib/cli/lint/types.js +0 -15
  226. package/lib/cli/lint/types.js.map +3 -3
  227. package/lib/cli/migrate/index.js +9 -35
  228. package/lib/cli/migrate/index.js.map +1 -1
  229. package/lib/cli/migrate/nodeVersion/checks.js +26 -68
  230. package/lib/cli/migrate/nodeVersion/checks.js.map +2 -2
  231. package/lib/cli/migrate/nodeVersion/index.js +24 -56
  232. package/lib/cli/migrate/nodeVersion/index.js.map +2 -2
  233. package/lib/cli/node/index.js +20 -60
  234. package/lib/cli/node/index.js.map +3 -3
  235. package/lib/cli/release/index.js +3 -29
  236. package/lib/cli/release/index.js.map +1 -1
  237. package/lib/cli/start/index.js +15 -51
  238. package/lib/cli/start/index.js.map +3 -3
  239. package/lib/cli/test/index.js +3 -45
  240. package/lib/cli/test/index.js.map +2 -2
  241. package/lib/cli/version/index.js +5 -31
  242. package/lib/cli/version/index.js.map +1 -1
  243. package/lib/config/prettier.d.ts +7 -0
  244. package/lib/index.js +4 -49
  245. package/lib/index.js.map +2 -2
  246. package/lib/skuba.js +26 -44
  247. package/lib/skuba.js.map +3 -3
  248. package/lib/{cli → src/cli}/configure/analyseDependencies.d.ts +1 -1
  249. package/lib/{cli → src/cli}/configure/analysis/package.d.ts +2 -3
  250. package/lib/{cli → src/cli}/configure/ensureTemplateCompletion.d.ts +1 -1
  251. package/lib/{cli → src/cli}/configure/getEntryPoint.d.ts +1 -1
  252. package/lib/{cli → src/cli}/configure/getProjectType.d.ts +1 -1
  253. package/lib/src/cli/configure/processing/package.d.ts +5 -0
  254. package/lib/{cli → src/cli}/configure/types.d.ts +15 -4
  255. package/lib/{cli → src/cli}/init/getConfig.d.ts +1 -1
  256. package/lib/{cli → src/cli}/init/prompts.d.ts +4 -4
  257. package/lib/{cli → src/cli}/lint/internalLints/upgrade/index.d.ts +1 -1
  258. package/lib/{index.d.ts → src/index.d.ts} +0 -1
  259. package/lib/src/utils/fs.d.ts +1 -0
  260. package/lib/{utils → src/utils}/manifest.d.ts +3 -2
  261. package/lib/src/utils/sleep.d.ts +5 -0
  262. package/lib/{utils → src/utils}/wait.d.ts +0 -4
  263. package/lib/{wrapper → src/wrapper}/http.d.ts +0 -6
  264. package/lib/src/wrapper/server.d.ts +7 -0
  265. package/lib/utils/args.js +8 -50
  266. package/lib/utils/args.js.map +2 -2
  267. package/lib/utils/command.js +6 -50
  268. package/lib/utils/command.js.map +3 -3
  269. package/lib/utils/copy.js +22 -64
  270. package/lib/utils/copy.js.map +2 -2
  271. package/lib/utils/dir.js +37 -84
  272. package/lib/utils/dir.js.map +3 -3
  273. package/lib/utils/env.js +1 -27
  274. package/lib/utils/env.js.map +1 -1
  275. package/lib/utils/error.js +11 -53
  276. package/lib/utils/error.js.map +1 -1
  277. package/lib/utils/exec.js +26 -70
  278. package/lib/utils/exec.js.map +3 -3
  279. package/lib/utils/fs.js +15 -0
  280. package/lib/utils/fs.js.map +7 -0
  281. package/lib/utils/help.js +5 -31
  282. package/lib/utils/help.js.map +1 -1
  283. package/lib/utils/logging.js +13 -55
  284. package/lib/utils/logging.js.map +2 -2
  285. package/lib/utils/logo.js +23 -59
  286. package/lib/utils/logo.js.map +2 -2
  287. package/lib/utils/manifest.js +12 -60
  288. package/lib/utils/manifest.js.map +3 -3
  289. package/lib/utils/npmrc.js +1 -27
  290. package/lib/utils/npmrc.js.map +1 -1
  291. package/lib/utils/packageManager.js +14 -56
  292. package/lib/utils/packageManager.js.map +2 -2
  293. package/lib/utils/port.js +4 -42
  294. package/lib/utils/port.js.map +2 -2
  295. package/lib/utils/sleep.js +9 -0
  296. package/lib/utils/sleep.js.map +7 -0
  297. package/lib/utils/template.js +21 -68
  298. package/lib/utils/template.js.map +3 -3
  299. package/lib/utils/validation.js +6 -42
  300. package/lib/utils/validation.js.map +1 -1
  301. package/lib/utils/version.js +11 -53
  302. package/lib/utils/version.js.map +2 -2
  303. package/lib/utils/wait.js +6 -42
  304. package/lib/utils/wait.js.map +2 -2
  305. package/lib/utils/worker.js +9 -37
  306. package/lib/utils/worker.js.map +1 -1
  307. package/lib/wrapper/functionHandler.js +17 -50
  308. package/lib/wrapper/functionHandler.js.map +2 -2
  309. package/lib/wrapper/http.js +7 -53
  310. package/lib/wrapper/http.js.map +3 -3
  311. package/lib/wrapper/index.js +6 -6
  312. package/lib/wrapper/index.js.map +1 -1
  313. package/lib/wrapper/main.js +7 -43
  314. package/lib/wrapper/main.js.map +3 -3
  315. package/lib/wrapper/requestListener.js +12 -47
  316. package/lib/wrapper/requestListener.js.map +3 -3
  317. package/lib/wrapper/server.js +9 -0
  318. package/lib/wrapper/server.js.map +7 -0
  319. package/package.json +19 -24
  320. package/template/base/_.prettierrc.js +1 -1
  321. package/template/base/_eslint.config.js +1 -1
  322. package/template/base/_pnpm-workspace.yaml +3 -2
  323. package/template/base/vitest.config.ts +25 -0
  324. package/template/express-rest-api/.gantry/dev.yml +2 -2
  325. package/template/express-rest-api/.gantry/prod.yml +2 -2
  326. package/template/express-rest-api/package.json +6 -5
  327. package/template/express-rest-api/skuba.template.js +1 -1
  328. package/template/express-rest-api/src/app.test.ts +1 -0
  329. package/template/greeter/package.json +4 -3
  330. package/template/greeter/skuba.template.js +1 -1
  331. package/template/greeter/src/app.test.ts +3 -1
  332. package/template/koa-rest-api/.gantry/dev.yml +2 -2
  333. package/template/koa-rest-api/.gantry/prod.yml +2 -2
  334. package/template/koa-rest-api/package.json +6 -5
  335. package/template/koa-rest-api/skuba.template.js +1 -1
  336. package/template/koa-rest-api/src/api/jobs/getJobs.test.ts +2 -0
  337. package/template/koa-rest-api/src/api/jobs/postJob.test.ts +2 -0
  338. package/template/koa-rest-api/src/app.test.ts +2 -0
  339. package/template/koa-rest-api/src/framework/server.test.ts +2 -2
  340. package/template/koa-rest-api/src/framework/validation.test.ts +2 -0
  341. package/template/koa-rest-api/src/testing/metrics.ts +2 -0
  342. package/template/lambda-sqs-worker-cdk/infra/__snapshots__/appStack.test.ts.snap +15 -3
  343. package/template/lambda-sqs-worker-cdk/infra/appStack.test.ts +11 -9
  344. package/template/lambda-sqs-worker-cdk/infra/appStack.ts +1 -1
  345. package/template/lambda-sqs-worker-cdk/package.json +6 -5
  346. package/template/lambda-sqs-worker-cdk/skuba.template.js +1 -1
  347. package/template/lambda-sqs-worker-cdk/src/app.test.ts +22 -13
  348. package/template/lambda-sqs-worker-cdk/src/framework/handler.test.ts +1 -0
  349. package/template/lambda-sqs-worker-cdk/src/framework/validation.test.ts +33 -31
  350. package/template/lambda-sqs-worker-cdk/src/services/jobScorer.test.ts +8 -2
  351. package/template/lambda-sqs-worker-cdk/src/services/pipelineEventSender.test.ts +3 -2
  352. package/template/lambda-sqs-worker-cdk/src/testing/services.ts +4 -3
  353. package/template/oss-npm-package/.github/workflows/release.yml +1 -1
  354. package/template/oss-npm-package/.github/workflows/validate.yml +1 -1
  355. package/template/oss-npm-package/_package.json +1 -0
  356. package/template/oss-npm-package/skuba.template.js +1 -1
  357. package/template/oss-npm-package/src/index.test.ts +2 -0
  358. package/template/private-npm-package/_package.json +1 -0
  359. package/template/private-npm-package/skuba.template.js +1 -1
  360. package/template/private-npm-package/src/index.test.ts +2 -0
  361. package/config/jest.js +0 -1
  362. package/config/prettier.d.ts +0 -4
  363. package/jest/moduleNameMapper.js +0 -64
  364. package/jest/transform.js +0 -62
  365. package/jest/tsConfig.js +0 -26
  366. package/jest-preset.js +0 -37
  367. package/lib/api/jest/index.d.ts +0 -15
  368. package/lib/api/jest/index.js +0 -59
  369. package/lib/api/jest/index.js.map +0 -7
  370. package/lib/cli/configure/modules/jest.d.ts +0 -2
  371. package/lib/cli/configure/modules/jest.js +0 -86
  372. package/lib/cli/configure/modules/jest.js.map +0 -7
  373. package/lib/cli/configure/processing/package.d.ts +0 -71
  374. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/upgradeESLint.d.ts +0 -2
  375. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/upgradeESLint.js +0 -144
  376. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/upgradeESLint.js.map +0 -7
  377. package/lib/cli/test/reporters/github/annotations.d.ts +0 -9
  378. package/lib/cli/test/reporters/github/annotations.js +0 -102
  379. package/lib/cli/test/reporters/github/annotations.js.map +0 -7
  380. package/lib/cli/test/reporters/github/index.d.ts +0 -5
  381. package/lib/cli/test/reporters/github/index.js +0 -74
  382. package/lib/cli/test/reporters/github/index.js.map +0 -7
  383. package/template/base/jest.config.ts +0 -19
  384. package/template/base/jest.setup.ts +0 -3
  385. /package/lib/{cli → src/cli}/adapter/eslint.d.ts +0 -0
  386. /package/lib/{cli → src/cli}/adapter/prettier.d.ts +0 -0
  387. /package/lib/{cli → src/cli}/build/args.d.ts +0 -0
  388. /package/lib/{cli → src/cli}/build/assets.d.ts +0 -0
  389. /package/lib/{cli → src/cli}/build/esbuild.d.ts +0 -0
  390. /package/lib/{cli → src/cli}/build/index.d.ts +0 -0
  391. /package/lib/{cli → src/cli}/build/tsc.d.ts +0 -0
  392. /package/lib/{cli → src/cli}/buildPackage/index.d.ts +0 -0
  393. /package/lib/{cli → src/cli}/configure/analyseConfiguration.d.ts +0 -0
  394. /package/lib/{cli → src/cli}/configure/analysis/diff.d.ts +0 -0
  395. /package/lib/{cli → src/cli}/configure/analysis/files.d.ts +0 -0
  396. /package/lib/{cli → src/cli}/configure/analysis/git.d.ts +0 -0
  397. /package/lib/{cli → src/cli}/configure/analysis/project.d.ts +0 -0
  398. /package/lib/{cli → src/cli}/configure/dependencies/index.d.ts +0 -0
  399. /package/lib/{cli → src/cli}/configure/dependencies/seekDatadogCustomMetrics.d.ts +0 -0
  400. /package/lib/{cli → src/cli}/configure/dependencies/seekKoala.d.ts +0 -0
  401. /package/lib/{cli → src/cli}/configure/dependencies/skuba.d.ts +0 -0
  402. /package/lib/{cli → src/cli}/configure/dependencies/skubaDeps.d.ts +0 -0
  403. /package/lib/{cli → src/cli}/configure/dependencies/skubaDive.d.ts +0 -0
  404. /package/lib/{cli → src/cli}/configure/index.d.ts +0 -0
  405. /package/lib/{cli → src/cli}/configure/modules/eslint.d.ts +0 -0
  406. /package/lib/{cli → src/cli}/configure/modules/ignore.d.ts +0 -0
  407. /package/lib/{cli → src/cli}/configure/modules/index.d.ts +0 -0
  408. /package/lib/{cli → src/cli}/configure/modules/nodemon.d.ts +0 -0
  409. /package/lib/{cli → src/cli}/configure/modules/package.d.ts +0 -0
  410. /package/lib/{cli → src/cli}/configure/modules/prettier.d.ts +0 -0
  411. /package/lib/{cli → src/cli}/configure/modules/renovate.d.ts +0 -0
  412. /package/lib/{cli → src/cli}/configure/modules/serverless.d.ts +0 -0
  413. /package/lib/{cli → src/cli}/configure/modules/tslint.d.ts +0 -0
  414. /package/lib/{cli → src/cli}/configure/processing/configFile.d.ts +0 -0
  415. /package/lib/{cli → src/cli}/configure/processing/deleteFiles.d.ts +0 -0
  416. /package/lib/{cli → src/cli}/configure/processing/javascript.d.ts +0 -0
  417. /package/lib/{cli → src/cli}/configure/processing/json.d.ts +0 -0
  418. /package/lib/{cli → src/cli}/configure/processing/loadFiles.d.ts +0 -0
  419. /package/lib/{cli → src/cli}/configure/processing/module.d.ts +0 -0
  420. /package/lib/{cli → src/cli}/configure/processing/prettier.d.ts +0 -0
  421. /package/lib/{cli → src/cli}/configure/processing/record.d.ts +0 -0
  422. /package/lib/{cli → src/cli}/configure/processing/typescript.d.ts +0 -0
  423. /package/lib/{cli → src/cli}/format/index.d.ts +0 -0
  424. /package/lib/{cli → src/cli}/help/index.d.ts +0 -0
  425. /package/lib/{cli → src/cli}/init/git.d.ts +0 -0
  426. /package/lib/{cli → src/cli}/init/index.d.ts +0 -0
  427. /package/lib/{cli → src/cli}/init/types.d.ts +0 -0
  428. /package/lib/{cli → src/cli}/init/validation.d.ts +0 -0
  429. /package/lib/{cli → src/cli}/init/writePackageJson.d.ts +0 -0
  430. /package/lib/{cli → src/cli}/lint/annotate/buildkite/eslint.d.ts +0 -0
  431. /package/lib/{cli → src/cli}/lint/annotate/buildkite/index.d.ts +0 -0
  432. /package/lib/{cli → src/cli}/lint/annotate/buildkite/internal.d.ts +0 -0
  433. /package/lib/{cli → src/cli}/lint/annotate/buildkite/prettier.d.ts +0 -0
  434. /package/lib/{cli → src/cli}/lint/annotate/buildkite/tsc.d.ts +0 -0
  435. /package/lib/{cli → src/cli}/lint/annotate/github/eslint.d.ts +0 -0
  436. /package/lib/{cli → src/cli}/lint/annotate/github/index.d.ts +0 -0
  437. /package/lib/{cli → src/cli}/lint/annotate/github/internal.d.ts +0 -0
  438. /package/lib/{cli → src/cli}/lint/annotate/github/prettier.d.ts +0 -0
  439. /package/lib/{cli → src/cli}/lint/annotate/github/tsc.d.ts +0 -0
  440. /package/lib/{cli → src/cli}/lint/annotate/index.d.ts +0 -0
  441. /package/lib/{cli → src/cli}/lint/autofix.d.ts +0 -0
  442. /package/lib/{cli → src/cli}/lint/eslint.d.ts +0 -0
  443. /package/lib/{cli → src/cli}/lint/external.d.ts +0 -0
  444. /package/lib/{cli → src/cli}/lint/index.d.ts +0 -0
  445. /package/lib/{cli → src/cli}/lint/internal.d.ts +0 -0
  446. /package/lib/{cli → src/cli}/lint/internalLints/detectBadCodeowners.d.ts +0 -0
  447. /package/lib/{cli → src/cli}/lint/internalLints/noSkubaTemplateJs.d.ts +0 -0
  448. /package/lib/{cli → src/cli}/lint/internalLints/patchRenovateConfig.d.ts +0 -0
  449. /package/lib/{cli → src/cli}/lint/internalLints/refreshConfigFiles.d.ts +0 -0
  450. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/10.0.4/index.d.ts +0 -0
  451. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/10.0.4/removeYarnIgnoreOptionalFlags.d.ts +0 -0
  452. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/10.1.0/index.d.ts +0 -0
  453. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/10.1.0/migrateNpmrcToPnpmWorkspace.d.ts +0 -0
  454. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/10.1.0/stopBundlingInCDKTests.d.ts +0 -0
  455. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/12.0.2/index.d.ts +0 -0
  456. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/12.0.2/unhandledRejections.d.ts +0 -0
  457. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/12.1.1/index.d.ts +0 -0
  458. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/12.1.1/patchJestSnapshots.d.ts +0 -0
  459. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/12.3.0/index.d.ts +0 -0
  460. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/12.3.0/patchApiTokenFromEnvironment.d.ts +0 -0
  461. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/12.3.0/patchDockerfileSyntaxDirective.d.ts +0 -0
  462. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/12.4.0/index.d.ts +0 -0
  463. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/12.4.0/patchDockerfileCIVariable.d.ts +0 -0
  464. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/12.4.1/configureTsConfigForESM.d.ts +0 -0
  465. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/12.4.1/index.d.ts +0 -0
  466. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/12.4.1/patchApiDockerfiles.d.ts +0 -0
  467. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/12.4.1/rewriteSrcImports.d.ts +0 -0
  468. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/12.4.1/updateLambdaConfigs.d.ts +0 -0
  469. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/7.3.1/addEmptyExports.d.ts +0 -0
  470. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/7.3.1/index.d.ts +0 -0
  471. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/7.3.1/patchDockerfile.d.ts +0 -0
  472. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/7.3.1/patchServerListener.d.ts +0 -0
  473. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/8.0.0/index.d.ts +0 -0
  474. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/8.0.0/patchPnpmPackageManager.d.ts +0 -0
  475. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/8.2.1/collapseDuplicateMergeKeys.d.ts +0 -0
  476. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/8.2.1/index.d.ts +0 -0
  477. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/8.2.1/moveNpmrcMounts.d.ts +0 -0
  478. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/8.2.1/patchDockerCompose.d.ts +0 -0
  479. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/8.2.1/patchDockerImages.d.ts +0 -0
  480. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/9.0.1/index.d.ts +0 -0
  481. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/9.0.1/patchPnpmDockerImages.d.ts +0 -0
  482. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/9.1.0/index.d.ts +0 -0
  483. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/9.1.0/upgradeNode.d.ts +0 -0
  484. /package/lib/{cli → src/cli}/lint/prettier.d.ts +0 -0
  485. /package/lib/{cli → src/cli}/lint/tsc.d.ts +0 -0
  486. /package/lib/{cli → src/cli}/lint/types.d.ts +0 -0
  487. /package/lib/{cli → src/cli}/migrate/index.d.ts +0 -0
  488. /package/lib/{cli → src/cli}/migrate/nodeVersion/checks.d.ts +0 -0
  489. /package/lib/{cli → src/cli}/migrate/nodeVersion/index.d.ts +0 -0
  490. /package/lib/{cli → src/cli}/node/index.d.ts +0 -0
  491. /package/lib/{cli → src/cli}/release/index.d.ts +0 -0
  492. /package/lib/{cli → src/cli}/start/index.d.ts +0 -0
  493. /package/lib/{cli → src/cli}/test/index.d.ts +0 -0
  494. /package/lib/{cli → src/cli}/version/index.d.ts +0 -0
  495. /package/lib/{skuba.d.ts → src/skuba.d.ts} +0 -0
  496. /package/lib/{utils → src/utils}/args.d.ts +0 -0
  497. /package/lib/{utils → src/utils}/command.d.ts +0 -0
  498. /package/lib/{utils → src/utils}/copy.d.ts +0 -0
  499. /package/lib/{utils → src/utils}/dir.d.ts +0 -0
  500. /package/lib/{utils → src/utils}/env.d.ts +0 -0
  501. /package/lib/{utils → src/utils}/error.d.ts +0 -0
  502. /package/lib/{utils → src/utils}/exec.d.ts +0 -0
  503. /package/lib/{utils → src/utils}/help.d.ts +0 -0
  504. /package/lib/{utils → src/utils}/logging.d.ts +0 -0
  505. /package/lib/{utils → src/utils}/logo.d.ts +0 -0
  506. /package/lib/{utils → src/utils}/npmrc.d.ts +0 -0
  507. /package/lib/{utils → src/utils}/packageManager.d.ts +0 -0
  508. /package/lib/{utils → src/utils}/port.d.ts +0 -0
  509. /package/lib/{utils → src/utils}/template.d.ts +0 -0
  510. /package/lib/{utils → src/utils}/validation.d.ts +0 -0
  511. /package/lib/{utils → src/utils}/version.d.ts +0 -0
  512. /package/lib/{utils → src/utils}/worker.d.ts +0 -0
  513. /package/lib/{wrapper → src/wrapper}/functionHandler.d.ts +0 -0
  514. /package/lib/{wrapper → src/wrapper}/index.d.ts +0 -0
  515. /package/lib/{wrapper → src/wrapper}/main.d.ts +0 -0
  516. /package/lib/{wrapper → src/wrapper}/requestListener.d.ts +0 -0
package/lib/utils/dir.js CHANGED
@@ -1,92 +1,55 @@
1
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 __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var dir_exports = {};
30
- __export(dir_exports, {
31
- buildPatternToFilepathMap: () => buildPatternToFilepathMap,
32
- crawlDirectory: () => crawlDirectory,
33
- createInclusionFilter: () => createInclusionFilter,
34
- findCurrentWorkspaceProjectRoot: () => findCurrentWorkspaceProjectRoot,
35
- findWorkspaceRoot: () => findWorkspaceRoot,
36
- locateFurthestFile: () => locateFurthestFile,
37
- locateNearestFile: () => locateNearestFile
38
- });
39
- module.exports = __toCommonJS(dir_exports);
40
- var import_path = __toESM(require("path"));
41
- var import_fs_extra = __toESM(require("fs-extra"));
42
- var import_ignore = __toESM(require("ignore"));
43
- var import_picomatch = __toESM(require("picomatch"));
44
- var import_error = require("./error.js");
45
- var Git = __toESM(require("@skuba-lib/api/git"));
46
- const buildPatternToFilepathMap = (patterns, allFilepaths, options) => Object.fromEntries(
2
+ import path from "path";
3
+ import fs from "fs-extra";
4
+ import ignore from "ignore";
5
+ import picomatch from "picomatch";
6
+ import { isErrorWithCode } from "./error.js";
7
+ import { pathExists } from "./fs.js";
8
+ import * as Git from "@skuba-lib/api/git";
9
+ export const buildPatternToFilepathMap = (patterns, allFilepaths, options) => Object.fromEntries(
47
10
  patterns.map((pattern) => {
48
- const isMatch = (0, import_picomatch.default)(pattern, options);
11
+ const isMatch = picomatch(pattern, options);
49
12
  const filepaths = allFilepaths.filter((filepath) => isMatch(filepath));
50
13
  return [pattern, filepaths];
51
14
  })
52
15
  );
53
- const crawlDirectory = async (root, ignoreFilenames = [".gitignore"]) => {
16
+ export const crawlDirectory = async (root, ignoreFilenames = [".gitignore"]) => {
54
17
  const ignoreFileFilter = await createInclusionFilter(
55
- ignoreFilenames.map((ignoreFilename) => import_path.default.join(root, ignoreFilename))
18
+ ignoreFilenames.map((ignoreFilename) => path.join(root, ignoreFilename))
56
19
  );
57
20
  const absoluteFilenames = await crawl(root, {
58
21
  includeDirName: (dirname) => ![".git", "node_modules"].includes(dirname),
59
- includeFilePath: (pathname) => ignoreFileFilter(import_path.default.relative(root, pathname))
22
+ includeFilePath: (pathname) => ignoreFileFilter(path.relative(root, pathname))
60
23
  });
61
24
  const relativeFilepaths = absoluteFilenames.map(
62
- (filepath) => import_path.default.relative(root, filepath)
25
+ (filepath) => path.relative(root, filepath)
63
26
  );
64
27
  return relativeFilepaths;
65
28
  };
66
- const createInclusionFilter = async (ignoreFilepaths) => {
29
+ export const createInclusionFilter = async (ignoreFilepaths) => {
67
30
  const ignoreFiles = await Promise.all(
68
31
  ignoreFilepaths.map(async (ignoreFilepath) => {
69
32
  try {
70
- return await import_fs_extra.default.promises.readFile(ignoreFilepath, "utf8");
33
+ return await fs.promises.readFile(ignoreFilepath, "utf8");
71
34
  } catch (err) {
72
- if ((0, import_error.isErrorWithCode)(err, "ENOENT")) {
35
+ if (isErrorWithCode(err, "ENOENT")) {
73
36
  return;
74
37
  }
75
38
  throw err;
76
39
  }
77
40
  })
78
41
  );
79
- const managers = ignoreFiles.filter((value) => typeof value === "string").map((value) => (0, import_ignore.default)().add(value));
80
- return (0, import_ignore.default)().add(".git").add(managers).createFilter();
42
+ const managers = ignoreFiles.filter((value) => typeof value === "string").map((value) => ignore().add(value));
43
+ return ignore().add(".git").add(managers).createFilter();
81
44
  };
82
45
  async function crawl(directoryPath, filters, paths = []) {
83
46
  try {
84
- const entries = await import_fs_extra.default.promises.readdir(directoryPath, {
47
+ const entries = await fs.promises.readdir(directoryPath, {
85
48
  withFileTypes: true
86
49
  });
87
50
  await Promise.all(
88
51
  entries.map(async (entry) => {
89
- const fullPath = import_path.default.join(directoryPath, entry.name);
52
+ const fullPath = path.join(directoryPath, entry.name);
90
53
  if ((entry.isFile() || entry.isSymbolicLink()) && filters.includeFilePath(fullPath)) {
91
54
  paths.push(fullPath);
92
55
  }
@@ -99,37 +62,37 @@ async function crawl(directoryPath, filters, paths = []) {
99
62
  }
100
63
  return paths;
101
64
  }
102
- const locateNearestFile = async ({
65
+ export const locateNearestFile = async ({
103
66
  cwd,
104
67
  filename
105
68
  }) => {
106
69
  let currentDir = cwd;
107
- while (currentDir !== import_path.default.dirname(currentDir)) {
108
- const filePath = import_path.default.join(currentDir, filename);
109
- if (await import_fs_extra.default.pathExists(filePath)) {
70
+ while (currentDir !== path.dirname(currentDir)) {
71
+ const filePath = path.join(currentDir, filename);
72
+ if (await pathExists(filePath)) {
110
73
  return filePath;
111
74
  }
112
- currentDir = import_path.default.dirname(currentDir);
75
+ currentDir = path.dirname(currentDir);
113
76
  }
114
77
  return null;
115
78
  };
116
- const locateFurthestFile = async ({
79
+ export const locateFurthestFile = async ({
117
80
  cwd,
118
81
  filename
119
82
  }) => {
120
83
  let currentDir = cwd;
121
84
  let furthestFilePath = null;
122
- while (currentDir !== import_path.default.dirname(currentDir)) {
123
- const filePath = import_path.default.join(currentDir, filename);
124
- if (await import_fs_extra.default.pathExists(filePath)) {
85
+ while (currentDir !== path.dirname(currentDir)) {
86
+ const filePath = path.join(currentDir, filename);
87
+ if (await pathExists(filePath)) {
125
88
  furthestFilePath = filePath;
126
89
  }
127
- currentDir = import_path.default.dirname(currentDir);
90
+ currentDir = path.dirname(currentDir);
128
91
  }
129
92
  return furthestFilePath;
130
93
  };
131
94
  const workspaceRootCache = {};
132
- const findWorkspaceRoot = async (cwd = process.cwd()) => {
95
+ export const findWorkspaceRoot = async (cwd = process.cwd()) => {
133
96
  const find = async () => {
134
97
  const [pnpmLock, yarnLock, packageJson, gitRoot] = await Promise.all([
135
98
  locateNearestFile({ cwd, filename: "pnpm-lock.yaml" }),
@@ -138,14 +101,14 @@ const findWorkspaceRoot = async (cwd = process.cwd()) => {
138
101
  Git.findRoot({ dir: cwd })
139
102
  ]);
140
103
  const candidates = [
141
- pnpmLock ? import_path.default.dirname(pnpmLock) : null,
142
- yarnLock ? import_path.default.dirname(yarnLock) : null,
143
- packageJson ? import_path.default.dirname(packageJson) : null,
104
+ pnpmLock ? path.dirname(pnpmLock) : null,
105
+ yarnLock ? path.dirname(yarnLock) : null,
106
+ packageJson ? path.dirname(packageJson) : null,
144
107
  gitRoot
145
108
  ].filter((dir) => dir !== null);
146
109
  if (candidates[0]) {
147
110
  return candidates.reduce((longest, current) => {
148
- if (current.split(import_path.default.sep).length > longest.split(import_path.default.sep).length) {
111
+ if (current.split(path.sep).length > longest.split(path.sep).length) {
149
112
  return current;
150
113
  }
151
114
  return longest;
@@ -155,21 +118,11 @@ const findWorkspaceRoot = async (cwd = process.cwd()) => {
155
118
  };
156
119
  return workspaceRootCache[cwd] ??= await find();
157
120
  };
158
- const findCurrentWorkspaceProjectRoot = async (cwd = process.cwd()) => {
121
+ export const findCurrentWorkspaceProjectRoot = async (cwd = process.cwd()) => {
159
122
  const packageJson = await locateNearestFile({
160
123
  cwd,
161
124
  filename: "package.json"
162
125
  });
163
- return packageJson ? import_path.default.dirname(packageJson) : null;
126
+ return packageJson ? path.dirname(packageJson) : null;
164
127
  };
165
- // Annotate the CommonJS export names for ESM import in node:
166
- 0 && (module.exports = {
167
- buildPatternToFilepathMap,
168
- crawlDirectory,
169
- createInclusionFilter,
170
- findCurrentWorkspaceProjectRoot,
171
- findWorkspaceRoot,
172
- locateFurthestFile,
173
- locateNearestFile
174
- });
175
128
  //# sourceMappingURL=dir.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/utils/dir.ts"],
4
- "sourcesContent": ["import path from 'path';\n\nimport fs from 'fs-extra';\nimport ignore from 'ignore';\nimport picomatch from 'picomatch';\n\nimport { isErrorWithCode } from './error.js';\n\nimport * as Git from '@skuba-lib/api/git';\n\n/**\n * Build a map that associates each glob pattern with its matching filepaths.\n */\nexport const buildPatternToFilepathMap = (\n patterns: string[],\n allFilepaths: string[],\n options?: picomatch.PicomatchOptions,\n) =>\n Object.fromEntries(\n patterns.map((pattern) => {\n const isMatch = picomatch(pattern, options);\n\n const filepaths = allFilepaths.filter((filepath) => isMatch(filepath));\n\n return [pattern, filepaths] as const;\n }),\n );\n\n/**\n * List relative filepaths contained within a directory root.\n *\n * This excludes:\n *\n * - Patterns in the ignore files specified in `ignoreFilenames`\n * - `.git` subdirectories\n * - `node_modules` subdirectories\n */\nexport const crawlDirectory = async (\n root: string,\n ignoreFilenames = ['.gitignore'],\n) => {\n const ignoreFileFilter = await createInclusionFilter(\n ignoreFilenames.map((ignoreFilename) => path.join(root, ignoreFilename)),\n );\n\n const absoluteFilenames = await crawl(root, {\n includeDirName: (dirname) => !['.git', 'node_modules'].includes(dirname),\n includeFilePath: (pathname) =>\n ignoreFileFilter(path.relative(root, pathname)),\n });\n\n const relativeFilepaths = absoluteFilenames.map((filepath) =>\n path.relative(root, filepath),\n );\n\n return relativeFilepaths;\n};\n\n/**\n * Create a filter function that excludes filepaths based on ignore files like\n * `.gitignore` and `.prettierignore`.\n */\nexport const createInclusionFilter = async (ignoreFilepaths: string[]) => {\n const ignoreFiles = await Promise.all(\n ignoreFilepaths.map(async (ignoreFilepath) => {\n try {\n return await fs.promises.readFile(ignoreFilepath, 'utf8');\n } catch (err) {\n if (isErrorWithCode(err, 'ENOENT')) {\n return;\n }\n\n throw err;\n }\n }),\n );\n\n const managers = ignoreFiles\n .filter((value): value is string => typeof value === 'string')\n .map((value) => ignore().add(value));\n\n return ignore().add('.git').add(managers).createFilter();\n};\n\n/**\n * Recursively crawl a directory and return all file paths that match the\n * filters. `paths` is mutated and returned.\n */\nasync function crawl(\n directoryPath: string,\n filters: {\n includeDirName: (dirName: string) => boolean;\n includeFilePath: (path: string) => boolean;\n },\n paths: string[] = [],\n) {\n try {\n const entries = await fs.promises.readdir(directoryPath, {\n withFileTypes: true,\n });\n\n await Promise.all(\n entries.map(async (entry) => {\n const fullPath = path.join(directoryPath, entry.name);\n\n if (\n (entry.isFile() || entry.isSymbolicLink()) &&\n filters.includeFilePath(fullPath)\n ) {\n paths.push(fullPath);\n }\n\n if (entry.isDirectory() && filters.includeDirName(entry.name)) {\n await crawl(fullPath, filters, paths);\n }\n }),\n );\n } catch {\n // Ignore errors, because of e.g. permission issues reading directories\n }\n\n return paths;\n}\n\nexport const locateNearestFile = async ({\n cwd,\n filename,\n}: {\n cwd: string;\n filename: string;\n}) => {\n let currentDir = cwd;\n while (currentDir !== path.dirname(currentDir)) {\n const filePath = path.join(currentDir, filename);\n if (await fs.pathExists(filePath)) {\n return filePath;\n }\n currentDir = path.dirname(currentDir);\n }\n\n return null;\n};\n\nexport const locateFurthestFile = async ({\n cwd,\n filename,\n}: {\n cwd: string;\n filename: string;\n}) => {\n let currentDir = cwd;\n let furthestFilePath: string | null = null;\n\n while (currentDir !== path.dirname(currentDir)) {\n const filePath = path.join(currentDir, filename);\n if (await fs.pathExists(filePath)) {\n furthestFilePath = filePath;\n }\n currentDir = path.dirname(currentDir);\n }\n\n return furthestFilePath;\n};\n\nconst workspaceRootCache: Record<string, string | null> = {};\n\nexport const findWorkspaceRoot = async (\n cwd = process.cwd(),\n): Promise<string | null> => {\n const find = async (): Promise<string | null> => {\n const [pnpmLock, yarnLock, packageJson, gitRoot] = await Promise.all([\n locateNearestFile({ cwd, filename: 'pnpm-lock.yaml' }),\n locateNearestFile({ cwd, filename: 'yarn.lock' }),\n locateFurthestFile({ cwd, filename: 'package.json' }),\n Git.findRoot({ dir: cwd }),\n ]);\n\n const candidates = [\n pnpmLock ? path.dirname(pnpmLock) : null,\n yarnLock ? path.dirname(yarnLock) : null,\n packageJson ? path.dirname(packageJson) : null,\n gitRoot,\n ].filter((dir): dir is string => dir !== null);\n\n if (candidates[0]) {\n // Pick the longest path. This will be the most specific, which helps guard against someone\n // having an accidental lockfile in a parent directory by mistake.\n\n return candidates.reduce((longest, current) => {\n if (current.split(path.sep).length > longest.split(path.sep).length) {\n return current;\n }\n return longest;\n }, candidates[0]);\n }\n\n return null;\n };\n\n return (workspaceRootCache[cwd] ??= await find());\n};\n\nexport const findCurrentWorkspaceProjectRoot = async (\n cwd = process.cwd(),\n): Promise<string | null> => {\n const packageJson = await locateNearestFile({\n cwd,\n filename: 'package.json',\n });\n return packageJson ? path.dirname(packageJson) : null;\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,sBAAe;AACf,oBAAmB;AACnB,uBAAsB;AAEtB,mBAAgC;AAEhC,UAAqB;AAKd,MAAM,4BAA4B,CACvC,UACA,cACA,YAEA,OAAO;AAAA,EACL,SAAS,IAAI,CAAC,YAAY;AACxB,UAAM,cAAU,iBAAAA,SAAU,SAAS,OAAO;AAE1C,UAAM,YAAY,aAAa,OAAO,CAAC,aAAa,QAAQ,QAAQ,CAAC;AAErE,WAAO,CAAC,SAAS,SAAS;AAAA,EAC5B,CAAC;AACH;AAWK,MAAM,iBAAiB,OAC5B,MACA,kBAAkB,CAAC,YAAY,MAC5B;AACH,QAAM,mBAAmB,MAAM;AAAA,IAC7B,gBAAgB,IAAI,CAAC,mBAAmB,YAAAC,QAAK,KAAK,MAAM,cAAc,CAAC;AAAA,EACzE;AAEA,QAAM,oBAAoB,MAAM,MAAM,MAAM;AAAA,IAC1C,gBAAgB,CAAC,YAAY,CAAC,CAAC,QAAQ,cAAc,EAAE,SAAS,OAAO;AAAA,IACvE,iBAAiB,CAAC,aAChB,iBAAiB,YAAAA,QAAK,SAAS,MAAM,QAAQ,CAAC;AAAA,EAClD,CAAC;AAED,QAAM,oBAAoB,kBAAkB;AAAA,IAAI,CAAC,aAC/C,YAAAA,QAAK,SAAS,MAAM,QAAQ;AAAA,EAC9B;AAEA,SAAO;AACT;AAMO,MAAM,wBAAwB,OAAO,oBAA8B;AACxE,QAAM,cAAc,MAAM,QA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YAAAA,QAAK,GAAG,EAAE,QAAQ;AACnE,iBAAO;AAAA,QACT;AACA,eAAO;AAAA,MACT,GAAG,WAAW,CAAC,CAAC;AAAA,IAClB;AAEA,WAAO;AAAA,EACT;AAEA,SAAQ,mBAAmB,GAAG,MAAM,MAAM,KAAK;AACjD;AAEO,MAAM,kCAAkC,OAC7C,MAAM,QAAQ,IAAI,MACS;AAC3B,QAAM,cAAc,MAAM,kBAAkB;AAAA,IAC1C;AAAA,IACA,UAAU;AAAA,EACZ,CAAC;AACD,SAAO,cAAc,YAAAA,QAAK,QAAQ,WAAW,IAAI;AACnD;",
6
- "names": ["picomatch", "path", "fs", "ignore"]
4
+ "sourcesContent": ["import path from 'path';\n\nimport fs from 'fs-extra';\nimport ignore from 'ignore';\nimport picomatch from 'picomatch';\n\nimport { isErrorWithCode } from './error.js';\nimport { pathExists } from './fs.js';\n\nimport * as Git from '@skuba-lib/api/git';\n\n/**\n * Build a map that associates each glob pattern with its matching filepaths.\n */\nexport const buildPatternToFilepathMap = (\n patterns: string[],\n allFilepaths: string[],\n options?: picomatch.PicomatchOptions,\n) =>\n Object.fromEntries(\n patterns.map((pattern) => {\n const isMatch = picomatch(pattern, options);\n\n const filepaths = allFilepaths.filter((filepath) => isMatch(filepath));\n\n return [pattern, filepaths] as const;\n }),\n );\n\n/**\n * List relative filepaths contained within a directory root.\n *\n * This excludes:\n *\n * - Patterns in the ignore files specified in `ignoreFilenames`\n * - `.git` subdirectories\n * - `node_modules` subdirectories\n */\nexport const crawlDirectory = async (\n root: string,\n ignoreFilenames = ['.gitignore'],\n) => {\n const ignoreFileFilter = await createInclusionFilter(\n ignoreFilenames.map((ignoreFilename) => path.join(root, ignoreFilename)),\n );\n\n const absoluteFilenames = await crawl(root, {\n includeDirName: (dirname) => !['.git', 'node_modules'].includes(dirname),\n includeFilePath: (pathname) =>\n ignoreFileFilter(path.relative(root, pathname)),\n });\n\n const relativeFilepaths = absoluteFilenames.map((filepath) =>\n path.relative(root, filepath),\n );\n\n return relativeFilepaths;\n};\n\n/**\n * Create a filter function that excludes filepaths based on ignore files like\n * `.gitignore` and `.prettierignore`.\n */\nexport const createInclusionFilter = async (ignoreFilepaths: string[]) => {\n const ignoreFiles = await Promise.all(\n ignoreFilepaths.map(async (ignoreFilepath) => {\n try {\n return await fs.promises.readFile(ignoreFilepath, 'utf8');\n } catch (err) {\n if (isErrorWithCode(err, 'ENOENT')) {\n return;\n }\n\n throw err;\n }\n }),\n );\n\n const managers = ignoreFiles\n .filter((value): value is string => typeof value === 'string')\n .map((value) => ignore().add(value));\n\n return ignore().add('.git').add(managers).createFilter();\n};\n\n/**\n * Recursively crawl a directory and return all file paths that match the\n * filters. `paths` is mutated and returned.\n */\nasync function crawl(\n directoryPath: string,\n filters: {\n includeDirName: (dirName: string) => boolean;\n includeFilePath: (path: string) => boolean;\n },\n paths: string[] = [],\n) {\n try {\n const entries = await fs.promises.readdir(directoryPath, {\n withFileTypes: true,\n });\n\n await Promise.all(\n entries.map(async (entry) => {\n const fullPath = path.join(directoryPath, entry.name);\n\n if (\n (entry.isFile() || entry.isSymbolicLink()) &&\n filters.includeFilePath(fullPath)\n ) {\n paths.push(fullPath);\n }\n\n if (entry.isDirectory() && filters.includeDirName(entry.name)) {\n await crawl(fullPath, filters, paths);\n }\n }),\n );\n } catch {\n // Ignore errors, because of e.g. permission issues reading directories\n }\n\n return paths;\n}\n\nexport const locateNearestFile = async ({\n cwd,\n filename,\n}: {\n cwd: string;\n filename: string;\n}) => {\n let currentDir = cwd;\n while (currentDir !== path.dirname(currentDir)) {\n const filePath = path.join(currentDir, filename);\n if (await pathExists(filePath)) {\n return filePath;\n }\n currentDir = path.dirname(currentDir);\n }\n\n return null;\n};\n\nexport const locateFurthestFile = async ({\n cwd,\n filename,\n}: {\n cwd: string;\n filename: string;\n}) => {\n let currentDir = cwd;\n let furthestFilePath: string | null = null;\n\n while (currentDir !== path.dirname(currentDir)) {\n const filePath = path.join(currentDir, filename);\n if (await pathExists(filePath)) {\n furthestFilePath = filePath;\n }\n currentDir = path.dirname(currentDir);\n }\n\n return furthestFilePath;\n};\n\nconst workspaceRootCache: Record<string, string | null> = {};\n\nexport const findWorkspaceRoot = async (\n cwd = process.cwd(),\n): Promise<string | null> => {\n const find = async (): Promise<string | null> => {\n const [pnpmLock, yarnLock, packageJson, gitRoot] = await Promise.all([\n locateNearestFile({ cwd, filename: 'pnpm-lock.yaml' }),\n locateNearestFile({ cwd, filename: 'yarn.lock' }),\n locateFurthestFile({ cwd, filename: 'package.json' }),\n Git.findRoot({ dir: cwd }),\n ]);\n\n const candidates = [\n pnpmLock ? path.dirname(pnpmLock) : null,\n yarnLock ? path.dirname(yarnLock) : null,\n packageJson ? path.dirname(packageJson) : null,\n gitRoot,\n ].filter((dir): dir is string => dir !== null);\n\n if (candidates[0]) {\n // Pick the longest path. This will be the most specific, which helps guard against someone\n // having an accidental lockfile in a parent directory by mistake.\n\n return candidates.reduce((longest, current) => {\n if (current.split(path.sep).length > longest.split(path.sep).length) {\n return current;\n }\n return longest;\n }, candidates[0]);\n }\n\n return null;\n };\n\n return (workspaceRootCache[cwd] ??= await find());\n};\n\nexport const findCurrentWorkspaceProjectRoot = async (\n cwd = process.cwd(),\n): Promise<string | null> => {\n const packageJson = await locateNearestFile({\n cwd,\n filename: 'package.json',\n });\n return packageJson ? path.dirname(packageJson) : null;\n};\n"],
5
+ "mappings": ";AAAA,OAAO,UAAU;AAEjB,OAAO,QAAQ;AACf,OAAO,YAAY;AACnB,OAAO,eAAe;AAEtB,SAAS,uBAAuB;AAChC,SAAS,kBAAkB;AAE3B,YAAY,SAAS;AAKd,aAAM,4BAA4B,CACvC,UACA,cACA,YAEA,OAAO;AAAA,EACL,SAAS,IAAI,CAAC,YAAY;AACxB,UAAM,UAAU,UAAU,SAAS,OAAO;AAE1C,UAAM,YAAY,aAAa,OAAO,CAAC,aAAa,QAAQ,QAAQ,CAAC;AAErE,WAAO,CAAC,SAAS,SAAS;AAAA,EAC5B,CAAC;AAC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pD,IAAI,SAAS,EAAE,KAAK,IAAI,CAAC;AAAA,IAC3B,CAAC;AAED,UAAM,aAAa;AAAA,MACjB,WAAW,KAAK,QAAQ,QAAQ,IAAI;AAAA,MACpC,WAAW,KAAK,QAAQ,QAAQ,IAAI;AAAA,MACpC,cAAc,KAAK,QAAQ,WAAW,IAAI;AAAA,MAC1C;AAAA,IACF,EAAE,OAAO,CAAC,QAAuB,QAAQ,IAAI;AAE7C,QAAI,WAAW,CAAC,GAAG;AAIjB,aAAO,WAAW,OAAO,CAAC,SAAS,YAAY;AAC7C,YAAI,QAAQ,MAAM,KAAK,GAAG,EAAE,SAAS,QAAQ,MAAM,KAAK,GAAG,EAAE,QAAQ;AACnE,iBAAO;AAAA,QACT;AACA,eAAO;AAAA,MACT,GAAG,WAAW,CAAC,CAAC;AAAA,IAClB;AAEA,WAAO;AAAA,EACT;AAEA,SAAQ,mBAAmB,GAAG,MAAM,MAAM,KAAK;AACjD;AAEO,aAAM,kCAAkC,OAC7C,MAAM,QAAQ,IAAI,MACS;AAC3B,QAAM,cAAc,MAAM,kBAAkB;AAAA,IAC1C;AAAA,IACA,UAAU;AAAA,EACZ,CAAC;AACD,SAAO,cAAc,KAAK,QAAQ,WAAW,IAAI;AACnD;",
6
+ "names": []
7
7
  }
package/lib/utils/env.js CHANGED
@@ -1,29 +1,3 @@
1
1
  "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var env_exports = {};
20
- __export(env_exports, {
21
- isCiEnv: () => isCiEnv
22
- });
23
- module.exports = __toCommonJS(env_exports);
24
- const isCiEnv = (env = process.env) => Boolean(env.BUILDKITE || env.CI || env.GITHUB_ACTIONS);
25
- // Annotate the CommonJS export names for ESM import in node:
26
- 0 && (module.exports = {
27
- isCiEnv
28
- });
2
+ export const isCiEnv = (env = process.env) => Boolean(env.BUILDKITE || env.CI || env.GITHUB_ACTIONS);
29
3
  //# sourceMappingURL=env.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/utils/env.ts"],
4
4
  "sourcesContent": ["/**\n * Whether the code is executing in a CI environment.\n */\nexport const isCiEnv = (env = process.env): boolean =>\n Boolean(env.BUILDKITE || env.CI || env.GITHUB_ACTIONS);\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGO,MAAM,UAAU,CAAC,MAAM,QAAQ,QACpC,QAAQ,IAAI,aAAa,IAAI,MAAM,IAAI,cAAc;",
5
+ "mappings": ";AAGO,aAAM,UAAU,CAAC,MAAM,QAAQ,QACpC,QAAQ,IAAI,aAAa,IAAI,MAAM,IAAI,cAAc;",
6
6
  "names": []
7
7
  }
@@ -1,44 +1,9 @@
1
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 __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var error_exports = {};
30
- __export(error_exports, {
31
- concurrentlyErrorsSchema: () => concurrentlyErrorsSchema,
32
- createTerseError: () => createTerseError,
33
- handleCliError: () => handleCliError,
34
- isErrorWithCode: () => isErrorWithCode
35
- });
36
- module.exports = __toCommonJS(error_exports);
37
- var import_util = require("util");
38
- var z = __toESM(require("zod/v4"));
39
- var import_logging = require("./logging.js");
40
- var import_validation = require("./validation.js");
41
- const concurrentlyErrorsSchema = z.array(
2
+ import { inspect } from "util";
3
+ import * as z from "zod/v4";
4
+ import { log } from "./logging.js";
5
+ import { hasNumberProp, hasProp } from "./validation.js";
6
+ export const concurrentlyErrorsSchema = z.array(
42
7
  z.object({
43
8
  command: z.object({
44
9
  command: z.string(),
@@ -48,25 +13,18 @@ const concurrentlyErrorsSchema = z.array(
48
13
  exitCode: z.number()
49
14
  })
50
15
  );
51
- const createTerseError = (message) => Object.assign(new Error(message), {
52
- [import_util.inspect.custom]: () => message
16
+ export const createTerseError = (message) => Object.assign(new Error(message), {
17
+ [inspect.custom]: () => message
53
18
  });
54
- const isExecaError = (err) => (0, import_validation.hasNumberProp)(err, "exitCode");
55
- const handleCliError = (err) => {
19
+ const isExecaError = (err) => hasNumberProp(err, "exitCode");
20
+ export const handleCliError = (err) => {
56
21
  if (isExecaError(err)) {
57
22
  process.exitCode = err.exitCode;
58
23
  return;
59
24
  }
60
- import_logging.log.err((0, import_util.inspect)(err));
25
+ log.err(inspect(err));
61
26
  process.exitCode = 1;
62
27
  return;
63
28
  };
64
- const isErrorWithCode = (err, code) => (0, import_validation.hasProp)(err, "code") && err.code === code;
65
- // Annotate the CommonJS export names for ESM import in node:
66
- 0 && (module.exports = {
67
- concurrentlyErrorsSchema,
68
- createTerseError,
69
- handleCliError,
70
- isErrorWithCode
71
- });
29
+ export const isErrorWithCode = (err, code) => hasProp(err, "code") && err.code === code;
72
30
  //# sourceMappingURL=error.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/utils/error.ts"],
4
4
  "sourcesContent": ["import { inspect } from 'util';\n\nimport type { ExecaError } from 'execa';\nimport * as z from 'zod/v4';\n\nimport { log } from './logging.js';\nimport { hasNumberProp, hasProp } from './validation.js';\n\nexport type ConcurrentlyErrors = z.infer<typeof concurrentlyErrorsSchema>;\n\nexport const concurrentlyErrorsSchema = z.array(\n z.object({\n command: z.object({\n command: z.string(),\n name: z.string(),\n }),\n index: z.number(),\n exitCode: z.number(),\n }),\n);\n\n/**\n * Creates an error that returns its plain `message` rather than a full stack\n * trace when `util.inspect`ed.\n *\n * This can be useful for terser handling and logging of known error scenarios\n * that have descriptive messages.\n *\n * https://nodejs.org/api/util.html#custom-inspection-functions-on-objects\n */\nexport const createTerseError = (message?: string) =>\n Object.assign(new Error(message), {\n [inspect.custom]: () => message,\n });\n\nconst isExecaError = (err: unknown): err is ExecaError =>\n hasNumberProp(err, 'exitCode');\n\nexport const handleCliError = (err: unknown) => {\n if (isExecaError(err)) {\n process.exitCode = err.exitCode;\n return;\n }\n\n log.err(inspect(err));\n process.exitCode = 1;\n return;\n};\n\nexport const isErrorWithCode = <T>(\n err: unknown,\n code: T,\n): err is Record<PropertyKey, unknown> & { code: T } =>\n hasProp(err, 'code') && err.code === code;\n"],
5
- "mappings": ";;;;;;;;;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,MAAM,GAAG,MAAM;AAC1B,CAAC;AAEH,MAAM,eAAe,CAAC,QACpB,cAAc,KAAK,UAAU;AAExB,aAAM,iBAAiB,CAAC,QAAiB;AAC9C,MAAI,aAAa,GAAG,GAAG;AACrB,YAAQ,WAAW,IAAI;AACvB;AAAA,EACF;AAEA,MAAI,IAAI,QAAQ,GAAG,CAAC;AACpB,UAAQ,WAAW;AACnB;AACF;AAEO,aAAM,kBAAkB,CAC7B,KACA,SAEA,QAAQ,KAAK,MAAM,KAAK,IAAI,SAAS;",
6
6
  "names": []
7
7
  }
package/lib/utils/exec.js CHANGED
@@ -1,50 +1,14 @@
1
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 __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var exec_exports = {};
30
- __export(exec_exports, {
31
- createExec: () => createExec,
32
- ensureCommands: () => ensureCommands,
33
- exec: () => exec,
34
- execConcurrently: () => execConcurrently,
35
- hasCommand: () => hasCommand
36
- });
37
- module.exports = __toCommonJS(exec_exports);
38
- var import_os = require("os");
39
- var import_stream = __toESM(require("stream"));
40
- var import_util = __toESM(require("util"));
41
- var import_concurrently = __toESM(require("concurrently"));
42
- var import_execa = __toESM(require("execa"));
43
- var import_npm_run_path = __toESM(require("npm-run-path"));
44
- var import_npm_which = __toESM(require("npm-which"));
45
- var import_error = require("./error.js");
46
- var import_logging = require("./logging.js");
47
- class YarnSpamFilter extends import_stream.default.Transform {
2
+ import { cpus } from "os";
3
+ import stream from "stream";
4
+ import util from "util";
5
+ import concurrently from "concurrently";
6
+ import execa from "execa";
7
+ import npmRunPath from "npm-run-path";
8
+ import npmWhich from "npm-which";
9
+ import { concurrentlyErrorsSchema, isErrorWithCode } from "./error.js";
10
+ import { log } from "./logging.js";
11
+ class YarnSpamFilter extends stream.Transform {
48
12
  silenced = false;
49
13
  _transform(chunk, _encoding, callback) {
50
14
  const str = Buffer.from(chunk).toString();
@@ -58,7 +22,7 @@ class YarnSpamFilter extends import_stream.default.Transform {
58
22
  callback();
59
23
  }
60
24
  }
61
- class YarnWarningFilter extends import_stream.default.Transform {
25
+ class YarnWarningFilter extends stream.Transform {
62
26
  _transform(chunk, _encoding, callback) {
63
27
  const str = Buffer.from(chunk).toString();
64
28
  if (!str.startsWith("warning skuba >")) {
@@ -68,11 +32,11 @@ class YarnWarningFilter extends import_stream.default.Transform {
68
32
  }
69
33
  }
70
34
  const envWithPath = {
71
- PATH: (0, import_npm_run_path.default)({ cwd: __dirname })
35
+ PATH: npmRunPath({ cwd: import.meta.dirname })
72
36
  };
73
37
  const runCommand = (command, args, opts) => {
74
- const subprocess = (0, import_execa.default)(command, args, {
75
- localDir: __dirname,
38
+ const subprocess = execa(command, args, {
39
+ localDir: import.meta.dirname,
76
40
  preferLocal: true,
77
41
  stdio: "inherit",
78
42
  ...opts
@@ -92,17 +56,17 @@ const runCommand = (command, args, opts) => {
92
56
  }
93
57
  return subprocess;
94
58
  };
95
- const whichCallback = (0, import_npm_which.default)(__dirname);
96
- const which = import_util.default.promisify(whichCallback);
97
- const createExec = (opts) => (command, ...args) => runCommand(command, args, opts);
98
- const exec = (command, ...args) => runCommand(command, args);
99
- const execConcurrently = async (commands, { maxProcesses, nameLength, outputStream } = {}) => {
59
+ const whichCallback = npmWhich(import.meta.dirname);
60
+ const which = util.promisify(whichCallback);
61
+ export const createExec = (opts) => (command, ...args) => runCommand(command, args, opts);
62
+ export const exec = (command, ...args) => runCommand(command, args);
63
+ export const execConcurrently = async (commands, { maxProcesses, nameLength, outputStream } = {}) => {
100
64
  const maxNameLength = nameLength ?? commands.reduce(
101
65
  (length, command) => Math.max(length, command.name.length),
102
66
  0
103
67
  );
104
68
  try {
105
- await (0, import_concurrently.default)(
69
+ await concurrently(
106
70
  commands.map(({ command, name, prefixColor }) => ({
107
71
  command,
108
72
  env: envWithPath,
@@ -110,14 +74,14 @@ const execConcurrently = async (commands, { maxProcesses, nameLength, outputStre
110
74
  prefixColor
111
75
  })),
112
76
  {
113
- maxProcesses: maxProcesses ?? (0, import_os.cpus)().length,
77
+ maxProcesses: maxProcesses ?? cpus().length,
114
78
  outputStream,
115
79
  // Use a minimalist logging prefix.
116
80
  prefix: "{name} \u2502"
117
81
  }
118
82
  ).result;
119
83
  } catch (err) {
120
- const result = import_error.concurrentlyErrorsSchema.safeParse(err);
84
+ const result = concurrentlyErrorsSchema.safeParse(err);
121
85
  if (!result.success) {
122
86
  throw err;
123
87
  }
@@ -127,14 +91,14 @@ const execConcurrently = async (commands, { maxProcesses, nameLength, outputStre
127
91
  );
128
92
  }
129
93
  };
130
- const ensureCommands = async (...names) => {
94
+ export const ensureCommands = async (...names) => {
131
95
  let success = true;
132
96
  await Promise.all(
133
97
  names.map(async (name) => {
134
98
  const result = await hasCommand(name);
135
99
  if (!result) {
136
100
  success = false;
137
- import_logging.log.err(import_logging.log.bold(name), "needs to be installed.");
101
+ log.err(log.bold(name), "needs to be installed.");
138
102
  }
139
103
  })
140
104
  );
@@ -142,23 +106,15 @@ const ensureCommands = async (...names) => {
142
106
  process.exit(1);
143
107
  }
144
108
  };
145
- const hasCommand = async (name) => {
109
+ export const hasCommand = async (name) => {
146
110
  try {
147
111
  await which(name);
148
112
  return true;
149
113
  } catch (err) {
150
- if ((0, import_error.isErrorWithCode)(err, "ENOENT")) {
114
+ if (isErrorWithCode(err, "ENOENT")) {
151
115
  return false;
152
116
  }
153
117
  throw err;
154
118
  }
155
119
  };
156
- // Annotate the CommonJS export names for ESM import in node:
157
- 0 && (module.exports = {
158
- createExec,
159
- ensureCommands,
160
- exec,
161
- execConcurrently,
162
- hasCommand
163
- });
164
120
  //# sourceMappingURL=exec.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/utils/exec.ts"],
4
- "sourcesContent": ["import { cpus } from 'os';\nimport stream from 'stream';\nimport util from 'util';\n\nimport type { Color } from 'chalk';\nimport concurrently from 'concurrently';\nimport execa, { type ExecaChildProcess } from 'execa';\nimport npmRunPath from 'npm-run-path';\nimport npmWhich from 'npm-which';\n\nimport { concurrentlyErrorsSchema, isErrorWithCode } from './error.js';\nimport { log } from './logging.js';\nimport type { PackageManager } from './packageManager.js';\n\nclass YarnSpamFilter extends stream.Transform {\n silenced = false;\n\n _transform(\n chunk: Uint8Array,\n _encoding: BufferEncoding,\n callback: stream.TransformCallback,\n ) {\n const str = Buffer.from(chunk).toString();\n\n // Yarn spews the entire installed dependency tree after this message\n if (str.startsWith('info Direct dependencies')) {\n this.silenced = true;\n }\n\n if (\n !this.silenced &&\n // This isn't very useful given the command generates a lockfile\n !str.startsWith('info No lockfile found')\n ) {\n this.push(chunk);\n }\n\n callback();\n }\n}\n\nclass YarnWarningFilter extends stream.Transform {\n _transform(\n chunk: Uint8Array,\n _encoding: BufferEncoding,\n callback: stream.TransformCallback,\n ) {\n const str = Buffer.from(chunk).toString();\n\n // Filter out annoying deprecation warnings that users can do little about\n if (!str.startsWith('warning skuba >')) {\n this.push(chunk);\n }\n\n callback();\n }\n}\n\nexport type Exec = (\n command: string,\n ...args: string[]\n) => ExecaChildProcess<string>;\n\ninterface ExecConcurrentlyCommand {\n command: string;\n name: string;\n prefixColor?: typeof Color;\n}\n\ninterface ExecConcurrentlyOptions {\n /**\n * The maximum number of processes that can execute concurrently.\n *\n * Defaults to the CPU core count.\n */\n maxProcesses?: number;\n\n /**\n * A set length to pad names to.\n *\n * Defaults to the length of the longest command name.\n */\n nameLength?: number;\n\n /**\n * The stream that logging output will be written to.\n *\n * Defaults to `process.stdout`.\n */\n outputStream?: stream.Writable;\n}\n\ntype ExecOptions = execa.Options & { streamStdio?: true | PackageManager };\n\nconst envWithPath = {\n PATH: npmRunPath({ cwd: __dirname }),\n};\n\nconst runCommand = (command: string, args: string[], opts?: ExecOptions) => {\n const subprocess = execa(command, args, {\n localDir: __dirname,\n preferLocal: true,\n stdio: 'inherit',\n ...opts,\n });\n\n switch (opts?.streamStdio) {\n case 'yarn':\n const stderrFilter = new YarnWarningFilter();\n const stdoutFilter = new YarnSpamFilter();\n\n subprocess.stderr?.pipe(stderrFilter).pipe(process.stderr);\n subprocess.stdout?.pipe(stdoutFilter).pipe(process.stdout);\n\n break;\n\n case 'pnpm':\n case true:\n subprocess.stderr?.pipe(process.stderr);\n subprocess.stdout?.pipe(process.stdout);\n\n break;\n }\n\n return subprocess;\n};\n\nconst whichCallback = npmWhich(__dirname);\n\nconst which = util.promisify<string, string>(whichCallback);\n\nexport const createExec =\n (opts: ExecOptions): Exec =>\n (command, ...args) =>\n runCommand(command, args, opts);\n\nexport const exec: Exec = (command, ...args) => runCommand(command, args);\n\nexport const execConcurrently = async (\n commands: ExecConcurrentlyCommand[],\n { maxProcesses, nameLength, outputStream }: ExecConcurrentlyOptions = {},\n) => {\n const maxNameLength =\n nameLength ??\n commands.reduce(\n (length, command) => Math.max(length, command.name.length),\n 0,\n );\n\n try {\n await concurrently(\n commands.map(({ command, name, prefixColor }) => ({\n command,\n env: envWithPath,\n name: name.padEnd(maxNameLength),\n prefixColor,\n })),\n {\n maxProcesses: maxProcesses ?? cpus().length,\n\n outputStream,\n\n // Use a minimalist logging prefix.\n prefix: '{name} \u2502',\n },\n ).result;\n } catch (err) {\n const result = concurrentlyErrorsSchema.safeParse(err);\n\n if (!result.success) {\n throw err;\n }\n\n const failed = result.data\n .filter(({ exitCode }) => exitCode !== 0)\n .sort(({ index: indexA }, { index: indexB }) => indexA - indexB)\n .map((subprocess) => subprocess.command.name);\n\n throw Error(\n `${failed.join(', ')} subprocess${\n failed.length === 1 ? '' : 'es'\n } failed.`,\n );\n }\n};\n\nexport const ensureCommands = async (...names: string[]) => {\n let success = true;\n\n await Promise.all(\n names.map(async (name) => {\n const result = await hasCommand(name);\n\n if (!result) {\n success = false;\n\n log.err(log.bold(name), 'needs to be installed.');\n }\n }),\n );\n\n if (!success) {\n process.exit(1);\n }\n};\n\nexport const hasCommand = async (name: string) => {\n try {\n await which(name);\n\n return true;\n } catch (err) {\n if (isErrorWithCode(err, 'ENOENT')) {\n return false;\n }\n\n throw err;\n }\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAAqB;AACrB,oBAAmB;AACnB,kBAAiB;AAGjB,0BAAyB;AACzB,mBAA8C;AAC9C,0BAAuB;AACvB,uBAAqB;AAErB,mBAA0D;AAC1D,qBAAoB;AAGpB,MAAM,uBAAuB,cAAAA,QAAO,UAAU;AAAA,EAC5C,WAAW;AAAA,EAEX,WACE,OACA,WACA,UACA;AACA,UAAM,MAAM,OAAO,KAAK,KAAK,EAAE,SAAS;AAGxC,QAAI,IAAI,WAAW,0BAA0B,GAAG;AAC9C,WAAK,WAAW;AAAA,IAClB;AAEA,QACE,CAAC,KAAK;AAAA,IAEN,CAAC,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AAChD,MAAI;AACF,UAAM,MAAM,IAAI;AAEhB,WAAO;AAAA,EACT,SAAS,KAAK;AACZ,YAAI,8BAAgB,KAAK,QAAQ,GAAG;AAClC,aAAO;AAAA,IACT;AAEA,UAAM;AAAA,EACR;AACF;",
6
- "names": ["stream", "npmRunPath", "execa", "npmWhich", "util", "concurrently"]
4
+ "sourcesContent": ["import { cpus } from 'os';\nimport stream from 'stream';\nimport util from 'util';\n\nimport type { Color } from 'chalk';\nimport concurrently from 'concurrently';\nimport execa, { type ExecaChildProcess } from 'execa';\nimport npmRunPath from 'npm-run-path';\nimport npmWhich from 'npm-which';\n\nimport { concurrentlyErrorsSchema, isErrorWithCode } from './error.js';\nimport { log } from './logging.js';\nimport type { PackageManager } from './packageManager.js';\n\nclass YarnSpamFilter extends stream.Transform {\n silenced = false;\n\n _transform(\n chunk: Uint8Array,\n _encoding: BufferEncoding,\n callback: stream.TransformCallback,\n ) {\n const str = Buffer.from(chunk).toString();\n\n // Yarn spews the entire installed dependency tree after this message\n if (str.startsWith('info Direct dependencies')) {\n this.silenced = true;\n }\n\n if (\n !this.silenced &&\n // This isn't very useful given the command generates a lockfile\n !str.startsWith('info No lockfile found')\n ) {\n this.push(chunk);\n }\n\n callback();\n }\n}\n\nclass YarnWarningFilter extends stream.Transform {\n _transform(\n chunk: Uint8Array,\n _encoding: BufferEncoding,\n callback: stream.TransformCallback,\n ) {\n const str = Buffer.from(chunk).toString();\n\n // Filter out annoying deprecation warnings that users can do little about\n if (!str.startsWith('warning skuba >')) {\n this.push(chunk);\n }\n\n callback();\n }\n}\n\nexport type Exec = (\n command: string,\n ...args: string[]\n) => ExecaChildProcess<string>;\n\ninterface ExecConcurrentlyCommand {\n command: string;\n name: string;\n prefixColor?: typeof Color;\n}\n\ninterface ExecConcurrentlyOptions {\n /**\n * The maximum number of processes that can execute concurrently.\n *\n * Defaults to the CPU core count.\n */\n maxProcesses?: number;\n\n /**\n * A set length to pad names to.\n *\n * Defaults to the length of the longest command name.\n */\n nameLength?: number;\n\n /**\n * The stream that logging output will be written to.\n *\n * Defaults to `process.stdout`.\n */\n outputStream?: stream.Writable;\n}\n\ntype ExecOptions = execa.Options & { streamStdio?: true | PackageManager };\n\nconst envWithPath = {\n PATH: npmRunPath({ cwd: import.meta.dirname }),\n};\n\nconst runCommand = (command: string, args: string[], opts?: ExecOptions) => {\n const subprocess = execa(command, args, {\n localDir: import.meta.dirname,\n preferLocal: true,\n stdio: 'inherit',\n ...opts,\n });\n\n switch (opts?.streamStdio) {\n case 'yarn':\n const stderrFilter = new YarnWarningFilter();\n const stdoutFilter = new YarnSpamFilter();\n\n subprocess.stderr?.pipe(stderrFilter).pipe(process.stderr);\n subprocess.stdout?.pipe(stdoutFilter).pipe(process.stdout);\n\n break;\n\n case 'pnpm':\n case true:\n subprocess.stderr?.pipe(process.stderr);\n subprocess.stdout?.pipe(process.stdout);\n\n break;\n }\n\n return subprocess;\n};\n\nconst whichCallback = npmWhich(import.meta.dirname);\n\nconst which = util.promisify<string, string>(whichCallback);\n\nexport const createExec =\n (opts: ExecOptions): Exec =>\n (command, ...args) =>\n runCommand(command, args, opts);\n\nexport const exec: Exec = (command, ...args) => runCommand(command, args);\n\nexport const execConcurrently = async (\n commands: ExecConcurrentlyCommand[],\n { maxProcesses, nameLength, outputStream }: ExecConcurrentlyOptions = {},\n) => {\n const maxNameLength =\n nameLength ??\n commands.reduce(\n (length, command) => Math.max(length, command.name.length),\n 0,\n );\n\n try {\n await concurrently(\n commands.map(({ command, name, prefixColor }) => ({\n command,\n env: envWithPath,\n name: name.padEnd(maxNameLength),\n prefixColor,\n })),\n {\n maxProcesses: maxProcesses ?? cpus().length,\n\n outputStream,\n\n // Use a minimalist logging prefix.\n prefix: '{name} \u2502',\n },\n ).result;\n } catch (err) {\n const result = concurrentlyErrorsSchema.safeParse(err);\n\n if (!result.success) {\n throw err;\n }\n\n const failed = result.data\n .filter(({ exitCode }) => exitCode !== 0)\n .sort(({ index: indexA }, { index: indexB }) => indexA - indexB)\n .map((subprocess) => subprocess.command.name);\n\n throw Error(\n `${failed.join(', ')} subprocess${\n failed.length === 1 ? '' : 'es'\n } failed.`,\n );\n }\n};\n\nexport const ensureCommands = async (...names: string[]) => {\n let success = true;\n\n await Promise.all(\n names.map(async (name) => {\n const result = await hasCommand(name);\n\n if (!result) {\n success = false;\n\n log.err(log.bold(name), 'needs to be installed.');\n }\n }),\n );\n\n if (!success) {\n process.exit(1);\n }\n};\n\nexport const hasCommand = async (name: string) => {\n try {\n await which(name);\n\n return true;\n } catch (err) {\n if (isErrorWithCode(err, 'ENOENT')) {\n return false;\n }\n\n throw err;\n }\n};\n"],
5
+ "mappings": ";AAAA,SAAS,YAAY;AACrB,OAAO,YAAY;AACnB,OAAO,UAAU;AAGjB,OAAO,kBAAkB;AACzB,OAAO,WAAuC;AAC9C,OAAO,gBAAgB;AACvB,OAAO,cAAc;AAErB,SAAS,0BAA0B,uBAAuB;AAC1D,SAAS,WAAW;AAGpB,MAAM,uBAAuB,OAAO,UAAU;AAAA,EAC5C,WAAW;AAAA,EAEX,WACE,OACA,WACA,UACA;AACA,UAAM,MAAM,OAAO,KAAK,KAAK,EAAE,SAAS;AAGxC,QAAI,IAAI,WAAW,0BAA0B,GAAG;AAC9C,WAAK,WAAW;AAAA,IAClB;AAEA,QACE,CAAC,KAAK;AAAA,IAEN,CAAC,IAAI,WAAW,wBAAwB,GACxC;AACA,WAAK,KAAK,KAAK;AAAA,IACjB;AAEA,aAAS;AAAA,EACX;AACF;AAEA,MAAM,0BAA0B,OAAO,UAAU;AAAA,EAC/C,WACE,OACA,WACA,UACA;AACA,UAAM,MAAM,OAAO,KAAK,KAAK,EAAE,SAAS;AAGxC,QAAI,CAAC,IAAI,WAAW,iBAAiB,GAAG;AACtC,WAAK,KAAK,KAAK;AAAA,IACjB;AAEA,aAAS;AAAA,EACX;AACF;AAsCA,MAAM,cAAc;AAAA,EAClB,MAAM,WAAW,EAAE,KAAK,YAAY,QAAQ,CAAC;AAC/C;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ACF,EAAE;AAAA,EACJ,SAAS,KAAK;AACZ,UAAM,SAAS,yBAAyB,UAAU,GAAG;AAErD,QAAI,CAAC,OAAO,SAAS;AACnB,YAAM;AAAA,IACR;AAEA,UAAM,SAAS,OAAO,KACnB,OAAO,CAAC,EAAE,SAAS,MAAM,aAAa,CAAC,EACvC,KAAK,CAAC,EAAE,OAAO,OAAO,GAAG,EAAE,OAAO,OAAO,MAAM,SAAS,MAAM,EAC9D,IAAI,CAAC,eAAe,WAAW,QAAQ,IAAI;AAE9C,UAAM;AAAA,MACJ,GAAG,OAAO,KAAK,IAAI,CAAC,cAClB,OAAO,WAAW,IAAI,KAAK,IAC7B;AAAA,IACF;AAAA,EACF;AACF;AAEO,aAAM,iBAAiB,UAAU,UAAoB;AAC1D,MAAI,UAAU;AAEd,QAAM,QAAQ;AAAA,IACZ,MAAM,IAAI,OAAO,SAAS;AACxB,YAAM,SAAS,MAAM,WAAW,IAAI;AAEpC,UAAI,CAAC,QAAQ;AACX,kBAAU;AAEV,YAAI,IAAI,IAAI,KAAK,IAAI,GAAG,wBAAwB;AAAA,MAClD;AAAA,IACF,CAAC;AAAA,EACH;AAEA,MAAI,CAAC,SAAS;AACZ,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF;AAEO,aAAM,aAAa,OAAO,SAAiB;AAChD,MAAI;AACF,UAAM,MAAM,IAAI;AAEhB,WAAO;AAAA,EACT,SAAS,KAAK;AACZ,QAAI,gBAAgB,KAAK,QAAQ,GAAG;AAClC,aAAO;AAAA,IACT;AAEA,UAAM;AAAA,EACR;AACF;",
6
+ "names": []
7
7
  }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ import fs from "fs-extra";
3
+ import { isErrorWithCode } from "./error.js";
4
+ export const pathExists = async (filePath) => {
5
+ try {
6
+ await fs.promises.access(filePath);
7
+ return true;
8
+ } catch (error) {
9
+ if (isErrorWithCode(error, "ENOENT")) {
10
+ return false;
11
+ }
12
+ throw error;
13
+ }
14
+ };
15
+ //# sourceMappingURL=fs.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/utils/fs.ts"],
4
+ "sourcesContent": ["import fs from 'fs-extra';\n\nimport { isErrorWithCode } from './error.js';\n\nexport const pathExists = async (filePath: string): Promise<boolean> => {\n try {\n await fs.promises.access(filePath);\n\n return true; // Path exists and is accessible\n } catch (error: unknown) {\n if (isErrorWithCode(error, 'ENOENT')) {\n return false; // Path does not exist\n }\n\n throw error; // Other errors (include permission issues)\n }\n};\n"],
5
+ "mappings": ";AAAA,OAAO,QAAQ;AAEf,SAAS,uBAAuB;AAEzB,aAAM,aAAa,OAAO,aAAuC;AACtE,MAAI;AACF,UAAM,GAAG,SAAS,OAAO,QAAQ;AAEjC,WAAO;AAAA,EACT,SAAS,OAAgB;AACvB,QAAI,gBAAgB,OAAO,QAAQ,GAAG;AACpC,aAAO;AAAA,IACT;AAEA,UAAM;AAAA,EACR;AACF;",
6
+ "names": []
7
+ }