skuba 14.0.0-migrate-to-inquirer-20251031055743 → 14.0.0-replace-global-vars-20251117052457

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 (384) hide show
  1. package/config/eslint.js +1 -1
  2. package/config/prettier.d.ts +8 -4
  3. package/config/prettier.js +10 -2
  4. package/lib/cli/adapter/eslint.js +11 -45
  5. package/lib/cli/adapter/eslint.js.map +3 -3
  6. package/lib/cli/adapter/prettier.js +39 -67
  7. package/lib/cli/adapter/prettier.js.map +2 -2
  8. package/lib/cli/build/args.js +8 -42
  9. package/lib/cli/build/args.js.map +2 -2
  10. package/lib/cli/build/assets.d.ts +3 -2
  11. package/lib/cli/build/assets.js +28 -60
  12. package/lib/cli/build/assets.js.map +3 -3
  13. package/lib/cli/build/esbuild.js +21 -45
  14. package/lib/cli/build/esbuild.js.map +2 -2
  15. package/lib/cli/build/index.js +21 -55
  16. package/lib/cli/build/index.js.map +3 -3
  17. package/lib/cli/build/tsc.js +23 -61
  18. package/lib/cli/build/tsc.js.map +3 -3
  19. package/lib/cli/buildPackage/index.js +8 -32
  20. package/lib/cli/buildPackage/index.js.map +1 -1
  21. package/lib/cli/configure/analyseConfiguration.js +16 -50
  22. package/lib/cli/configure/analyseConfiguration.js.map +2 -2
  23. package/lib/cli/configure/analyseDependencies.d.ts +1 -1
  24. package/lib/cli/configure/analyseDependencies.js +25 -59
  25. package/lib/cli/configure/analyseDependencies.js.map +3 -3
  26. package/lib/cli/configure/analysis/diff.js +5 -39
  27. package/lib/cli/configure/analysis/diff.js.map +3 -3
  28. package/lib/cli/configure/analysis/files.js +8 -42
  29. package/lib/cli/configure/analysis/files.js.map +2 -2
  30. package/lib/cli/configure/analysis/git.js +12 -46
  31. package/lib/cli/configure/analysis/git.js.map +2 -2
  32. package/lib/cli/configure/analysis/package.d.ts +2 -3
  33. package/lib/cli/configure/analysis/package.js +10 -45
  34. package/lib/cli/configure/analysis/package.js.map +3 -3
  35. package/lib/cli/configure/analysis/project.js +18 -50
  36. package/lib/cli/configure/analysis/project.js.map +2 -2
  37. package/lib/cli/configure/dependencies/index.js +7 -35
  38. package/lib/cli/configure/dependencies/index.js.map +1 -1
  39. package/lib/cli/configure/dependencies/seekDatadogCustomMetrics.js +4 -28
  40. package/lib/cli/configure/dependencies/seekDatadogCustomMetrics.js.map +1 -1
  41. package/lib/cli/configure/dependencies/seekKoala.js +4 -28
  42. package/lib/cli/configure/dependencies/seekKoala.js.map +1 -1
  43. package/lib/cli/configure/dependencies/skuba.js +4 -28
  44. package/lib/cli/configure/dependencies/skuba.js.map +1 -1
  45. package/lib/cli/configure/dependencies/skubaDeps.js +2 -26
  46. package/lib/cli/configure/dependencies/skubaDeps.js.map +1 -1
  47. package/lib/cli/configure/dependencies/skubaDive.js +4 -29
  48. package/lib/cli/configure/dependencies/skubaDive.js.map +1 -1
  49. package/lib/cli/configure/ensureTemplateCompletion.d.ts +1 -1
  50. package/lib/cli/configure/ensureTemplateCompletion.js +35 -60
  51. package/lib/cli/configure/ensureTemplateCompletion.js.map +3 -3
  52. package/lib/cli/configure/getEntryPoint.d.ts +1 -1
  53. package/lib/cli/configure/getEntryPoint.js +14 -48
  54. package/lib/cli/configure/getEntryPoint.js.map +3 -3
  55. package/lib/cli/configure/getProjectType.d.ts +1 -1
  56. package/lib/cli/configure/getProjectType.js +14 -35
  57. package/lib/cli/configure/getProjectType.js.map +2 -2
  58. package/lib/cli/configure/index.js +50 -84
  59. package/lib/cli/configure/index.js.map +3 -3
  60. package/lib/cli/configure/modules/eslint.js +10 -34
  61. package/lib/cli/configure/modules/eslint.js.map +1 -1
  62. package/lib/cli/configure/modules/ignore.js +8 -32
  63. package/lib/cli/configure/modules/ignore.js.map +1 -1
  64. package/lib/cli/configure/modules/index.js +18 -44
  65. package/lib/cli/configure/modules/index.js.map +2 -2
  66. package/lib/cli/configure/modules/nodemon.js +4 -28
  67. package/lib/cli/configure/modules/nodemon.js.map +1 -1
  68. package/lib/cli/configure/modules/package.js +10 -34
  69. package/lib/cli/configure/modules/package.js.map +1 -1
  70. package/lib/cli/configure/modules/prettier.js +11 -35
  71. package/lib/cli/configure/modules/prettier.js.map +1 -1
  72. package/lib/cli/configure/modules/renovate.js +17 -40
  73. package/lib/cli/configure/modules/renovate.js.map +2 -2
  74. package/lib/cli/configure/modules/serverless.js +2 -26
  75. package/lib/cli/configure/modules/serverless.js.map +1 -1
  76. package/lib/cli/configure/modules/tslint.js +4 -28
  77. package/lib/cli/configure/modules/tslint.js.map +1 -1
  78. package/lib/cli/configure/processing/configFile.js +3 -39
  79. package/lib/cli/configure/processing/configFile.js.map +1 -1
  80. package/lib/cli/configure/processing/deleteFiles.js +2 -26
  81. package/lib/cli/configure/processing/deleteFiles.js.map +1 -1
  82. package/lib/cli/configure/processing/javascript.js +2 -27
  83. package/lib/cli/configure/processing/javascript.js.map +1 -1
  84. package/lib/cli/configure/processing/json.js +6 -31
  85. package/lib/cli/configure/processing/json.js.map +1 -1
  86. package/lib/cli/configure/processing/loadFiles.js +2 -26
  87. package/lib/cli/configure/processing/loadFiles.js.map +1 -1
  88. package/lib/cli/configure/processing/module.js +4 -28
  89. package/lib/cli/configure/processing/module.js.map +1 -1
  90. package/lib/cli/configure/processing/package.d.ts +1 -67
  91. package/lib/cli/configure/processing/package.js +8 -45
  92. package/lib/cli/configure/processing/package.js.map +3 -3
  93. package/lib/cli/configure/processing/prettier.js +4 -38
  94. package/lib/cli/configure/processing/prettier.js.map +2 -2
  95. package/lib/cli/configure/processing/record.js +5 -41
  96. package/lib/cli/configure/processing/record.js.map +2 -2
  97. package/lib/cli/configure/processing/typescript.js +26 -63
  98. package/lib/cli/configure/processing/typescript.js.map +2 -2
  99. package/lib/cli/configure/types.d.ts +15 -4
  100. package/lib/cli/configure/types.js +0 -16
  101. package/lib/cli/configure/types.js.map +3 -3
  102. package/lib/cli/format/index.js +20 -54
  103. package/lib/cli/format/index.js.map +3 -3
  104. package/lib/cli/help/index.js +6 -30
  105. package/lib/cli/help/index.js.map +1 -1
  106. package/lib/cli/init/getConfig.d.ts +1 -1
  107. package/lib/cli/init/getConfig.js +89 -118
  108. package/lib/cli/init/getConfig.js.map +3 -3
  109. package/lib/cli/init/git.js +16 -51
  110. package/lib/cli/init/git.js.map +2 -2
  111. package/lib/cli/init/index.js +67 -98
  112. package/lib/cli/init/index.js.map +2 -2
  113. package/lib/cli/init/prompts.js +21 -42
  114. package/lib/cli/init/prompts.js.map +1 -1
  115. package/lib/cli/init/types.js +7 -41
  116. package/lib/cli/init/types.js.map +1 -1
  117. package/lib/cli/init/validation.js +2 -30
  118. package/lib/cli/init/validation.js.map +1 -1
  119. package/lib/cli/init/writePackageJson.js +8 -42
  120. package/lib/cli/init/writePackageJson.js.map +2 -2
  121. package/lib/cli/lint/annotate/buildkite/eslint.js +3 -37
  122. package/lib/cli/lint/annotate/buildkite/eslint.js.map +1 -1
  123. package/lib/cli/lint/annotate/buildkite/index.js +11 -45
  124. package/lib/cli/lint/annotate/buildkite/index.js.map +1 -1
  125. package/lib/cli/lint/annotate/buildkite/internal.js +3 -37
  126. package/lib/cli/lint/annotate/buildkite/internal.js.map +1 -1
  127. package/lib/cli/lint/annotate/buildkite/prettier.js +3 -37
  128. package/lib/cli/lint/annotate/buildkite/prettier.js.map +1 -1
  129. package/lib/cli/lint/annotate/buildkite/tsc.js +3 -37
  130. package/lib/cli/lint/annotate/buildkite/tsc.js.map +1 -1
  131. package/lib/cli/lint/annotate/github/eslint.js +2 -26
  132. package/lib/cli/lint/annotate/github/eslint.js.map +1 -1
  133. package/lib/cli/lint/annotate/github/index.js +11 -45
  134. package/lib/cli/lint/annotate/github/index.js.map +1 -1
  135. package/lib/cli/lint/annotate/github/internal.js +2 -26
  136. package/lib/cli/lint/annotate/github/internal.js.map +1 -1
  137. package/lib/cli/lint/annotate/github/prettier.js +2 -26
  138. package/lib/cli/lint/annotate/github/prettier.js.map +1 -1
  139. package/lib/cli/lint/annotate/github/tsc.js +4 -28
  140. package/lib/cli/lint/annotate/github/tsc.js.map +2 -2
  141. package/lib/cli/lint/annotate/index.js +6 -30
  142. package/lib/cli/lint/annotate/index.js.map +1 -1
  143. package/lib/cli/lint/autofix.js +37 -73
  144. package/lib/cli/lint/autofix.js.map +1 -1
  145. package/lib/cli/lint/eslint.js +16 -51
  146. package/lib/cli/lint/eslint.js.map +3 -3
  147. package/lib/cli/lint/external.js +19 -51
  148. package/lib/cli/lint/external.js.map +2 -2
  149. package/lib/cli/lint/index.js +26 -52
  150. package/lib/cli/lint/index.js.map +2 -2
  151. package/lib/cli/lint/internal.js +20 -52
  152. package/lib/cli/lint/internal.js.map +3 -3
  153. package/lib/cli/lint/internalLints/detectBadCodeowners.js +8 -33
  154. package/lib/cli/lint/internalLints/detectBadCodeowners.js.map +1 -1
  155. package/lib/cli/lint/internalLints/noSkubaTemplateJs.js +12 -48
  156. package/lib/cli/lint/internalLints/noSkubaTemplateJs.js.map +3 -3
  157. package/lib/cli/lint/internalLints/patchRenovateConfig.js +21 -55
  158. package/lib/cli/lint/internalLints/patchRenovateConfig.js.map +2 -2
  159. package/lib/cli/lint/internalLints/refreshConfigFiles.js +33 -66
  160. package/lib/cli/lint/internalLints/refreshConfigFiles.js.map +3 -3
  161. package/lib/cli/lint/internalLints/upgrade/index.d.ts +1 -1
  162. package/lib/cli/lint/internalLints/upgrade/index.js +23 -56
  163. package/lib/cli/lint/internalLints/upgrade/index.js.map +3 -3
  164. package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/index.js +4 -28
  165. package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/index.js.map +1 -1
  166. package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/removeYarnIgnoreOptionalFlags.js +11 -45
  167. package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/removeYarnIgnoreOptionalFlags.js.map +2 -2
  168. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/index.js +6 -30
  169. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/index.js.map +1 -1
  170. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/migrateNpmrcToPnpmWorkspace.js +37 -65
  171. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/migrateNpmrcToPnpmWorkspace.js.map +3 -3
  172. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/stopBundlingInCDKTests.js +11 -46
  173. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/stopBundlingInCDKTests.js.map +2 -2
  174. package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/index.js +4 -28
  175. package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/index.js.map +1 -1
  176. package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/unhandledRejections.js +23 -59
  177. package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/unhandledRejections.js.map +2 -2
  178. package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/index.js +4 -28
  179. package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/index.js.map +1 -1
  180. package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/patchJestSnapshots.js +11 -46
  181. package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/patchJestSnapshots.js.map +2 -2
  182. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/index.js +6 -30
  183. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/index.js.map +1 -1
  184. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchApiTokenFromEnvironment.js +11 -46
  185. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchApiTokenFromEnvironment.js.map +2 -2
  186. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchDockerfileSyntaxDirective.js +11 -46
  187. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchDockerfileSyntaxDirective.js.map +2 -2
  188. package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/index.js +4 -28
  189. package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/index.js.map +1 -1
  190. package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/patchDockerfileCIVariable.js +11 -46
  191. package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/patchDockerfileCIVariable.js.map +2 -2
  192. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/configureTsConfigForESM.js +29 -67
  193. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/configureTsConfigForESM.js.map +2 -2
  194. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/index.js +10 -34
  195. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/index.js.map +1 -1
  196. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/patchApiDockerfiles.js +11 -45
  197. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/patchApiDockerfiles.js.map +2 -2
  198. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/rewriteSrcImports.d.ts +4 -0
  199. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/rewriteSrcImports.js +18 -63
  200. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/rewriteSrcImports.js.map +3 -3
  201. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/updateLambdaConfigs.js +15 -50
  202. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/updateLambdaConfigs.js.map +2 -2
  203. package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/index.d.ts +2 -0
  204. package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/index.js +11 -0
  205. package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/index.js.map +7 -0
  206. package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/rewriteGlobalVars.d.ts +5 -0
  207. package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/rewriteGlobalVars.js +72 -0
  208. package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/rewriteGlobalVars.js.map +7 -0
  209. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/addEmptyExports.js +17 -51
  210. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/addEmptyExports.js.map +2 -2
  211. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/index.js +10 -34
  212. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/index.js.map +1 -1
  213. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchDockerfile.js +10 -44
  214. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchDockerfile.js.map +2 -2
  215. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchServerListener.js +12 -46
  216. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchServerListener.js.map +2 -2
  217. package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/index.js +4 -28
  218. package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/index.js.map +1 -1
  219. package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/patchPnpmPackageManager.js +15 -49
  220. package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/patchPnpmPackageManager.js.map +2 -2
  221. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/collapseDuplicateMergeKeys.js +11 -45
  222. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/collapseDuplicateMergeKeys.js.map +2 -2
  223. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/index.js +10 -39
  224. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/index.js.map +2 -2
  225. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/moveNpmrcMounts.js +11 -45
  226. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/moveNpmrcMounts.js.map +2 -2
  227. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerCompose.js +11 -45
  228. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerCompose.js.map +2 -2
  229. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerImages.js +13 -47
  230. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerImages.js.map +2 -2
  231. package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/index.js +4 -28
  232. package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/index.js.map +1 -1
  233. package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/patchPnpmDockerImages.js +11 -45
  234. package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/patchPnpmDockerImages.js.map +2 -2
  235. package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/index.js +4 -28
  236. package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/index.js.map +1 -1
  237. package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/upgradeNode.js +8 -32
  238. package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/upgradeNode.js.map +1 -1
  239. package/lib/cli/lint/prettier.js +15 -50
  240. package/lib/cli/lint/prettier.js.map +3 -3
  241. package/lib/cli/lint/tsc.js +4 -28
  242. package/lib/cli/lint/tsc.js.map +1 -1
  243. package/lib/cli/lint/types.js +0 -16
  244. package/lib/cli/lint/types.js.map +3 -3
  245. package/lib/cli/migrate/index.js +10 -34
  246. package/lib/cli/migrate/index.js.map +1 -1
  247. package/lib/cli/migrate/nodeVersion/checks.js +24 -61
  248. package/lib/cli/migrate/nodeVersion/checks.js.map +2 -2
  249. package/lib/cli/migrate/nodeVersion/index.js +25 -55
  250. package/lib/cli/migrate/nodeVersion/index.js.map +2 -2
  251. package/lib/cli/node/index.js +20 -57
  252. package/lib/cli/node/index.js.map +3 -3
  253. package/lib/cli/release/index.js +4 -28
  254. package/lib/cli/release/index.js.map +1 -1
  255. package/lib/cli/start/index.js +16 -50
  256. package/lib/cli/start/index.js.map +3 -3
  257. package/lib/cli/test/index.js +4 -44
  258. package/lib/cli/test/index.js.map +2 -2
  259. package/lib/cli/version/index.js +6 -30
  260. package/lib/cli/version/index.js.map +1 -1
  261. package/lib/eslint.d.js +0 -1
  262. package/lib/index.d.ts +0 -1
  263. package/lib/index.js +6 -46
  264. package/lib/index.js.map +2 -2
  265. package/lib/skuba.js +26 -45
  266. package/lib/skuba.js.map +3 -3
  267. package/lib/utils/args.js +6 -43
  268. package/lib/utils/args.js.map +2 -2
  269. package/lib/utils/command.js +4 -42
  270. package/lib/utils/command.js.map +3 -3
  271. package/lib/utils/copy.js +20 -57
  272. package/lib/utils/copy.js.map +2 -2
  273. package/lib/utils/dir.js +32 -72
  274. package/lib/utils/dir.js.map +2 -2
  275. package/lib/utils/env.js +2 -26
  276. package/lib/utils/env.js.map +1 -1
  277. package/lib/utils/error.js +10 -47
  278. package/lib/utils/error.js.map +1 -1
  279. package/lib/utils/exec.d.ts +3 -2
  280. package/lib/utils/exec.js +24 -62
  281. package/lib/utils/exec.js.map +3 -3
  282. package/lib/utils/fs.js +6 -40
  283. package/lib/utils/fs.js.map +3 -3
  284. package/lib/utils/help.js +6 -30
  285. package/lib/utils/help.js.map +1 -1
  286. package/lib/utils/logging.d.ts +9 -10
  287. package/lib/utils/logging.js +11 -48
  288. package/lib/utils/logging.js.map +3 -3
  289. package/lib/utils/logo.js +28 -59
  290. package/lib/utils/logo.js.map +3 -3
  291. package/lib/utils/manifest.d.ts +3 -2
  292. package/lib/utils/manifest.js +8 -48
  293. package/lib/utils/manifest.js.map +3 -3
  294. package/lib/utils/npmrc.js +2 -26
  295. package/lib/utils/npmrc.js.map +1 -1
  296. package/lib/utils/packageManager.js +12 -49
  297. package/lib/utils/packageManager.js.map +2 -2
  298. package/lib/utils/port.js +4 -39
  299. package/lib/utils/port.js.map +2 -2
  300. package/lib/utils/sleep.js +2 -26
  301. package/lib/utils/sleep.js.map +1 -1
  302. package/lib/utils/template.js +18 -55
  303. package/lib/utils/template.js.map +3 -3
  304. package/lib/utils/validation.js +2 -31
  305. package/lib/utils/validation.js.map +1 -1
  306. package/lib/utils/version.js +9 -46
  307. package/lib/utils/version.js.map +2 -2
  308. package/lib/utils/wait.js +7 -32
  309. package/lib/utils/wait.js.map +1 -1
  310. package/lib/utils/worker.d.ts +3 -3
  311. package/lib/utils/worker.js +10 -35
  312. package/lib/utils/worker.js.map +1 -1
  313. package/lib/wrapper/function-arguments.d.js +0 -1
  314. package/lib/wrapper/functionHandler.js +18 -49
  315. package/lib/wrapper/functionHandler.js.map +2 -2
  316. package/lib/wrapper/http.d.ts +0 -6
  317. package/lib/wrapper/http.js +8 -51
  318. package/lib/wrapper/http.js.map +3 -3
  319. package/lib/wrapper/index.js +6 -7
  320. package/lib/wrapper/index.js.map +1 -1
  321. package/lib/wrapper/main.js +8 -42
  322. package/lib/wrapper/main.js.map +3 -3
  323. package/lib/wrapper/requestListener.js +13 -46
  324. package/lib/wrapper/requestListener.js.map +3 -3
  325. package/lib/wrapper/server.d.ts +7 -0
  326. package/lib/wrapper/server.js +11 -0
  327. package/lib/wrapper/server.js.map +7 -0
  328. package/package.json +17 -24
  329. package/template/base/_.prettierrc.js +1 -1
  330. package/template/base/_eslint.config.js +1 -1
  331. package/template/base/_pnpm-workspace.yaml +3 -2
  332. package/template/base/vitest.config.ts +25 -0
  333. package/template/express-rest-api/package.json +2 -1
  334. package/template/express-rest-api/skuba.template.js +1 -1
  335. package/template/express-rest-api/src/app.test.ts +1 -0
  336. package/template/greeter/package.json +4 -3
  337. package/template/greeter/skuba.template.js +1 -1
  338. package/template/greeter/src/app.test.ts +3 -1
  339. package/template/koa-rest-api/package.json +2 -1
  340. package/template/koa-rest-api/skuba.template.js +1 -1
  341. package/template/koa-rest-api/src/api/jobs/getJobs.test.ts +2 -0
  342. package/template/koa-rest-api/src/api/jobs/postJob.test.ts +2 -0
  343. package/template/koa-rest-api/src/app.test.ts +2 -0
  344. package/template/koa-rest-api/src/framework/server.test.ts +2 -2
  345. package/template/koa-rest-api/src/framework/validation.test.ts +2 -0
  346. package/template/koa-rest-api/src/testing/metrics.ts +2 -0
  347. package/template/lambda-sqs-worker-cdk/infra/__snapshots__/appStack.test.ts.snap +15 -3
  348. package/template/lambda-sqs-worker-cdk/infra/appStack.test.ts +11 -9
  349. package/template/lambda-sqs-worker-cdk/package.json +6 -5
  350. package/template/lambda-sqs-worker-cdk/skuba.template.js +1 -1
  351. package/template/lambda-sqs-worker-cdk/src/app.test.ts +22 -13
  352. package/template/lambda-sqs-worker-cdk/src/framework/handler.test.ts +1 -0
  353. package/template/lambda-sqs-worker-cdk/src/framework/validation.test.ts +33 -31
  354. package/template/lambda-sqs-worker-cdk/src/services/jobScorer.test.ts +8 -2
  355. package/template/lambda-sqs-worker-cdk/src/services/pipelineEventSender.test.ts +3 -2
  356. package/template/lambda-sqs-worker-cdk/src/testing/services.ts +4 -3
  357. package/template/oss-npm-package/_package.json +1 -0
  358. package/template/oss-npm-package/skuba.template.js +1 -1
  359. package/template/oss-npm-package/src/index.test.ts +2 -0
  360. package/template/private-npm-package/_package.json +1 -0
  361. package/template/private-npm-package/skuba.template.js +1 -1
  362. package/template/private-npm-package/src/index.test.ts +2 -0
  363. package/config/jest.js +0 -1
  364. package/jest/moduleNameMapper.js +0 -64
  365. package/jest/transform.js +0 -62
  366. package/jest/tsConfig.js +0 -26
  367. package/jest-preset.js +0 -37
  368. package/lib/api/jest/index.d.ts +0 -15
  369. package/lib/api/jest/index.js +0 -59
  370. package/lib/api/jest/index.js.map +0 -7
  371. package/lib/cli/configure/modules/jest.d.ts +0 -2
  372. package/lib/cli/configure/modules/jest.js +0 -86
  373. package/lib/cli/configure/modules/jest.js.map +0 -7
  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
