skuba 14.0.0-replace-global-vars-20251121010036 → 14.0.0-rfc-upgrade-on-test-20251217012156

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 (409) hide show
  1. package/config/eslint.js +1 -1
  2. package/config/jest.js +1 -0
  3. package/config/prettier.d.ts +4 -8
  4. package/config/prettier.js +2 -10
  5. package/jest/moduleNameMapper.js +64 -0
  6. package/jest/transform.js +62 -0
  7. package/jest/tsConfig.js +26 -0
  8. package/jest-preset.js +37 -0
  9. package/lib/api/jest/index.d.ts +15 -0
  10. package/lib/api/jest/index.js +59 -0
  11. package/lib/api/jest/index.js.map +7 -0
  12. package/lib/cli/adapter/eslint.js +45 -11
  13. package/lib/cli/adapter/eslint.js.map +2 -2
  14. package/lib/cli/adapter/prettier.js +67 -39
  15. package/lib/cli/adapter/prettier.js.map +2 -2
  16. package/lib/cli/build/args.js +42 -8
  17. package/lib/cli/build/args.js.map +2 -2
  18. package/lib/cli/build/assets.js +60 -28
  19. package/lib/cli/build/assets.js.map +2 -2
  20. package/lib/cli/build/esbuild.js +45 -21
  21. package/lib/cli/build/esbuild.js.map +2 -2
  22. package/lib/cli/build/index.js +45 -21
  23. package/lib/cli/build/index.js.map +1 -1
  24. package/lib/cli/build/tsc.js +59 -22
  25. package/lib/cli/build/tsc.js.map +2 -2
  26. package/lib/cli/buildPackage/index.js +32 -8
  27. package/lib/cli/buildPackage/index.js.map +1 -1
  28. package/lib/cli/configure/analyseConfiguration.js +50 -16
  29. package/lib/cli/configure/analyseConfiguration.js.map +2 -2
  30. package/lib/cli/configure/analyseDependencies.d.ts +1 -1
  31. package/lib/cli/configure/analyseDependencies.js +59 -25
  32. package/lib/cli/configure/analyseDependencies.js.map +3 -3
  33. package/lib/cli/configure/analysis/diff.js +29 -5
  34. package/lib/cli/configure/analysis/diff.js.map +1 -1
  35. package/lib/cli/configure/analysis/files.js +42 -8
  36. package/lib/cli/configure/analysis/files.js.map +2 -2
  37. package/lib/cli/configure/analysis/git.js +46 -12
  38. package/lib/cli/configure/analysis/git.js.map +2 -2
  39. package/lib/cli/configure/analysis/package.d.ts +3 -2
  40. package/lib/cli/configure/analysis/package.js +45 -10
  41. package/lib/cli/configure/analysis/package.js.map +3 -3
  42. package/lib/cli/configure/analysis/project.js +50 -18
  43. package/lib/cli/configure/analysis/project.js.map +2 -2
  44. package/lib/cli/configure/dependencies/index.js +35 -7
  45. package/lib/cli/configure/dependencies/index.js.map +1 -1
  46. package/lib/cli/configure/dependencies/seekDatadogCustomMetrics.js +28 -4
  47. package/lib/cli/configure/dependencies/seekDatadogCustomMetrics.js.map +1 -1
  48. package/lib/cli/configure/dependencies/seekKoala.js +28 -4
  49. package/lib/cli/configure/dependencies/seekKoala.js.map +1 -1
  50. package/lib/cli/configure/dependencies/skuba.js +28 -4
  51. package/lib/cli/configure/dependencies/skuba.js.map +1 -1
  52. package/lib/cli/configure/dependencies/skubaDeps.js +26 -2
  53. package/lib/cli/configure/dependencies/skubaDeps.js.map +1 -1
  54. package/lib/cli/configure/dependencies/skubaDive.js +29 -4
  55. package/lib/cli/configure/dependencies/skubaDive.js.map +1 -1
  56. package/lib/cli/configure/ensureTemplateCompletion.d.ts +1 -1
  57. package/lib/cli/configure/ensureTemplateCompletion.js +61 -33
  58. package/lib/cli/configure/ensureTemplateCompletion.js.map +3 -3
  59. package/lib/cli/configure/getEntryPoint.d.ts +1 -1
  60. package/lib/cli/configure/getEntryPoint.js +48 -14
  61. package/lib/cli/configure/getEntryPoint.js.map +3 -3
  62. package/lib/cli/configure/getProjectType.d.ts +1 -1
  63. package/lib/cli/configure/getProjectType.js +35 -14
  64. package/lib/cli/configure/getProjectType.js.map +2 -2
  65. package/lib/cli/configure/index.js +84 -50
  66. package/lib/cli/configure/index.js.map +2 -2
  67. package/lib/cli/configure/modules/eslint.js +34 -10
  68. package/lib/cli/configure/modules/eslint.js.map +1 -1
  69. package/lib/cli/configure/modules/ignore.js +32 -8
  70. package/lib/cli/configure/modules/ignore.js.map +1 -1
  71. package/lib/cli/configure/modules/index.js +44 -18
  72. package/lib/cli/configure/modules/index.js.map +2 -2
  73. package/lib/cli/configure/modules/jest.d.ts +2 -0
  74. package/lib/cli/configure/modules/jest.js +86 -0
  75. package/lib/cli/configure/modules/jest.js.map +7 -0
  76. package/lib/cli/configure/modules/nodemon.js +28 -4
  77. package/lib/cli/configure/modules/nodemon.js.map +1 -1
  78. package/lib/cli/configure/modules/package.js +34 -10
  79. package/lib/cli/configure/modules/package.js.map +1 -1
  80. package/lib/cli/configure/modules/prettier.js +35 -11
  81. package/lib/cli/configure/modules/prettier.js.map +1 -1
  82. package/lib/cli/configure/modules/renovate.js +40 -17
  83. package/lib/cli/configure/modules/renovate.js.map +2 -2
  84. package/lib/cli/configure/modules/serverless.js +26 -2
  85. package/lib/cli/configure/modules/serverless.js.map +1 -1
  86. package/lib/cli/configure/modules/tslint.js +28 -4
  87. package/lib/cli/configure/modules/tslint.js.map +1 -1
  88. package/lib/cli/configure/processing/configFile.js +39 -3
  89. package/lib/cli/configure/processing/configFile.js.map +1 -1
  90. package/lib/cli/configure/processing/deleteFiles.js +26 -2
  91. package/lib/cli/configure/processing/deleteFiles.js.map +1 -1
  92. package/lib/cli/configure/processing/javascript.js +27 -2
  93. package/lib/cli/configure/processing/javascript.js.map +1 -1
  94. package/lib/cli/configure/processing/json.js +31 -6
  95. package/lib/cli/configure/processing/json.js.map +1 -1
  96. package/lib/cli/configure/processing/loadFiles.js +26 -2
  97. package/lib/cli/configure/processing/loadFiles.js.map +1 -1
  98. package/lib/cli/configure/processing/module.js +28 -4
  99. package/lib/cli/configure/processing/module.js.map +1 -1
  100. package/lib/cli/configure/processing/package.d.ts +67 -1
  101. package/lib/cli/configure/processing/package.js +45 -8
  102. package/lib/cli/configure/processing/package.js.map +3 -3
  103. package/lib/cli/configure/processing/prettier.js +38 -4
  104. package/lib/cli/configure/processing/prettier.js.map +2 -2
  105. package/lib/cli/configure/processing/record.js +41 -5
  106. package/lib/cli/configure/processing/record.js.map +2 -2
  107. package/lib/cli/configure/processing/typescript.js +63 -26
  108. package/lib/cli/configure/processing/typescript.js.map +2 -2
  109. package/lib/cli/configure/types.d.ts +4 -15
  110. package/lib/cli/configure/types.js +16 -0
  111. package/lib/cli/configure/types.js.map +3 -3
  112. package/lib/cli/format/index.js +44 -20
  113. package/lib/cli/format/index.js.map +1 -1
  114. package/lib/cli/help/index.js +30 -6
  115. package/lib/cli/help/index.js.map +1 -1
  116. package/lib/cli/init/getConfig.d.ts +1 -1
  117. package/lib/cli/init/getConfig.js +100 -74
  118. package/lib/cli/init/getConfig.js.map +3 -3
  119. package/lib/cli/init/git.js +51 -16
  120. package/lib/cli/init/git.js.map +2 -2
  121. package/lib/cli/init/index.js +98 -67
  122. package/lib/cli/init/index.js.map +2 -2
  123. package/lib/cli/init/prompts.d.ts +4 -4
  124. package/lib/cli/init/prompts.js +48 -27
  125. package/lib/cli/init/prompts.js.map +2 -2
  126. package/lib/cli/init/types.js +41 -7
  127. package/lib/cli/init/types.js.map +1 -1
  128. package/lib/cli/init/validation.js +30 -2
  129. package/lib/cli/init/validation.js.map +1 -1
  130. package/lib/cli/init/writePackageJson.js +42 -8
  131. package/lib/cli/init/writePackageJson.js.map +2 -2
  132. package/lib/cli/lint/annotate/buildkite/eslint.js +37 -3
  133. package/lib/cli/lint/annotate/buildkite/eslint.js.map +1 -1
  134. package/lib/cli/lint/annotate/buildkite/index.js +45 -11
  135. package/lib/cli/lint/annotate/buildkite/index.js.map +1 -1
  136. package/lib/cli/lint/annotate/buildkite/internal.js +37 -3
  137. package/lib/cli/lint/annotate/buildkite/internal.js.map +1 -1
  138. package/lib/cli/lint/annotate/buildkite/prettier.js +37 -3
  139. package/lib/cli/lint/annotate/buildkite/prettier.js.map +1 -1
  140. package/lib/cli/lint/annotate/buildkite/tsc.js +37 -3
  141. package/lib/cli/lint/annotate/buildkite/tsc.js.map +1 -1
  142. package/lib/cli/lint/annotate/github/eslint.js +26 -2
  143. package/lib/cli/lint/annotate/github/eslint.js.map +1 -1
  144. package/lib/cli/lint/annotate/github/index.js +45 -11
  145. package/lib/cli/lint/annotate/github/index.js.map +1 -1
  146. package/lib/cli/lint/annotate/github/internal.js +26 -2
  147. package/lib/cli/lint/annotate/github/internal.js.map +1 -1
  148. package/lib/cli/lint/annotate/github/prettier.js +26 -2
  149. package/lib/cli/lint/annotate/github/prettier.js.map +1 -1
  150. package/lib/cli/lint/annotate/github/tsc.js +28 -4
  151. package/lib/cli/lint/annotate/github/tsc.js.map +2 -2
  152. package/lib/cli/lint/annotate/index.js +30 -6
  153. package/lib/cli/lint/annotate/index.js.map +1 -1
  154. package/lib/cli/lint/autofix.js +73 -37
  155. package/lib/cli/lint/autofix.js.map +1 -1
  156. package/lib/cli/lint/eslint.js +51 -16
  157. package/lib/cli/lint/eslint.js.map +3 -3
  158. package/lib/cli/lint/external.js +51 -19
  159. package/lib/cli/lint/external.js.map +2 -2
  160. package/lib/cli/lint/index.js +49 -25
  161. package/lib/cli/lint/index.js.map +1 -1
  162. package/lib/cli/lint/internal.js +42 -18
  163. package/lib/cli/lint/internal.js.map +1 -1
  164. package/lib/cli/lint/internalLints/detectBadCodeowners.js +33 -8
  165. package/lib/cli/lint/internalLints/detectBadCodeowners.js.map +1 -1
  166. package/lib/cli/lint/internalLints/noSkubaTemplateJs.js +45 -11
  167. package/lib/cli/lint/internalLints/noSkubaTemplateJs.js.map +2 -2
  168. package/lib/cli/lint/internalLints/patchRenovateConfig.js +55 -21
  169. package/lib/cli/lint/internalLints/patchRenovateConfig.js.map +2 -2
  170. package/lib/cli/lint/internalLints/refreshConfigFiles.js +63 -32
  171. package/lib/cli/lint/internalLints/refreshConfigFiles.js.map +2 -2
  172. package/lib/cli/lint/internalLints/upgrade/index.d.ts +6 -2
  173. package/lib/cli/lint/internalLints/upgrade/index.js +55 -23
  174. package/lib/cli/lint/internalLints/upgrade/index.js.map +3 -3
  175. package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/index.js +28 -4
  176. package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/index.js.map +1 -1
  177. package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/removeYarnIgnoreOptionalFlags.js +45 -11
  178. package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/removeYarnIgnoreOptionalFlags.js.map +2 -2
  179. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/index.js +30 -6
  180. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/index.js.map +1 -1
  181. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/migrateNpmrcToPnpmWorkspace.js +65 -34
  182. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/migrateNpmrcToPnpmWorkspace.js.map +2 -2
  183. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/stopBundlingInCDKTests.js +46 -11
  184. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/stopBundlingInCDKTests.js.map +2 -2
  185. package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/index.js +28 -4
  186. package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/index.js.map +1 -1
  187. package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/unhandledRejections.js +59 -23
  188. package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/unhandledRejections.js.map +2 -2
  189. package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/index.js +28 -4
  190. package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/index.js.map +1 -1
  191. package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/patchJestSnapshots.js +46 -11
  192. package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/patchJestSnapshots.js.map +2 -2
  193. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/index.js +30 -6
  194. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/index.js.map +1 -1
  195. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchApiTokenFromEnvironment.js +46 -11
  196. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchApiTokenFromEnvironment.js.map +2 -2
  197. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchDockerfileSyntaxDirective.js +46 -11
  198. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchDockerfileSyntaxDirective.js.map +2 -2
  199. package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/index.js +28 -4
  200. package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/index.js.map +1 -1
  201. package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/patchDockerfileCIVariable.js +46 -11
  202. package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/patchDockerfileCIVariable.js.map +2 -2
  203. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/configureTsConfigForESM.js +67 -29
  204. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/configureTsConfigForESM.js.map +2 -2
  205. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/index.js +34 -10
  206. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/index.js.map +1 -1
  207. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/patchApiDockerfiles.js +45 -11
  208. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/patchApiDockerfiles.js.map +2 -2
  209. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/rewriteSrcImports.d.ts +0 -4
  210. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/rewriteSrcImports.js +63 -18
  211. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/rewriteSrcImports.js.map +3 -3
  212. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/updateLambdaConfigs.js +50 -15
  213. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/updateLambdaConfigs.js.map +2 -2
  214. package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/index.js +40 -0
  215. package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/index.js.map +7 -0
  216. package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/patchRootTsconfig.d.ts +3 -0
  217. package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/patchRootTsconfig.js +133 -0
  218. package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/patchRootTsconfig.js.map +7 -0
  219. package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/upgradeNode.js +55 -0
  220. package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/upgradeNode.js.map +7 -0
  221. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/addEmptyExports.js +51 -17
  222. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/addEmptyExports.js.map +2 -2
  223. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/index.js +34 -10
  224. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/index.js.map +1 -1
  225. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchDockerfile.js +44 -10
  226. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchDockerfile.js.map +2 -2
  227. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchServerListener.js +46 -12
  228. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchServerListener.js.map +2 -2
  229. package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/index.js +28 -4
  230. package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/index.js.map +1 -1
  231. package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/patchPnpmPackageManager.js +49 -15
  232. package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/patchPnpmPackageManager.js.map +2 -2
  233. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/collapseDuplicateMergeKeys.js +45 -11
  234. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/collapseDuplicateMergeKeys.js.map +2 -2
  235. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/index.js +34 -10
  236. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/index.js.map +1 -1
  237. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/moveNpmrcMounts.js +45 -11
  238. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/moveNpmrcMounts.js.map +2 -2
  239. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerCompose.js +45 -11
  240. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerCompose.js.map +2 -2
  241. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerImages.js +47 -13
  242. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerImages.js.map +2 -2
  243. package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/index.js +28 -4
  244. package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/index.js.map +1 -1
  245. package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/patchPnpmDockerImages.js +45 -11
  246. package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/patchPnpmDockerImages.js.map +2 -2
  247. package/lib/cli/lint/prettier.js +50 -15
  248. package/lib/cli/lint/prettier.js.map +3 -3
  249. package/lib/cli/lint/tsc.js +28 -4
  250. package/lib/cli/lint/tsc.js.map +1 -1
  251. package/lib/cli/lint/types.js +16 -0
  252. package/lib/cli/lint/types.js.map +3 -3
  253. package/lib/cli/migrate/index.d.ts +5 -0
  254. package/lib/cli/migrate/index.js +79 -15
  255. package/lib/cli/migrate/index.js.map +2 -2
  256. package/lib/cli/migrate/nodeVersion/checks.d.ts +1 -14
  257. package/lib/cli/migrate/nodeVersion/checks.js +51 -120
  258. package/lib/cli/migrate/nodeVersion/checks.js.map +2 -2
  259. package/lib/cli/migrate/nodeVersion/index.d.ts +8 -2
  260. package/lib/cli/migrate/nodeVersion/index.js +239 -65
  261. package/lib/cli/migrate/nodeVersion/index.js.map +3 -3
  262. package/lib/cli/migrate/nodeVersion/upgrade.d.ts +8 -0
  263. package/lib/cli/migrate/nodeVersion/upgrade.js +179 -0
  264. package/lib/cli/migrate/nodeVersion/upgrade.js.map +7 -0
  265. package/lib/cli/node/index.js +57 -20
  266. package/lib/cli/node/index.js.map +3 -3
  267. package/lib/cli/release/index.js +28 -4
  268. package/lib/cli/release/index.js.map +1 -1
  269. package/lib/cli/start/index.js +50 -16
  270. package/lib/cli/start/index.js.map +3 -3
  271. package/lib/cli/test/index.js +65 -4
  272. package/lib/cli/test/index.js.map +2 -2
  273. package/lib/cli/test/reporters/github/annotations.d.ts +9 -0
  274. package/lib/cli/test/reporters/github/annotations.js +102 -0
  275. package/lib/cli/test/reporters/github/annotations.js.map +7 -0
  276. package/lib/cli/test/reporters/github/index.d.ts +5 -0
  277. package/lib/cli/test/reporters/github/index.js +74 -0
  278. package/lib/cli/test/reporters/github/index.js.map +7 -0
  279. package/lib/cli/version/index.js +30 -6
  280. package/lib/cli/version/index.js.map +1 -1
  281. package/lib/index.d.ts +1 -0
  282. package/lib/index.js +46 -6
  283. package/lib/index.js.map +2 -2
  284. package/lib/skuba.js +45 -26
  285. package/lib/skuba.js.map +3 -3
  286. package/lib/utils/args.js +43 -6
  287. package/lib/utils/args.js.map +2 -2
  288. package/lib/utils/command.js +42 -4
  289. package/lib/utils/command.js.map +3 -3
  290. package/lib/utils/copy.js +57 -20
  291. package/lib/utils/copy.js.map +2 -2
  292. package/lib/utils/dir.js +72 -32
  293. package/lib/utils/dir.js.map +2 -2
  294. package/lib/utils/env.js +26 -2
  295. package/lib/utils/env.js.map +1 -1
  296. package/lib/utils/error.js +47 -10
  297. package/lib/utils/error.js.map +1 -1
  298. package/lib/utils/exec.js +61 -23
  299. package/lib/utils/exec.js.map +3 -3
  300. package/lib/utils/fs.js +40 -6
  301. package/lib/utils/fs.js.map +2 -2
  302. package/lib/utils/help.js +30 -6
  303. package/lib/utils/help.js.map +1 -1
  304. package/lib/utils/logging.js +38 -11
  305. package/lib/utils/logging.js.map +1 -1
  306. package/lib/utils/logo.js +48 -24
  307. package/lib/utils/logo.js.map +1 -1
  308. package/lib/utils/manifest.d.ts +2 -3
  309. package/lib/utils/manifest.js +48 -8
  310. package/lib/utils/manifest.js.map +3 -3
  311. package/lib/utils/npmrc.js +26 -2
  312. package/lib/utils/npmrc.js.map +1 -1
  313. package/lib/utils/packageManager.js +49 -12
  314. package/lib/utils/packageManager.js.map +2 -2
  315. package/lib/utils/port.js +39 -4
  316. package/lib/utils/port.js.map +2 -2
  317. package/lib/utils/sleep.js +26 -2
  318. package/lib/utils/sleep.js.map +1 -1
  319. package/lib/utils/template.js +55 -18
  320. package/lib/utils/template.js.map +3 -3
  321. package/lib/utils/validation.js +31 -2
  322. package/lib/utils/validation.js.map +1 -1
  323. package/lib/utils/version.js +46 -9
  324. package/lib/utils/version.js.map +2 -2
  325. package/lib/utils/wait.js +32 -7
  326. package/lib/utils/wait.js.map +1 -1
  327. package/lib/utils/worker.js +35 -10
  328. package/lib/utils/worker.js.map +1 -1
  329. package/lib/wrapper/function-arguments.d.js +1 -0
  330. package/lib/wrapper/functionHandler.js +49 -18
  331. package/lib/wrapper/functionHandler.js.map +2 -2
  332. package/lib/wrapper/http.js +43 -8
  333. package/lib/wrapper/http.js.map +2 -2
  334. package/lib/wrapper/index.js +7 -6
  335. package/lib/wrapper/index.js.map +1 -1
  336. package/lib/wrapper/main.js +42 -8
  337. package/lib/wrapper/main.js.map +3 -3
  338. package/lib/wrapper/requestListener.js +47 -13
  339. package/lib/wrapper/requestListener.js.map +2 -2
  340. package/lib/wrapper/server.js +28 -4
  341. package/lib/wrapper/server.js.map +1 -1
  342. package/package.json +42 -43
  343. package/template/base/_.prettierrc.js +1 -1
  344. package/template/base/_eslint.config.js +1 -1
  345. package/template/base/_pnpm-workspace.yaml +4 -3
  346. package/template/base/jest.config.ts +19 -0
  347. package/template/base/jest.setup.ts +3 -0
  348. package/template/express-rest-api/.buildkite/pipeline.yml +1 -1
  349. package/template/express-rest-api/.nvmrc +1 -1
  350. package/template/express-rest-api/package.json +7 -8
  351. package/template/express-rest-api/skuba.template.js +1 -1
  352. package/template/express-rest-api/src/app.test.ts +0 -1
  353. package/template/greeter/.buildkite/pipeline.yml +1 -1
  354. package/template/greeter/.nvmrc +1 -1
  355. package/template/greeter/package.json +4 -5
  356. package/template/greeter/skuba.template.js +1 -1
  357. package/template/greeter/src/app.test.ts +1 -3
  358. package/template/koa-rest-api/.buildkite/pipeline.yml +1 -1
  359. package/template/koa-rest-api/.nvmrc +1 -1
  360. package/template/koa-rest-api/package.json +8 -10
  361. package/template/koa-rest-api/skuba.template.js +1 -1
  362. package/template/koa-rest-api/src/api/jobs/getJobs.test.ts +0 -2
  363. package/template/koa-rest-api/src/api/jobs/postJob.test.ts +0 -2
  364. package/template/koa-rest-api/src/app.test.ts +0 -2
  365. package/template/koa-rest-api/src/framework/server.test.ts +2 -2
  366. package/template/koa-rest-api/src/framework/validation.test.ts +0 -2
  367. package/template/koa-rest-api/src/testing/metrics.ts +0 -2
  368. package/template/lambda-sqs-worker-cdk/.buildkite/pipeline.yml +2 -2
  369. package/template/lambda-sqs-worker-cdk/.nvmrc +1 -1
  370. package/template/lambda-sqs-worker-cdk/infra/__snapshots__/appStack.test.ts.snap +7 -19
  371. package/template/lambda-sqs-worker-cdk/infra/appStack.test.ts +9 -11
  372. package/template/lambda-sqs-worker-cdk/infra/appStack.ts +3 -3
  373. package/template/lambda-sqs-worker-cdk/infra/config.ts +2 -4
  374. package/template/lambda-sqs-worker-cdk/package.json +9 -9
  375. package/template/lambda-sqs-worker-cdk/skuba.template.js +13 -1
  376. package/template/lambda-sqs-worker-cdk/src/app.test.ts +13 -22
  377. package/template/lambda-sqs-worker-cdk/src/framework/handler.test.ts +0 -1
  378. package/template/lambda-sqs-worker-cdk/src/framework/validation.test.ts +31 -33
  379. package/template/lambda-sqs-worker-cdk/src/services/jobScorer.test.ts +2 -8
  380. package/template/lambda-sqs-worker-cdk/src/services/pipelineEventSender.test.ts +2 -3
  381. package/template/lambda-sqs-worker-cdk/src/testing/services.ts +3 -4
  382. package/template/oss-npm-package/.github/workflows/release.yml +1 -1
  383. package/template/oss-npm-package/.github/workflows/validate.yml +1 -1
  384. package/template/oss-npm-package/.nvmrc +1 -1
  385. package/template/oss-npm-package/_package.json +0 -1
  386. package/template/oss-npm-package/skuba.template.js +1 -1
  387. package/template/oss-npm-package/src/index.test.ts +0 -2
  388. package/template/private-npm-package/.nvmrc +1 -1
  389. package/template/private-npm-package/_package.json +1 -2
  390. package/template/private-npm-package/skuba.template.js +2 -2
  391. package/template/private-npm-package/src/index.test.ts +0 -2
  392. package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/addTypeModuleToPackageJson.d.ts +0 -6
  393. package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/addTypeModuleToPackageJson.js +0 -86
  394. package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/addTypeModuleToPackageJson.js.map +0 -7
  395. package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/index.js +0 -16
  396. package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/index.js.map +0 -7
  397. package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/rewriteGlobalVars.d.ts +0 -7
  398. package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/rewriteGlobalVars.js +0 -76
  399. package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/rewriteGlobalVars.js.map +0 -7
  400. package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/index.d.ts +0 -2
  401. package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/index.js +0 -11
  402. package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/index.js.map +0 -7
  403. package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/upgradeNode.js +0 -34
  404. package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/upgradeNode.js.map +0 -7
  405. package/lib/eslint.d.js +0 -1
  406. package/lib/eslint.d.js.map +0 -7
  407. package/template/base/vitest.config.ts +0 -25
  408. /package/lib/cli/lint/internalLints/upgrade/patches/{12.5.0 → 13.1.1}/index.d.ts +0 -0
  409. /package/lib/cli/lint/internalLints/upgrade/patches/{9.1.0 → 13.1.1}/upgradeNode.d.ts +0 -0
@@ -1,9 +1,70 @@
1
- import { exec } from "../../utils/exec.js";
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 test_exports = {};
30
+ __export(test_exports, {
31
+ test: () => test
32
+ });
33
+ module.exports = __toCommonJS(test_exports);
34
+ var import_util = require("util");
35
+ var import_args = require("../../utils/args.js");
36
+ var import_env = require("../../utils/env.js");
37
+ var import_exec = require("../../utils/exec.js");
38
+ var import_logging = require("../../utils/logging.js");
39
+ var import_lint = require("../lint/index.js");
40
+ var import_upgrade = require("../lint/internalLints/upgrade/index.js");
2
41
  const test = async () => {
3
42
  const argv = process.argv.slice(2);
4
- return exec("vitest", ...argv);
43
+ const nodeOptions = process.env.NODE_OPTIONS ?? "";
44
+ if ((0, import_env.isCiEnv)()) {
45
+ const logger = (0, import_logging.createLogger)({ debug: (0, import_args.hasDebugFlag)(argv) });
46
+ try {
47
+ const result = await (0, import_upgrade.upgradeSkuba)(
48
+ "format",
49
+ (0, import_logging.childLogger)(logger, { suffixes: [(0, import_util.styleText)("dim", "upgrade-skuba")] })
50
+ );
51
+ if (result.upgraded) {
52
+ await (0, import_lint.lint)(argv);
53
+ }
54
+ } catch (error) {
55
+ logger.warn("Failed to upgrade skuba before tests.");
56
+ logger.subtle((0, import_util.inspect)(error));
57
+ }
58
+ }
59
+ const execWithEnv = (0, import_exec.createExec)({
60
+ env: {
61
+ NODE_OPTIONS: !nodeOptions.includes("--experimental-vm-modules") ? `${nodeOptions} --experimental-vm-modules --no-warnings=ExperimentalWarning` : nodeOptions
62
+ }
63
+ });
64
+ return execWithEnv(require.resolve("jest/bin/jest"), ...argv);
5
65
  };