@@ -1,43 +1,7 @@
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");
1
+ import { inspect } from "util";
2
+ import * as z from "zod/v4";
3
+ import { log } from "./logging.js";
4
+ import { hasNumberProp, hasProp } from "./validation.js";
41
5
  const concurrentlyErrorsSchema = z.array(
42
6
  z.object({
43
7
  command: z.object({
@@ -49,24 +13,23 @@ const concurrentlyErrorsSchema = z.array(
49
13
  })
50
14
  );
51
15
  const createTerseError = (message) => Object.assign(new Error(message), {
52
- [import_util.inspect.custom]: () => message
16
+ [inspect.custom]: () => message
53
17
  });
54
- const isExecaError = (err) => (0, import_validation.hasNumberProp)(err, "exitCode");
18
+ const isExecaError = (err) => hasNumberProp(err, "exitCode");
55
19
  const handleCliError = (err) => {
56
20
  if (isExecaError(err)) {
57
21
  process.exitCode = err.exitCode;
58
22
  return;
59
23
  }
60
- import_logging.log.err((0, import_util.inspect)(err));
24
+ log.err(inspect(err));
61
25
  process.exitCode = 1;
62
26
  return;
63
27
  };
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 = {
28
+ const isErrorWithCode = (err, code) => hasProp(err, "code") && err.code === code;
29
+ export {
67
30
  concurrentlyErrorsSchema,
68
31
  createTerseError,
69
32
  handleCliError,
70
33
  isErrorWithCode
71
- });
34
+ };
72
35
  //# 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": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAwB;AAGxB,QAAmB;AAEnB,qBAAoB;AACpB,wBAAuC;AAIhC,MAAM,2BAA2B,EAAE;AAAA,EACxC,EAAE,OAAO;AAAA,IACP,SAAS,EAAE,OAAO;AAAA,MAChB,SAAS,EAAE,OAAO;AAAA,MAClB,MAAM,EAAE,OAAO;AAAA,IACjB,CAAC;AAAA,IACD,OAAO,EAAE,OAAO;AAAA,IAChB,UAAU,EAAE,OAAO;AAAA,EACrB,CAAC;AACH;AAWO,MAAM,mBAAmB,CAAC,YAC/B,OAAO,OAAO,IAAI,MAAM,OAAO,GAAG;AAAA,EAChC,CAAC,oBAAQ,MAAM,GAAG,MAAM;AAC1B,CAAC;AAEH,MAAM,eAAe,CAAC,YACpB,iCAAc,KAAK,UAAU;AAExB,MAAM,iBAAiB,CAAC,QAAiB;AAC9C,MAAI,aAAa,GAAG,GAAG;AACrB,YAAQ,WAAW,IAAI;AACvB;AAAA,EACF;AAEA,qBAAI,QAAI,qBAAQ,GAAG,CAAC;AACpB,UAAQ,WAAW;AACnB;AACF;AAEO,MAAM,kBAAkB,CAC7B,KACA,aAEA,2BAAQ,KAAK,MAAM,KAAK,IAAI,SAAS;",
5
+ "mappings": "AAAA,SAAS,eAAe;AAGxB,YAAY,OAAO;AAEnB,SAAS,WAAW;AACpB,SAAS,eAAe,eAAe;AAIhC,MAAM,2BAA2B,EAAE;AAAA,EACxC,EAAE,OAAO;AAAA,IACP,SAAS,EAAE,OAAO;AAAA,MAChB,SAAS,EAAE,OAAO;AAAA,MAClB,MAAM,EAAE,OAAO;AAAA,IACjB,CAAC;AAAA,IACD,OAAO,EAAE,OAAO;AAAA,IAChB,UAAU,EAAE,OAAO;AAAA,EACrB,CAAC;AACH;AAWO,MAAM,mBAAmB,CAAC,YAC/B,OAAO,OAAO,IAAI,MAAM,OAAO,GAAG;AAAA,EAChC,CAAC,QAAQ,MAAM,GAAG,MAAM;AAC1B,CAAC;AAEH,MAAM,eAAe,CAAC,QACpB,cAAc,KAAK,UAAU;AAExB,MAAM,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,MAAM,kBAAkB,CAC7B,KACA,SAEA,QAAQ,KAAK,MAAM,KAAK,IAAI,SAAS;",
6
6
  "names": []
7
7
  }
@@ -1,12 +1,13 @@
1
+ import type { styleText } from 'node:util';
1
2
  import stream from 'stream';
2
- import type { Color } from 'chalk';
3
3
  import execa, { type ExecaChildProcess } from 'execa';
4
4
  import type { PackageManager } from './packageManager.js';
5
+ type StyleColor = Parameters<typeof styleText>[0];
5
6
  export type Exec = (command: string, ...args: string[]) => ExecaChildProcess<string>;
6
7
  interface ExecConcurrentlyCommand {
7
8
  command: string;
8
9
  name: string;
9
- prefixColor?: typeof Color;
10
+ prefixColor?: StyleColor;
10
11
  }
11
12
  interface ExecConcurrentlyOptions {
12
13
  /**
package/lib/utils/exec.js CHANGED
@@ -1,50 +1,13 @@
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 {
1
+ import { cpus } from "os";
2
+ import stream from "stream";
3
+ import util from "util";
4
+ import concurrently from "concurrently";
5
+ import execa from "execa";
6
+ import npmRunPath from "npm-run-path";
7
+ import npmWhich from "npm-which";
8
+ import { concurrentlyErrorsSchema, isErrorWithCode } from "./error.js";
9
+ import { log } from "./logging.js";
10
+ class YarnSpamFilter extends stream.Transform {
48
11
  silenced = false;
49
12
  _transform(chunk, _encoding, callback) {
50
13
  const str = Buffer.from(chunk).toString();
@@ -58,7 +21,7 @@ class YarnSpamFilter extends import_stream.default.Transform {
58
21
  callback();
59
22
  }
60
23
  }
61
- class YarnWarningFilter extends import_stream.default.Transform {
24
+ class YarnWarningFilter extends stream.Transform {
62
25
  _transform(chunk, _encoding, callback) {
63
26
  const str = Buffer.from(chunk).toString();
64
27
  if (!str.startsWith("warning skuba >")) {
@@ -68,11 +31,11 @@ class YarnWarningFilter extends import_stream.default.Transform {
68
31
  }
69
32
  }
70
33
  const envWithPath = {
71
- PATH: (0, import_npm_run_path.default)({ cwd: __dirname })
34
+ PATH: npmRunPath({ cwd: import.meta.dirname })
72
35
  };
73
36
  const runCommand = (command, args, opts) => {
74
- const subprocess = (0, import_execa.default)(command, args, {
75
- localDir: __dirname,
37
+ const subprocess = execa(command, args, {
38
+ localDir: import.meta.dirname,
76
39
  preferLocal: true,
77
40
  stdio: "inherit",
78
41
  ...opts
@@ -92,8 +55,8 @@ const runCommand = (command, args, opts) => {
92
55
  }
93
56
  return subprocess;
94
57
  };
95
- const whichCallback = (0, import_npm_which.default)(__dirname);
96
- const which = import_util.default.promisify(whichCallback);
58
+ const whichCallback = npmWhich(import.meta.dirname);
59
+ const which = util.promisify(whichCallback);
97
60
  const createExec = (opts) => (command, ...args) => runCommand(command, args, opts);
98
61
  const exec = (command, ...args) => runCommand(command, args);
99
62
  const execConcurrently = async (commands, { maxProcesses, nameLength, outputStream } = {}) => {
@@ -102,22 +65,22 @@ const execConcurrently = async (commands, { maxProcesses, nameLength, outputStre
102
65
  0
103
66
  );
104
67
  try {
105
- await (0, import_concurrently.default)(
68
+ await concurrently(
106
69
  commands.map(({ command, name, prefixColor }) => ({
107
70
  command,
108
71
  env: envWithPath,
109
72
  name: name.padEnd(maxNameLength),
110
- prefixColor
73
+ prefixColor: Array.isArray(prefixColor) ? prefixColor[0] : prefixColor
111
74
  })),
112
75
  {
113
- maxProcesses: maxProcesses ?? (0, import_os.cpus)().length,
76
+ maxProcesses: maxProcesses ?? cpus().length,
114
77
  outputStream,
115
78
  // Use a minimalist logging prefix.
116
79
  prefix: "{name} \u2502"
117
80
  }
118
81
  ).result;
119
82
  } catch (err) {
120
- const result = import_error.concurrentlyErrorsSchema.safeParse(err);
83
+ const result = concurrentlyErrorsSchema.safeParse(err);
121
84
  if (!result.success) {
122
85
  throw err;
123
86
  }
@@ -134,7 +97,7 @@ const ensureCommands = async (...names) => {
134
97
  const result = await hasCommand(name);
135
98
  if (!result) {
136
99
  success = false;
137
- import_logging.log.err(import_logging.log.bold(name), "needs to be installed.");
100
+ log.err(log.bold(name), "needs to be installed.");
138
101
  }
139
102
  })
140
103
  );
@@ -147,18 +110,17 @@ const hasCommand = async (name) => {
147
110
  await which(name);
148
111
  return true;
149
112
  } catch (err) {
150
- if ((0, import_error.isErrorWithCode)(err, "ENOENT")) {
113
+ if (isErrorWithCode(err, "ENOENT")) {
151
114
  return false;
152
115
  }
153
116
  throw err;
154
117
  }
155
118
  };
156
- // Annotate the CommonJS export names for ESM import in node:
157
- 0 && (module.exports = {
119
+ export {
158
120
  createExec,
159
121
  ensureCommands,
160
122
  exec,
161
123
  execConcurrently,
162
124
  hasCommand
163
- });
125
+ };
164
126
  //# 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;A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AU;AAEd,QAAM,QAAQ;AAAA,IACZ,MAAM,IAAI,OAAO,SAAS;AACxB,YAAM,SAAS,MAAM,WAAW,IAAI;AAEpC,UAAI,CAAC,QAAQ;AACX,kBAAU;AAEV,2BAAI,IAAI,mBAAI,KAAK,IAAI,GAAG,wBAAwB;AAAA,MAClD;AAAA,IACF,CAAC;AAAA,EACH;AAEA,MAAI,CAAC,SAAS;AACZ,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF;AAEO,MAAM,aAAa,OAAO,SAAiB;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 type { styleText } from 'node:util';\nimport { cpus } from 'os';\nimport stream from 'stream';\nimport util from 'util';\n\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\ntype StyleColor = Parameters<typeof styleText>[0];\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?: StyleColor;\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: Array.isArray(prefixColor) ? prefixColor[0] : 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": "AACA,SAAS,YAAY;AACrB,OAAO,YAAY;AACnB,OAAO,UAAU;AAEjB,OAAO,kBAAkB;AACzB,OAAO,WAAuC;AAC9C,OAAO,gBAAgB;AACvB,OAAO,cAAc;AAErB,SAAS,0BAA0B,uBAAuB;AAC1D,SAAS,WAAW;AAKpB,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,I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,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
  }
package/lib/utils/fs.js CHANGED
@@ -1,51 +1,17 @@
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 fs_exports = {};
30
- __export(fs_exports, {
31
- pathExists: () => pathExists
32
- });
33
- module.exports = __toCommonJS(fs_exports);
34
- var import_fs_extra = __toESM(require("fs-extra"));
35
- var import_error = require("./error.js");
1
+ import fs from "fs-extra";
2
+ import { isErrorWithCode } from "./error.js";
36
3
  const pathExists = async (filePath) => {
37
4
  try {
38
- await import_fs_extra.default.access(filePath);
5
+ await fs.promises.access(filePath);
39
6
  return true;
40
7
  } catch (error) {
41
- if ((0, import_error.isErrorWithCode)(error, "ENOENT")) {
8
+ if (isErrorWithCode(error, "ENOENT")) {
42
9
  return false;
43
10
  }
44
11
  throw error;
45
12
  }
46
13
  };
47
- // Annotate the CommonJS export names for ESM import in node:
48
- 0 && (module.exports = {
14
+ export {
49
15
  pathExists
50
- });
16
+ };
51
17
  //# sourceMappingURL=fs.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
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.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;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAe;AAEf,mBAAgC;AAEzB,MAAM,aAAa,OAAO,aAAuC;AACtE,MAAI;AACF,UAAM,gBAAAA,QAAG,OAAO,QAAQ;AAExB,WAAO;AAAA,EACT,SAAS,OAAgB;AACvB,YAAI,8BAAgB,OAAO,QAAQ,GAAG;AACpC,aAAO;AAAA,IACT;AAEA,UAAM;AAAA,EACR;AACF;",
6
- "names": ["fs"]
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,MAAM,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
7
  }
package/lib/utils/help.js CHANGED
@@ -1,34 +1,10 @@
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 help_exports = {};
20
- __export(help_exports, {
21
- showHelp: () => showHelp
22
- });
23
- module.exports = __toCommonJS(help_exports);
24
- var import_command = require("./command.js");
25
- var import_logging = require("./logging.js");
1
+ import { COMMAND_LIST } from "./command.js";
2
+ import { log } from "./logging.js";
26
3
  const showHelp = () => {
27
- import_logging.log.plain(import_logging.log.bold("Available commands:"));
28
- import_command.COMMAND_LIST.forEach((item) => import_logging.log.plain(item));
4
+ log.plain(log.bold("Available commands:"));
5
+ COMMAND_LIST.forEach((item) => log.plain(item));
29
6
  };
30
- // Annotate the CommonJS export names for ESM import in node:
31
- 0 && (module.exports = {
7
+ export {
32
8
  showHelp
33
- });
9
+ };
34
10
  //# sourceMappingURL=help.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/utils/help.ts"],
4
4
  "sourcesContent": ["import { COMMAND_LIST } from './command.js';\nimport { log } from './logging.js';\n\nexport const showHelp = () => {\n log.plain(log.bold('Available commands:'));\n\n COMMAND_LIST.forEach((item) => log.plain(item));\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAA6B;AAC7B,qBAAoB;AAEb,MAAM,WAAW,MAAM;AAC5B,qBAAI,MAAM,mBAAI,KAAK,qBAAqB,CAAC;AAEzC,8BAAa,QAAQ,CAAC,SAAS,mBAAI,MAAM,IAAI,CAAC;AAChD;",
5
+ "mappings": "AAAA,SAAS,oBAAoB;AAC7B,SAAS,WAAW;AAEb,MAAM,WAAW,MAAM;AAC5B,MAAI,MAAM,IAAI,KAAK,qBAAqB,CAAC;AAEzC,eAAa,QAAQ,CAAC,SAAS,IAAI,MAAM,IAAI,CAAC;AAChD;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,3 @@
1
- import chalk from 'chalk';
2
1
  export type Logger = typeof log;
3
2
  export declare const createLogger: ({ debug, prefixes, suffixes, }: {
4
3
  debug: boolean;
@@ -10,9 +9,9 @@ export declare const createLogger: ({ debug, prefixes, suffixes, }: {
10
9
  prefixes: unknown[];
11
10
  suffixes: unknown[];
12
11
  };
13
- bold: chalk.Chalk;
14
- dim: chalk.Chalk;
15
- formatSubtle: chalk.Chalk;
12
+ bold: (text: string) => string;
13
+ dim: (text: string) => string;
14
+ formatSubtle: (text: string) => string;
16
15
  timing: (start: bigint, end: bigint) => string;
17
16
  debug: (...message: unknown[]) => void;
18
17
  subtle: (...message: unknown[]) => void;
@@ -28,9 +27,9 @@ export declare const log: {
28
27
  prefixes: unknown[];
29
28
  suffixes: unknown[];
30
29
  };
31
- bold: chalk.Chalk;
32
- dim: chalk.Chalk;
33
- formatSubtle: chalk.Chalk;
30
+ bold: (text: string) => string;
31
+ dim: (text: string) => string;
32
+ formatSubtle: (text: string) => string;
34
33
  timing: (start: bigint, end: bigint) => string;
35
34
  debug: (...message: unknown[]) => void;
36
35
  subtle: (...message: unknown[]) => void;
@@ -46,9 +45,9 @@ export declare const childLogger: (logger: Logger, settings: Partial<Logger["set
46
45
  prefixes: unknown[];
47
46
  suffixes: unknown[];
48
47
  };
49
- bold: chalk.Chalk;
50
- dim: chalk.Chalk;
51
- formatSubtle: chalk.Chalk;
48
+ bold: (text: string) => string;
49
+ dim: (text: string) => string;
50
+ formatSubtle: (text: string) => string;
52
51
  timing: (start: bigint, end: bigint) => string;
53
52
  debug: (...message: unknown[]) => void;
54
53
  subtle: (...message: unknown[]) => void;
@@ -1,40 +1,4 @@
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 logging_exports = {};
30
- __export(logging_exports, {
31
- childLogger: () => childLogger,
32
- createLogger: () => createLogger,
33
- log: () => log,
34
- pluralise: () => pluralise
35
- });
36
- module.exports = __toCommonJS(logging_exports);
37
- var import_chalk = __toESM(require("chalk"));
1
+ import { styleText } from "node:util";
38
2
  const createLogger = ({
39
3
  debug,
40
4
  prefixes = [],
@@ -44,17 +8,17 @@ const createLogger = ({
44
8
  const log2 = (...message) => logWithoutSuffixes(...message, ...suffixes);
45
9
  return {
46
10
  settings: { debug, prefixes, suffixes },
47
- bold: import_chalk.default.bold,
48
- dim: import_chalk.default.dim,
49
- formatSubtle: import_chalk.default.grey,
11
+ bold: (text) => styleText("bold", text),
12
+ dim: (text) => styleText("dim", text),
13
+ formatSubtle: (text) => styleText("gray", text),
50
14
  timing: (start, end) => `${Number((end - start) / BigInt(1e7)) / 100}s`,
51
- debug: (...message) => debug ? log2(import_chalk.default.grey(...message)) : void 0,
52
- subtle: (...message) => log2(import_chalk.default.grey(...message)),
53
- err: (...message) => log2(import_chalk.default.red(...message)),
15
+ debug: (...message) => debug ? log2(...message.map((m) => styleText("gray", String(m)))) : void 0,
16
+ subtle: (...message) => log2(...message.map((m) => styleText("gray", String(m)))),
17
+ err: (...message) => log2(...message.map((m) => styleText("red", String(m)))),
54
18
  newline: () => logWithoutSuffixes(),
55
- ok: (...message) => log2(import_chalk.default.green(...message)),
19
+ ok: (...message) => log2(...message.map((m) => styleText("green", String(m)))),
56
20
  plain: (...message) => log2(...message),
57
- warn: (...message) => log2(import_chalk.default.yellow(...message))
21
+ warn: (...message) => log2(...message.map((m) => styleText("yellow", String(m))))
58
22
  };
59
23
  };
60
24
  const log = createLogger({ debug: false });
@@ -64,11 +28,10 @@ const childLogger = (logger, settings) => createLogger({
64
28
  suffixes: [...logger.settings.suffixes, ...settings.suffixes ?? []]
65
29
  });
66
30
  const pluralise = (count, subject) => `${count} ${subject}${count === 1 ? "" : "s"}`;
67
- // Annotate the CommonJS export names for ESM import in node:
68
- 0 && (module.exports = {
31
+ export {
69
32
  childLogger,
70
33
  createLogger,
71
34
  log,
72
35
  pluralise
73
- });
36
+ };
74
37
  //# sourceMappingURL=logging.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/utils/logging.ts"],
4
- "sourcesContent": ["/* eslint-disable no-console */\n\nimport chalk from 'chalk';\n\nexport type Logger = typeof log;\n\nexport const createLogger = ({\n debug,\n prefixes = [],\n suffixes = [],\n}: {\n debug: boolean;\n prefixes?: unknown[];\n suffixes?: unknown[];\n}) => {\n const logWithoutSuffixes = (...message: unknown[]) =>\n console.log(...prefixes, ...message);\n\n const log = (...message: unknown[]) =>\n logWithoutSuffixes(...message, ...suffixes);\n\n return {\n settings: { debug, prefixes, suffixes },\n\n bold: chalk.bold,\n dim: chalk.dim,\n formatSubtle: chalk.grey,\n\n timing: (start: bigint, end: bigint) =>\n `${Number((end - start) / BigInt(10_000_000)) / 100}s`,\n\n debug: (...message: unknown[]) =>\n debug ? log(chalk.grey(...message)) : undefined,\n subtle: (...message: unknown[]) => log(chalk.grey(...message)),\n err: (...message: unknown[]) => log(chalk.red(...message)),\n newline: () => logWithoutSuffixes(),\n ok: (...message: unknown[]) => log(chalk.green(...message)),\n plain: (...message: unknown[]) => log(...message),\n warn: (...message: unknown[]) => log(chalk.yellow(...message)),\n };\n};\n\nexport const log = createLogger({ debug: false });\n\nexport const childLogger = (\n logger: Logger,\n settings: Partial<Logger['settings']>,\n) =>\n createLogger({\n debug: settings.debug ?? logger.settings.debug,\n prefixes: [...(settings.prefixes ?? []), ...logger.settings.prefixes],\n suffixes: [...logger.settings.suffixes, ...(settings.suffixes ?? [])],\n });\n\nexport const pluralise = (count: number, subject: string) =>\n `${count} ${subject}${count === 1 ? '' : 's'}`;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAAkB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AAS,YAAY,CAAC,CAAE;AACtE,CAAC;AAEI,MAAM,YAAY,CAAC,OAAe,YACvC,GAAG,KAAK,IAAI,OAAO,GAAG,UAAU,IAAI,KAAK,GAAG;",
6
- "names": ["log", "chalk"]
4
+ "sourcesContent": ["/* eslint-disable no-console */\n\nimport { styleText } from 'node:util';\n\nexport type Logger = typeof log;\n\nexport const createLogger = ({\n debug,\n prefixes = [],\n suffixes = [],\n}: {\n debug: boolean;\n prefixes?: unknown[];\n suffixes?: unknown[];\n}) => {\n const logWithoutSuffixes = (...message: unknown[]) =>\n console.log(...prefixes, ...message);\n\n const log = (...message: unknown[]) =>\n logWithoutSuffixes(...message, ...suffixes);\n\n return {\n settings: { debug, prefixes, suffixes },\n\n bold: (text: string) => styleText('bold', text),\n dim: (text: string) => styleText('dim', text),\n formatSubtle: (text: string) => styleText('gray', text),\n\n timing: (start: bigint, end: bigint) =>\n `${Number((end - start) / BigInt(10_000_000)) / 100}s`,\n\n debug: (...message: unknown[]) =>\n debug\n ? log(...message.map((m) => styleText('gray', String(m))))\n : undefined,\n subtle: (...message: unknown[]) =>\n log(...message.map((m) => styleText('gray', String(m)))),\n err: (...message: unknown[]) =>\n log(...message.map((m) => styleText('red', String(m)))),\n newline: () => logWithoutSuffixes(),\n ok: (...message: unknown[]) =>\n log(...message.map((m) => styleText('green', String(m)))),\n plain: (...message: unknown[]) => log(...message),\n warn: (...message: unknown[]) =>\n log(...message.map((m) => styleText('yellow', String(m)))),\n };\n};\n\nexport const log = createLogger({ debug: false });\n\nexport const childLogger = (\n logger: Logger,\n settings: Partial<Logger['settings']>,\n) =>\n createLogger({\n debug: settings.debug ?? logger.settings.debug,\n prefixes: [...(settings.prefixes ?? []), ...logger.settings.prefixes],\n suffixes: [...logger.settings.suffixes, ...(settings.suffixes ?? [])],\n });\n\nexport const pluralise = (count: number, subject: string) =>\n `${count} ${subject}${count === 1 ? '' : 's'}`;\n"],
5
+ "mappings": "AAEA,SAAS,iBAAiB;AAInB,MAAM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