6
- export {
66
+ // Annotate the CommonJS export names for ESM import in node:
67
+ 0 && (module.exports = {
7
68
  test
8
- };
69
+ });
9
70
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/cli/test/index.ts"],
4
- "sourcesContent": ["import { exec } from '../../utils/exec.js';\n\nexport const test = async () => {\n const argv = process.argv.slice(2);\n\n return exec('vitest', ...argv);\n};\n"],
5
- "mappings": "AAAA,SAAS,YAAY;AAEd,MAAM,OAAO,YAAY;AAC9B,QAAM,OAAO,QAAQ,KAAK,MAAM,CAAC;AAEjC,SAAO,KAAK,UAAU,GAAG,IAAI;AAC/B;",
4
+ "sourcesContent": ["import { inspect, styleText } from 'util';\n\nimport { hasDebugFlag } from '../../utils/args.js';\nimport { isCiEnv } from '../../utils/env.js';\nimport { createExec } from '../../utils/exec.js';\nimport { childLogger, createLogger } from '../../utils/logging.js';\nimport { lint } from '../lint/index.js';\nimport { upgradeSkuba } from '../lint/internalLints/upgrade/index.js';\n\nexport const test = async () => {\n const argv = process.argv.slice(2);\n\n const nodeOptions = process.env.NODE_OPTIONS ?? '';\n\n if (isCiEnv()) {\n const logger = createLogger({ debug: hasDebugFlag(argv) });\n\n try {\n const result = await upgradeSkuba(\n 'format',\n childLogger(logger, { suffixes: [styleText('dim', 'upgrade-skuba')] }),\n );\n\n if (result.upgraded) {\n await lint(argv);\n }\n } catch (error) {\n logger.warn('Failed to upgrade skuba before tests.');\n logger.subtle(inspect(error));\n }\n }\n\n const execWithEnv = createExec({\n env: {\n NODE_OPTIONS: !nodeOptions.includes('--experimental-vm-modules')\n ? `${nodeOptions} --experimental-vm-modules --no-warnings=ExperimentalWarning`\n : nodeOptions,\n },\n });\n\n // Run Jest in a child process with proper environment\n return execWithEnv(require.resolve('jest/bin/jest'), ...argv);\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAmC;AAEnC,kBAA6B;AAC7B,iBAAwB;AACxB,kBAA2B;AAC3B,qBAA0C;AAC1C,kBAAqB;AACrB,qBAA6B;AAEtB,MAAM,OAAO,YAAY;AAC9B,QAAM,OAAO,QAAQ,KAAK,MAAM,CAAC;AAEjC,QAAM,cAAc,QAAQ,IAAI,gBAAgB;AAEhD,UAAI,oBAAQ,GAAG;AACb,UAAM,aAAS,6BAAa,EAAE,WAAO,0BAAa,IAAI,EAAE,CAAC;AAEzD,QAAI;AACF,YAAM,SAAS,UAAM;AAAA,QACnB;AAAA,YACA,4BAAY,QAAQ,EAAE,UAAU,KAAC,uBAAU,OAAO,eAAe,CAAC,EAAE,CAAC;AAAA,MACvE;AAEA,UAAI,OAAO,UAAU;AACnB,kBAAM,kBAAK,IAAI;AAAA,MACjB;AAAA,IACF,SAAS,OAAO;AACd,aAAO,KAAK,uCAAuC;AACnD,aAAO,WAAO,qBAAQ,KAAK,CAAC;AAAA,IAC9B;AAAA,EACF;AAEA,QAAM,kBAAc,wBAAW;AAAA,IAC7B,KAAK;AAAA,MACH,cAAc,CAAC,YAAY,SAAS,2BAA2B,IAC3D,GAAG,WAAW,iEACd;AAAA,IACN;AAAA,EACF,CAAC;AAGD,SAAO,YAAY,gBAAgB,eAAe,GAAG,GAAG,IAAI;AAC9D;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,9 @@
1
+ import type { TestResult } from '@jest/test-result';
2
+ import type * as GitHub from '@skuba-lib/api/github';
3
+ export declare const createAnnotations: (testResults: TestResult[]) => GitHub.Annotation[];
4
+ interface AnnotationEntry {
5
+ annotations: GitHub.Annotation[];
6
+ displayName: string | undefined;
7
+ }
8
+ export declare const generateAnnotationEntries: (testResults: TestResult[]) => AnnotationEntry[];
9
+ export {};
@@ -0,0 +1,102 @@
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 annotations_exports = {};
30
+ __export(annotations_exports, {
31
+ createAnnotations: () => createAnnotations,
32
+ generateAnnotationEntries: () => generateAnnotationEntries
33
+ });
34
+ module.exports = __toCommonJS(annotations_exports);
35
+ var import_path = __toESM(require("path"));
36
+ var import_util = require("util");
37
+ var import_ts_dedent = __toESM(require("ts-dedent"));
38
+ const JEST_LOCATION_REGEX = /\n +at (.+\()?(.+?):(\d+):(\d+)/;
39
+ const createAnnotations = (testResults) => {
40
+ const cwd = process.cwd();
41
+ return testResults.flatMap((testResult) => {
42
+ if (testResult.testExecError) {
43
+ return {
44
+ annotation_level: "failure",
45
+ path: import_path.default.relative(cwd, testResult.testFilePath),
46
+ start_line: 1,
47
+ end_line: 1,
48
+ message: (0, import_util.stripVTControlCharacters)(
49
+ testResult.failureMessage ? (0, import_ts_dedent.default)(testResult.failureMessage) : testResult.testExecError.message
50
+ ),
51
+ title: "Jest"
52
+ };
53
+ }
54
+ if (testResult.numFailingTests > 0) {
55
+ return testResult.testResults.flatMap(
56
+ (assertionResult) => assertionResult.failureMessages.flatMap((failureMessage) => {
57
+ const match = JEST_LOCATION_REGEX.exec(failureMessage);
58
+ if (match?.length === 5 && match[2]) {
59
+ return {
60
+ annotation_level: "failure",
61
+ path: import_path.default.relative(cwd, match[2]),
62
+ start_line: Number(match[3]),
63
+ end_line: Number(match[3]),
64
+ start_column: Number(match[4]),
65
+ end_column: Number(match[4]),
66
+ message: (0, import_util.stripVTControlCharacters)(failureMessage),
67
+ title: "Jest"
68
+ };
69
+ }
70
+ return [];
71
+ })
72
+ );
73
+ }
74
+ return [];
75
+ });
76
+ };
77
+ const DEFAULT_DISPLAY_NAME = Symbol("DEFAULT_DISPLAY_NAME");
78
+ const generateAnnotationEntries = (testResults) => {
79
+ const resultsByDisplayName = testResults.reduce(
80
+ (acc, result) => {
81
+ const displayName = result.displayName?.name ?? DEFAULT_DISPLAY_NAME;
82
+ (acc[displayName] ??= []).push(result);
83
+ return acc;
84
+ },
85
+ {}
86
+ );
87
+ const defaultResults = resultsByDisplayName[DEFAULT_DISPLAY_NAME];
88
+ const entries = [
89
+ ...defaultResults?.length ? [[void 0, defaultResults]] : [],
90
+ ...Object.entries(resultsByDisplayName)
91
+ ];
92
+ return entries.map(([displayName, results]) => ({
93
+ annotations: createAnnotations(results),
94
+ displayName
95
+ }));
96
+ };
97
+ // Annotate the CommonJS export names for ESM import in node:
98
+ 0 && (module.exports = {
99
+ createAnnotations,
100
+ generateAnnotationEntries
101
+ });
102
+ //# sourceMappingURL=annotations.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/cli/test/reporters/github/annotations.ts"],
4
+ "sourcesContent": ["import path from 'path';\nimport { stripVTControlCharacters as stripAnsi } from 'util';\n\nimport type { TestResult } from '@jest/test-result';\nimport dedent from 'ts-dedent';\n\nimport type * as GitHub from '@skuba-lib/api/github';\n\n/**\n * Matches the first stack trace location in a Jest failure message.\n *\n * For example, given the following input message:\n *\n * ```console\n * Error: expect(received).toBe(expected) // Object.is equality\n *\n * Expected: \"a\"\n * Received: \"b\"\n * at Object.<anonymous> (/workdir/skuba/src/test.test.ts:2:15)\n * at Promise.then.completed (/workdir/skuba/node_modules/jest-circus/build/utils.js:390:28)\n * ...\n * ```\n *\n * or:\n *\n * ```console\n * Error: expect(received).toBe(expected) // Object.is equality\n *\n * Expected: \"a\"\n * Received: \"b\"\n * at /workdir/skuba/src/test.test.ts:2:15\n * at Promise.then.completed (/workdir/skuba/node_modules/jest-circus/build/utils.js:390:28)\n * ...\n * ```\n *\n * This pattern will produce the following matches:\n *\n * 1. /workdir/skuba/src/test.test.ts\n * 2. 2\n * 2. 15\n */\nconst JEST_LOCATION_REGEX = /\\n +at (.+\\()?(.+?):(\\d+):(\\d+)/;\n\nexport const createAnnotations = (\n testResults: TestResult[],\n): GitHub.Annotation[] => {\n const cwd = process.cwd();\n\n return testResults.flatMap((testResult) => {\n if (testResult.testExecError) {\n return {\n annotation_level: 'failure',\n path: path.relative(cwd, testResult.testFilePath),\n start_line: 1,\n end_line: 1,\n message: stripAnsi(\n testResult.failureMessage\n ? dedent(testResult.failureMessage)\n : testResult.testExecError.message,\n ),\n title: 'Jest',\n };\n }\n\n if (testResult.numFailingTests > 0) {\n return testResult.testResults.flatMap((assertionResult) =>\n assertionResult.failureMessages.flatMap((failureMessage) => {\n const match = JEST_LOCATION_REGEX.exec(failureMessage);\n if (match?.length === 5 && match[2]) {\n return {\n annotation_level: 'failure',\n path: path.relative(cwd, match[2]),\n start_line: Number(match[3]),\n end_line: Number(match[3]),\n start_column: Number(match[4]),\n end_column: Number(match[4]),\n message: stripAnsi(failureMessage),\n title: 'Jest',\n };\n }\n\n return [];\n }),\n );\n }\n\n return [];\n });\n};\n\nconst DEFAULT_DISPLAY_NAME = Symbol('DEFAULT_DISPLAY_NAME');\n\ninterface AnnotationEntry {\n annotations: GitHub.Annotation[];\n displayName: string | undefined;\n}\n\nexport const generateAnnotationEntries = (\n testResults: TestResult[],\n): AnnotationEntry[] => {\n type ResultsByDisplayName = Record<string | symbol, TestResult[]>;\n\n // Group test results by display name.\n const resultsByDisplayName = testResults.reduce<ResultsByDisplayName>(\n (acc, result) => {\n const displayName = result.displayName?.name ?? DEFAULT_DISPLAY_NAME;\n\n (acc[displayName] ??= []).push(result);\n\n return acc;\n },\n {},\n );\n\n const defaultResults = resultsByDisplayName[DEFAULT_DISPLAY_NAME];\n\n const entries = [\n ...(defaultResults?.length ? ([[undefined, defaultResults]] as const) : []),\n ...Object.entries(resultsByDisplayName),\n ];\n\n // Create annotations for each display name.\n return entries.map<AnnotationEntry>(([displayName, results]) => ({\n annotations: createAnnotations(results),\n displayName,\n }));\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,kBAAsD;AAGtD,uBAAmB;AAqCnB,MAAM,sBAAsB;AAErB,MAAM,oBAAoB,CAC/B,gBACwB;AACxB,QAAM,MAAM,QAAQ,IAAI;AAExB,SAAO,YAAY,QAAQ,CAAC,eAAe;AACzC,QAAI,WAAW,eAAe;AAC5B,aAAO;AAAA,QACL,kBAAkB;AAAA,QAClB,MAAM,YAAAA,QAAK,SAAS,KAAK,WAAW,YAAY;AAAA,QAChD,YAAY;AAAA,QACZ,UAAU;AAAA,QACV,aAAS,YAAAC;AAAA,UACP,WAAW,qBACP,iBAAAC,SAAO,WAAW,cAAc,IAChC,WAAW,cAAc;AAAA,QAC/B;AAAA,QACA,OAAO;AAAA,MACT;AAAA,IACF;AAEA,QAAI,WAAW,kBAAkB,GAAG;AAClC,aAAO,WAAW,YAAY;AAAA,QAAQ,CAAC,oBACrC,gBAAgB,gBAAgB,QAAQ,CAAC,mBAAmB;AAC1D,gBAAM,QAAQ,oBAAoB,KAAK,cAAc;AACrD,cAAI,OAAO,WAAW,KAAK,MAAM,CAAC,GAAG;AACnC,mBAAO;AAAA,cACL,kBAAkB;AAAA,cAClB,MAAM,YAAAF,QAAK,SAAS,KAAK,MAAM,CAAC,CAAC;AAAA,cACjC,YAAY,OAAO,MAAM,CAAC,CAAC;AAAA,cAC3B,UAAU,OAAO,MAAM,CAAC,CAAC;AAAA,cACzB,cAAc,OAAO,MAAM,CAAC,CAAC;AAAA,cAC7B,YAAY,OAAO,MAAM,CAAC,CAAC;AAAA,cAC3B,aAAS,YAAAC,0BAAU,cAAc;AAAA,cACjC,OAAO;AAAA,YACT;AAAA,UACF;AAEA,iBAAO,CAAC;AAAA,QACV,CAAC;AAAA,MACH;AAAA,IACF;AAEA,WAAO,CAAC;AAAA,EACV,CAAC;AACH;AAEA,MAAM,uBAAuB,OAAO,sBAAsB;AAOnD,MAAM,4BAA4B,CACvC,gBACsB;AAItB,QAAM,uBAAuB,YAAY;AAAA,IACvC,CAAC,KAAK,WAAW;AACf,YAAM,cAAc,OAAO,aAAa,QAAQ;AAEhD,OAAC,IAAI,WAAW,MAAM,CAAC,GAAG,KAAK,MAAM;AAErC,aAAO;AAAA,IACT;AAAA,IACA,CAAC;AAAA,EACH;AAEA,QAAM,iBAAiB,qBAAqB,oBAAoB;AAEhE,QAAM,UAAU;AAAA,IACd,GAAI,gBAAgB,SAAU,CAAC,CAAC,QAAW,cAAc,CAAC,IAAc,CAAC;AAAA,IACzE,GAAG,OAAO,QAAQ,oBAAoB;AAAA,EACxC;AAGA,SAAO,QAAQ,IAAqB,CAAC,CAAC,aAAa,OAAO,OAAO;AAAA,IAC/D,aAAa,kBAAkB,OAAO;AAAA,IACtC;AAAA,EACF,EAAE;AACJ;",
6
+ "names": ["path", "stripAnsi", "dedent"]
7
+ }
@@ -0,0 +1,5 @@
1
+ import type { Reporter, TestContext } from '@jest/reporters';
2
+ import type { AggregatedResult } from '@jest/test-result';
3
+ export default class GitHubReporter implements Pick<Reporter, 'onRunComplete'> {
4
+ onRunComplete(_contexts: Set<TestContext>, { testResults }: AggregatedResult): Promise<void>;
5
+ }
@@ -0,0 +1,74 @@
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 github_exports = {};
30
+ __export(github_exports, {
31
+ default: () => GitHubReporter
32
+ });
33
+ module.exports = __toCommonJS(github_exports);
34
+ var import_util = require("util");
35
+ var import_logging = require("../../../../utils/logging.js");
36
+ var import_wait = require("../../../../utils/wait.js");
37
+ var import_annotations = require("./annotations.js");
38
+ var GitHub = __toESM(require("@skuba-lib/api/github"));
39
+ class GitHubReporter {
40
+ async onRunComplete(_contexts, { testResults }) {
41
+ if (!GitHub.enabledFromEnvironment()) {
42
+ return;
43
+ }
44
+ let lastCheckRun;
45
+ try {
46
+ const entries = (0, import_annotations.generateAnnotationEntries)(testResults);
47
+ const build = GitHub.buildNameFromEnvironment();
48
+ for (const { displayName, annotations } of entries) {
49
+ const name = `skuba/test${displayName ? ` (${displayName})` : ""}`;
50
+ const isOk = !annotations.length;
51
+ const summary = isOk ? "`skuba test` passed." : "`skuba test` found issues that require triage.";
52
+ const checkRun = {
53
+ name,
54
+ annotations,
55
+ conclusion: isOk ? "success" : "failure",
56
+ summary,
57
+ title: `${build} ${isOk ? "passed" : "failed"}`
58
+ };
59
+ lastCheckRun = checkRun;
60
+ await (0, import_wait.throwOnTimeout)(GitHub.createCheckRun(checkRun), {
61
+ s: 30
62
+ });
63
+ }
64
+ } catch (err) {
65
+ import_logging.log.warn("Failed to report test results to GitHub.");
66
+ import_logging.log.subtle((0, import_util.inspect)(err));
67
+ if (lastCheckRun) {
68
+ import_logging.log.subtle("Last request:");
69
+ import_logging.log.subtle(JSON.stringify(lastCheckRun));
70
+ }
71
+ }
72
+ }
73
+ }
74
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/cli/test/reporters/github/index.ts"],
4
+ "sourcesContent": ["import { inspect } from 'util';\n\nimport type { Reporter, TestContext } from '@jest/reporters';\nimport type { AggregatedResult } from '@jest/test-result';\n\nimport { log } from '../../../../utils/logging.js';\nimport { throwOnTimeout } from '../../../../utils/wait.js';\n\nimport { generateAnnotationEntries } from './annotations.js';\n\nimport * as GitHub from '@skuba-lib/api/github';\n\nexport default class GitHubReporter implements Pick<Reporter, 'onRunComplete'> {\n async onRunComplete(\n _contexts: Set<TestContext>,\n { testResults }: AggregatedResult,\n ): Promise<void> {\n if (!GitHub.enabledFromEnvironment()) {\n return;\n }\n\n type CheckRun = Parameters<typeof GitHub.createCheckRun>[0];\n\n let lastCheckRun: CheckRun | undefined;\n\n try {\n const entries = generateAnnotationEntries(testResults);\n\n const build = GitHub.buildNameFromEnvironment();\n\n // Create a check run per display name.\n // Run in series to reduce the likelihood of exceeding GitHub rate limits.\n for (const { displayName, annotations } of entries) {\n const name = `skuba/test${displayName ? ` (${displayName})` : ''}`;\n\n const isOk = !annotations.length;\n\n const summary = isOk\n ? '`skuba test` passed.'\n : '`skuba test` found issues that require triage.';\n\n const checkRun: CheckRun = {\n name,\n annotations,\n conclusion: isOk ? 'success' : 'failure',\n summary,\n title: `${build} ${isOk ? 'passed' : 'failed'}`,\n };\n\n lastCheckRun = checkRun;\n\n await throwOnTimeout(GitHub.createCheckRun(checkRun), {\n s: 30,\n });\n }\n } catch (err) {\n log.warn('Failed to report test results to GitHub.');\n log.subtle(inspect(err));\n\n if (lastCheckRun) {\n log.subtle('Last request:');\n log.subtle(JSON.stringify(lastCheckRun));\n }\n }\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAwB;AAKxB,qBAAoB;AACpB,kBAA+B;AAE/B,yBAA0C;AAE1C,aAAwB;AAExB,MAAO,eAAwE;AAAA,EAC7E,MAAM,cACJ,WACA,EAAE,YAAY,GACC;AACf,QAAI,CAAC,OAAO,uBAAuB,GAAG;AACpC;AAAA,IACF;AAIA,QAAI;AAEJ,QAAI;AACF,YAAM,cAAU,8CAA0B,WAAW;AAErD,YAAM,QAAQ,OAAO,yBAAyB;AAI9C,iBAAW,EAAE,aAAa,YAAY,KAAK,SAAS;AAClD,cAAM,OAAO,aAAa,cAAc,KAAK,WAAW,MAAM,EAAE;AAEhE,cAAM,OAAO,CAAC,YAAY;AAE1B,cAAM,UAAU,OACZ,yBACA;AAEJ,cAAM,WAAqB;AAAA,UACzB;AAAA,UACA;AAAA,UACA,YAAY,OAAO,YAAY;AAAA,UAC/B;AAAA,UACA,OAAO,GAAG,KAAK,IAAI,OAAO,WAAW,QAAQ;AAAA,QAC/C;AAEA,uBAAe;AAEf,kBAAM,4BAAe,OAAO,eAAe,QAAQ,GAAG;AAAA,UACpD,GAAG;AAAA,QACL,CAAC;AAAA,MACH;AAAA,IACF,SAAS,KAAK;AACZ,yBAAI,KAAK,0CAA0C;AACnD,yBAAI,WAAO,qBAAQ,GAAG,CAAC;AAEvB,UAAI,cAAc;AAChB,2BAAI,OAAO,eAAe;AAC1B,2BAAI,OAAO,KAAK,UAAU,YAAY,CAAC;AAAA,MACzC;AAAA,IACF;AAAA,EACF;AACF;",
6
+ "names": []
7
+ }
@@ -1,10 +1,34 @@
1
- import { log } from "../../utils/logging.js";
2
- import { getSkubaVersion } from "../../utils/version.js";
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 version_exports = {};
20
+ __export(version_exports, {
21
+ version: () => version
22
+ });
23
+ module.exports = __toCommonJS(version_exports);
24
+ var import_logging = require("../../utils/logging.js");
25
+ var import_version = require("../../utils/version.js");
3
26
  const version = async () => {
4
- const skubaVersion = await getSkubaVersion();
5
- log.plain(skubaVersion);
27
+ const skubaVersion = await (0, import_version.getSkubaVersion)();
28
+ import_logging.log.plain(skubaVersion);
6
29
  };
7
- export {
30
+ // Annotate the CommonJS export names for ESM import in node:
31
+ 0 && (module.exports = {
8
32
  version
9
- };
33
+ });
10
34
  //# sourceMappingURL=index.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../src/cli/version/index.ts"],
4
4
  "sourcesContent": ["import { log } from '../../utils/logging.js';\nimport { getSkubaVersion } from '../../utils/version.js';\n\nexport const version = async () => {\n const skubaVersion = await getSkubaVersion();\n\n log.plain(skubaVersion);\n};\n"],
5
- "mappings": "AAAA,SAAS,WAAW;AACpB,SAAS,uBAAuB;AAEzB,MAAM,UAAU,YAAY;AACjC,QAAM,eAAe,MAAM,gBAAgB;AAE3C,MAAI,MAAM,YAAY;AACxB;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAoB;AACpB,qBAAgC;AAEzB,MAAM,UAAU,YAAY;AACjC,QAAM,eAAe,UAAM,gCAAgB;AAE3C,qBAAI,MAAM,YAAY;AACxB;",
6
6
  "names": []
7
7
  }
package/lib/index.d.ts CHANGED
@@ -13,6 +13,7 @@ export * as Buildkite from '@skuba-lib/api/buildkite';
13
13
  export * as Git from '@skuba-lib/api/git';
14
14
  export * as GitHub from '@skuba-lib/api/github';
15
15
  export * as Net from '@skuba-lib/api/net';
16
+ export * as Jest from './api/jest/index.js';
16
17
  declare global {
17
18
  namespace WebAssembly {
18
19
  interface Module {
package/lib/index.js CHANGED
@@ -1,11 +1,51 @@
1
- import * as Buildkite from "@skuba-lib/api/buildkite";
2
- import * as Git from "@skuba-lib/api/git";
3
- import * as GitHub from "@skuba-lib/api/github";
4
- import * as Net from "@skuba-lib/api/net";
5
- export {
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 index_exports = {};
30
+ __export(index_exports, {
31
+ Buildkite: () => Buildkite,
32
+ Git: () => Git,
33
+ GitHub: () => GitHub,
34
+ Jest: () => Jest,
35
+ Net: () => Net
36
+ });
37
+ module.exports = __toCommonJS(index_exports);
38
+ var Buildkite = __toESM(require("@skuba-lib/api/buildkite"));
39
+ var Git = __toESM(require("@skuba-lib/api/git"));
40
+ var GitHub = __toESM(require("@skuba-lib/api/github"));
41
+ var Net = __toESM(require("@skuba-lib/api/net"));
42
+ var Jest = __toESM(require("./api/jest/index.js"));
43
+ // Annotate the CommonJS export names for ESM import in node:
44
+ 0 && (module.exports = {
6
45
  Buildkite,
7
46
  Git,
8
47
  GitHub,
48
+ Jest,
9
49
  Net
10
- };
50
+ });
11
51
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
- "sourcesContent": ["/**\n * Entry point for the Node.js development API.\n *\n * This is where skuba imports point to:\n *\n * ```typescript\n * import { Net } from 'skuba';\n *\n * const { Net } = require('skuba');\n * ```\n */\n\nexport * as Buildkite from '@skuba-lib/api/buildkite';\nexport * as Git from '@skuba-lib/api/git';\nexport * as GitHub from '@skuba-lib/api/github';\nexport * as Net from '@skuba-lib/api/net';\n\n// evanw/esbuild#2388\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace WebAssembly {\n // eslint-disable-next-line @typescript-eslint/no-empty-object-type\n interface Module {}\n }\n}\n"],
5
- "mappings": "AAYA,YAAY,eAAe;AAC3B,YAAY,SAAS;AACrB,YAAY,YAAY;AACxB,YAAY,SAAS;",
4
+ "sourcesContent": ["/**\n * Entry point for the Node.js development API.\n *\n * This is where skuba imports point to:\n *\n * ```typescript\n * import { Net } from 'skuba';\n *\n * const { Net } = require('skuba');\n * ```\n */\n\nexport * as Buildkite from '@skuba-lib/api/buildkite';\nexport * as Git from '@skuba-lib/api/git';\nexport * as GitHub from '@skuba-lib/api/github';\nexport * as Net from '@skuba-lib/api/net';\nexport * as Jest from './api/jest/index.js';\n\n// evanw/esbuild#2388\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace WebAssembly {\n // eslint-disable-next-line @typescript-eslint/no-empty-object-type\n interface Module {}\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYA,gBAA2B;AAC3B,UAAqB;AACrB,aAAwB;AACxB,UAAqB;AACrB,WAAsB;",
6
6
  "names": []
7
7
  }
package/lib/skuba.js CHANGED
@@ -1,25 +1,44 @@
1
1
  #!/usr/bin/env node
2
- import path from "path";
3
- import { parseProcessArgs } from "./utils/args.js";
4
- import {
5
- COMMAND_DIR,
6
- COMMAND_SET,
7
- commandToModule
8
- } from "./utils/command.js";
9
- import { isCiEnv } from "./utils/env.js";
10
- import { handleCliError } from "./utils/error.js";
11
- import { showHelp } from "./utils/help.js";
12
- import { log } from "./utils/logging.js";
13
- import { showLogoAndVersionInfo } from "./utils/logo.js";
14
- import { isObject } from "./utils/validation.js";
2
+ "use strict";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
18
+ // If the importer is in node compatibility mode or this is not an ESM
19
+ // file that has been converted to a CommonJS file using a Babel-
20
+ // compatible transform (i.e. "__esModule" has not been set), then set
21
+ // "default" to the CommonJS "module.exports" for node compatibility.
22
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
23
+ mod
24
+ ));
25
+ var import_path = __toESM(require("path"));
26
+ var import_args = require("./utils/args.js");
27
+ var import_command = require("./utils/command.js");
28
+ var import_env = require("./utils/env.js");
29
+ var import_error = require("./utils/error.js");
30
+ var import_help = require("./utils/help.js");
31
+ var import_logging = require("./utils/logging.js");
32
+ var import_logo = require("./utils/logo.js");
33
+ var import_validation = require("./utils/validation.js");
15
34
  const THIRTY_MINUTES = 30 * 60 * 1e3;
16
35
  const skuba = async () => {
17
- const { commandName } = parseProcessArgs(process.argv);
18
- if (COMMAND_SET.has(commandName)) {
19
- const moduleName = commandToModule(commandName);
20
- const commandModule = await import(path.join(COMMAND_DIR, moduleName, "index.js"));
21
- if (!isObject(commandModule) || !(moduleName in commandModule)) {
22
- log.err(log.bold(commandName), "couldn't run! Please submit an issue.");
36
+ const { commandName } = (0, import_args.parseProcessArgs)(process.argv);
37
+ if (import_command.COMMAND_SET.has(commandName)) {
38
+ const moduleName = (0, import_command.commandToModule)(commandName);
39
+ const commandModule = require(import_path.default.join(import_command.COMMAND_DIR, moduleName, "index.js"));
40
+ if (!(0, import_validation.hasProp)(commandModule, moduleName)) {
41
+ import_logging.log.err(import_logging.log.bold(commandName), "couldn't run! Please submit an issue.");
23
42
  process.exitCode = 1;
24
43
  return;
25
44
  }
@@ -27,13 +46,13 @@ const skuba = async () => {
27
46
  if (commandModule.longRunning) {
28
47
  return run();
29
48
  }
30
- if (!isCiEnv() || process.env.SKUBA_NO_TIMEOUT === "true") {
49
+ if (!(0, import_env.isCiEnv)() || process.env.SKUBA_NO_TIMEOUT === "true") {
31
50
  return run();
32
51
  }
33
52
  const timeoutId = setTimeout(
34
53
  () => {
35
- log.err(
36
- log.bold(commandName),
54
+ import_logging.log.err(
55
+ import_logging.log.bold(commandName),
37
56
  "timed out. This may indicate a process hanging - please file an issue."
38
57
  );
39
58
  process.exit(1);
@@ -42,11 +61,11 @@ const skuba = async () => {
42
61
  );
43
62
  return run().finally(() => clearTimeout(timeoutId));
44
63
  }
45
- log.err(log.bold(commandName), "is not recognised as a command.");
46
- await showLogoAndVersionInfo();
47
- showHelp();
64
+ import_logging.log.err(import_logging.log.bold(commandName), "is not recognised as a command.");
65
+ await (0, import_logo.showLogoAndVersionInfo)();
66
+ (0, import_help.showHelp)();
48
67
  process.exitCode = 1;
49
68
  return;
50
69
  };
51
- skuba().catch(handleCliError);
70
+ skuba().catch(import_error.handleCliError);
52
71
  //# sourceMappingURL=skuba.js.map
package/lib/skuba.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/skuba.ts"],
4
- "sourcesContent": ["#!/usr/bin/env node\n\n/**\n * Entry point for the CLI.\n *\n * This is where you end up when you run:\n *\n * ```bash\n * [pnpm|yarn] skuba help\n * ```\n */\n\nimport path from 'path';\n\nimport { parseProcessArgs } from './utils/args.js';\nimport {\n COMMAND_DIR,\n COMMAND_SET,\n type Command,\n commandToModule,\n} from './utils/command.js';\nimport { isCiEnv } from './utils/env.js';\nimport { handleCliError } from './utils/error.js';\nimport { showHelp } from './utils/help.js';\nimport { log } from './utils/logging.js';\nimport { showLogoAndVersionInfo } from './utils/logo.js';\nimport { isObject } from './utils/validation.js';\n\nconst THIRTY_MINUTES = 30 * 60 * 1000;\n\nconst skuba = async () => {\n const { commandName } = parseProcessArgs(process.argv);\n\n if (COMMAND_SET.has(commandName)) {\n const moduleName = commandToModule(commandName as Command);\n\n const commandModule = (await import(\n path.join(COMMAND_DIR, moduleName, 'index.js')\n )) as unknown;\n\n if (!isObject(commandModule) || !(moduleName in commandModule)) {\n log.err(log.bold(commandName), \"couldn't run! Please submit an issue.\");\n process.exitCode = 1;\n return;\n }\n\n const run = commandModule[moduleName] as () => Promise<unknown>;\n\n if (commandModule.longRunning) {\n // This is a long-running command, so we don't want to impose a timeout.\n return run();\n }\n\n // If we're not in a CI environment, we don't need to worry about timeouts, which are primarily to prevent\n // builds running \"forever\" in CI without our knowledge.\n // Local commands may run for a long time, e.g. `skuba start` or `skuba test --watch`, which are unlikely to be used in CI.\n if (!isCiEnv() || process.env.SKUBA_NO_TIMEOUT === 'true') {\n return run();\n }\n\n const timeoutId = setTimeout(\n () => {\n log.err(\n log.bold(commandName),\n 'timed out. This may indicate a process hanging - please file an issue.',\n );\n\n // Need to force exit because promises may be hanging so node won't exit on its own.\n process.exit(1);\n },\n process.env.SKUBA_TIMEOUT_MS\n ? parseInt(process.env.SKUBA_TIMEOUT_MS, 10)\n : THIRTY_MINUTES,\n );\n\n return run().finally(() => clearTimeout(timeoutId));\n }\n\n log.err(log.bold(commandName), 'is not recognised as a command.');\n await showLogoAndVersionInfo();\n showHelp();\n\n process.exitCode = 1;\n return;\n};\n\nskuba().catch(handleCliError);\n"],
5
- "mappings": ";AAYA,OAAO,UAAU;AAEjB,SAAS,wBAAwB;AACjC;AAAA,EACE;AAAA,EACA;AAAA,EAEA;AAAA,OACK;AACP,SAAS,eAAe;AACxB,SAAS,sBAAsB;AAC/B,SAAS,gBAAgB;AACzB,SAAS,WAAW;AACpB,SAAS,8BAA8B;AACvC,SAAS,gBAAgB;AAEzB,MAAM,iBAAiB,KAAK,KAAK;AAEjC,MAAM,QAAQ,YAAY;AACxB,QAAM,EAAE,YAAY,IAAI,iBAAiB,QAAQ,IAAI;AAErD,MAAI,YAAY,IAAI,WAAW,GAAG;AAChC,UAAM,aAAa,gBAAgB,WAAsB;AAEzD,UAAM,gBAAiB,MAAM,OAC3B,KAAK,KAAK,aAAa,YAAY,UAAU;AAG/C,QAAI,CAAC,SAAS,aAAa,KAAK,EAAE,cAAc,gBAAgB;AAC9D,UAAI,IAAI,IAAI,KAAK,WAAW,GAAG,uCAAuC;AACtE,cAAQ,WAAW;AACnB;AAAA,IACF;AAEA,UAAM,MAAM,cAAc,UAAU;AAEpC,QAAI,cAAc,aAAa;AAE7B,aAAO,IAAI;AAAA,IACb;AAKA,QAAI,CAAC,QAAQ,KAAK,QAAQ,IAAI,qBAAqB,QAAQ;AACzD,aAAO,IAAI;AAAA,IACb;AAEA,UAAM,YAAY;AAAA,MAChB,MAAM;AACJ,YAAI;AAAA,UACF,IAAI,KAAK,WAAW;AAAA,UACpB;AAAA,QACF;AAGA,gBAAQ,KAAK,CAAC;AAAA,MAChB;AAAA,MACA,QAAQ,IAAI,mBACR,SAAS,QAAQ,IAAI,kBAAkB,EAAE,IACzC;AAAA,IACN;AAEA,WAAO,IAAI,EAAE,QAAQ,MAAM,aAAa,SAAS,CAAC;AAAA,EACpD;AAEA,MAAI,IAAI,IAAI,KAAK,WAAW,GAAG,iCAAiC;AAChE,QAAM,uBAAuB;AAC7B,WAAS;AAET,UAAQ,WAAW;AACnB;AACF;AAEA,MAAM,EAAE,MAAM,cAAc;",
6
- "names": []
4
+ "sourcesContent": ["#!/usr/bin/env node\n\n/**\n * Entry point for the CLI.\n *\n * This is where you end up when you run:\n *\n * ```bash\n * [pnpm|yarn] skuba help\n * ```\n */\n\nimport path from 'path';\n\nimport { parseProcessArgs } from './utils/args.js';\nimport {\n COMMAND_DIR,\n COMMAND_SET,\n type Command,\n commandToModule,\n} from './utils/command.js';\nimport { isCiEnv } from './utils/env.js';\nimport { handleCliError } from './utils/error.js';\nimport { showHelp } from './utils/help.js';\nimport { log } from './utils/logging.js';\nimport { showLogoAndVersionInfo } from './utils/logo.js';\nimport { hasProp } from './utils/validation.js';\n\nconst THIRTY_MINUTES = 30 * 60 * 1000;\n\nconst skuba = async () => {\n const { commandName } = parseProcessArgs(process.argv);\n\n if (COMMAND_SET.has(commandName)) {\n const moduleName = commandToModule(commandName as Command);\n\n /* eslint-disable @typescript-eslint/no-require-imports */\n const commandModule = require(\n path.join(COMMAND_DIR, moduleName, 'index.js'),\n ) as unknown;\n\n if (!hasProp(commandModule, moduleName)) {\n log.err(log.bold(commandName), \"couldn't run! Please submit an issue.\");\n process.exitCode = 1;\n return;\n }\n\n const run = commandModule[moduleName] as () => Promise<unknown>;\n\n if (commandModule.longRunning) {\n // This is a long-running command, so we don't want to impose a timeout.\n return run();\n }\n\n // If we're not in a CI environment, we don't need to worry about timeouts, which are primarily to prevent\n // builds running \"forever\" in CI without our knowledge.\n // Local commands may run for a long time, e.g. `skuba start` or `skuba test --watch`, which are unlikely to be used in CI.\n if (!isCiEnv() || process.env.SKUBA_NO_TIMEOUT === 'true') {\n return run();\n }\n\n const timeoutId = setTimeout(\n () => {\n log.err(\n log.bold(commandName),\n 'timed out. This may indicate a process hanging - please file an issue.',\n );\n\n // Need to force exit because promises may be hanging so node won't exit on its own.\n process.exit(1);\n },\n process.env.SKUBA_TIMEOUT_MS\n ? parseInt(process.env.SKUBA_TIMEOUT_MS, 10)\n : THIRTY_MINUTES,\n );\n\n return run().finally(() => clearTimeout(timeoutId));\n }\n\n log.err(log.bold(commandName), 'is not recognised as a command.');\n await showLogoAndVersionInfo();\n showHelp();\n\n process.exitCode = 1;\n return;\n};\n\nskuba().catch(handleCliError);\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAYA,kBAAiB;AAEjB,kBAAiC;AACjC,qBAKO;AACP,iBAAwB;AACxB,mBAA+B;AAC/B,kBAAyB;AACzB,qBAAoB;AACpB,kBAAuC;AACvC,wBAAwB;AAExB,MAAM,iBAAiB,KAAK,KAAK;AAEjC,MAAM,QAAQ,YAAY;AACxB,QAAM,EAAE,YAAY,QAAI,8BAAiB,QAAQ,IAAI;AAErD,MAAI,2BAAY,IAAI,WAAW,GAAG;AAChC,UAAM,iBAAa,gCAAgB,WAAsB;AAGzD,UAAM,gBAAgB,QACpB,YAAAA,QAAK,KAAK,4BAAa,YAAY,UAAU,CAC/C;AAEA,QAAI,KAAC,2BAAQ,eAAe,UAAU,GAAG;AACvC,yBAAI,IAAI,mBAAI,KAAK,WAAW,GAAG,uCAAuC;AACtE,cAAQ,WAAW;AACnB;AAAA,IACF;AAEA,UAAM,MAAM,cAAc,UAAU;AAEpC,QAAI,cAAc,aAAa;AAE7B,aAAO,IAAI;AAAA,IACb;AAKA,QAAI,KAAC,oBAAQ,KAAK,QAAQ,IAAI,qBAAqB,QAAQ;AACzD,aAAO,IAAI;AAAA,IACb;AAEA,UAAM,YAAY;AAAA,MAChB,MAAM;AACJ,2BAAI;AAAA,UACF,mBAAI,KAAK,WAAW;AAAA,UACpB;AAAA,QACF;AAGA,gBAAQ,KAAK,CAAC;AAAA,MAChB;AAAA,MACA,QAAQ,IAAI,mBACR,SAAS,QAAQ,IAAI,kBAAkB,EAAE,IACzC;AAAA,IACN;AAEA,WAAO,IAAI,EAAE,QAAQ,MAAM,aAAa,SAAS,CAAC;AAAA,EACpD;AAEA,qBAAI,IAAI,mBAAI,KAAK,WAAW,GAAG,iCAAiC;AAChE,YAAM,oCAAuB;AAC7B,4BAAS;AAET,UAAQ,WAAW;AACnB;AACF;AAEA,MAAM,EAAE,MAAM,2BAAc;",
6
+ "names": ["path"]
7
7
  }