skuba 14.0.0-replace-global-vars-20251121010036 → 14.0.0-tsdown-package-templates-20251225094805

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 (415) 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.d.ts +0 -9
  19. package/lib/cli/build/assets.js +57 -45
  20. package/lib/cli/build/assets.js.map +3 -3
  21. package/lib/cli/build/esbuild.js +45 -21
  22. package/lib/cli/build/esbuild.js.map +2 -2
  23. package/lib/cli/build/index.js +45 -21
  24. package/lib/cli/build/index.js.map +1 -1
  25. package/lib/cli/build/tsc.js +59 -22
  26. package/lib/cli/build/tsc.js.map +2 -2
  27. package/lib/cli/configure/analyseConfiguration.js +50 -16
  28. package/lib/cli/configure/analyseConfiguration.js.map +2 -2
  29. package/lib/cli/configure/analyseDependencies.d.ts +1 -1
  30. package/lib/cli/configure/analyseDependencies.js +59 -25
  31. package/lib/cli/configure/analyseDependencies.js.map +3 -3
  32. package/lib/cli/configure/analysis/diff.js +29 -5
  33. package/lib/cli/configure/analysis/diff.js.map +1 -1
  34. package/lib/cli/configure/analysis/files.js +42 -8
  35. package/lib/cli/configure/analysis/files.js.map +2 -2
  36. package/lib/cli/configure/analysis/git.js +46 -12
  37. package/lib/cli/configure/analysis/git.js.map +2 -2
  38. package/lib/cli/configure/analysis/package.d.ts +3 -2
  39. package/lib/cli/configure/analysis/package.js +45 -10
  40. package/lib/cli/configure/analysis/package.js.map +3 -3
  41. package/lib/cli/configure/analysis/project.js +50 -18
  42. package/lib/cli/configure/analysis/project.js.map +2 -2
  43. package/lib/cli/configure/dependencies/index.js +35 -7
  44. package/lib/cli/configure/dependencies/index.js.map +1 -1
  45. package/lib/cli/configure/dependencies/seekDatadogCustomMetrics.js +28 -4
  46. package/lib/cli/configure/dependencies/seekDatadogCustomMetrics.js.map +1 -1
  47. package/lib/cli/configure/dependencies/seekKoala.js +28 -4
  48. package/lib/cli/configure/dependencies/seekKoala.js.map +1 -1
  49. package/lib/cli/configure/dependencies/skuba.js +28 -4
  50. package/lib/cli/configure/dependencies/skuba.js.map +1 -1
  51. package/lib/cli/configure/dependencies/skubaDeps.js +26 -2
  52. package/lib/cli/configure/dependencies/skubaDeps.js.map +1 -1
  53. package/lib/cli/configure/dependencies/skubaDive.js +29 -4
  54. package/lib/cli/configure/dependencies/skubaDive.js.map +1 -1
  55. package/lib/cli/configure/ensureTemplateCompletion.d.ts +1 -1
  56. package/lib/cli/configure/ensureTemplateCompletion.js +61 -33
  57. package/lib/cli/configure/ensureTemplateCompletion.js.map +3 -3
  58. package/lib/cli/configure/getEntryPoint.d.ts +1 -1
  59. package/lib/cli/configure/getEntryPoint.js +48 -14
  60. package/lib/cli/configure/getEntryPoint.js.map +3 -3
  61. package/lib/cli/configure/getProjectType.d.ts +1 -1
  62. package/lib/cli/configure/getProjectType.js +35 -14
  63. package/lib/cli/configure/getProjectType.js.map +2 -2
  64. package/lib/cli/configure/index.js +84 -50
  65. package/lib/cli/configure/index.js.map +2 -2
  66. package/lib/cli/configure/modules/eslint.js +34 -10
  67. package/lib/cli/configure/modules/eslint.js.map +1 -1
  68. package/lib/cli/configure/modules/ignore.js +32 -8
  69. package/lib/cli/configure/modules/ignore.js.map +1 -1
  70. package/lib/cli/configure/modules/index.js +44 -18
  71. package/lib/cli/configure/modules/index.js.map +2 -2
  72. package/lib/cli/configure/modules/jest.d.ts +2 -0
  73. package/lib/cli/configure/modules/jest.js +86 -0
  74. package/lib/cli/configure/modules/jest.js.map +7 -0
  75. package/lib/cli/configure/modules/nodemon.js +28 -4
  76. package/lib/cli/configure/modules/nodemon.js.map +1 -1
  77. package/lib/cli/configure/modules/package.js +34 -10
  78. package/lib/cli/configure/modules/package.js.map +1 -1
  79. package/lib/cli/configure/modules/prettier.js +35 -11
  80. package/lib/cli/configure/modules/prettier.js.map +1 -1
  81. package/lib/cli/configure/modules/renovate.js +40 -17
  82. package/lib/cli/configure/modules/renovate.js.map +2 -2
  83. package/lib/cli/configure/modules/serverless.js +26 -2
  84. package/lib/cli/configure/modules/serverless.js.map +1 -1
  85. package/lib/cli/configure/modules/tslint.js +28 -4
  86. package/lib/cli/configure/modules/tslint.js.map +1 -1
  87. package/lib/cli/configure/processing/configFile.js +39 -3
  88. package/lib/cli/configure/processing/configFile.js.map +1 -1
  89. package/lib/cli/configure/processing/deleteFiles.js +26 -2
  90. package/lib/cli/configure/processing/deleteFiles.js.map +1 -1
  91. package/lib/cli/configure/processing/javascript.js +27 -2
  92. package/lib/cli/configure/processing/javascript.js.map +1 -1
  93. package/lib/cli/configure/processing/json.js +31 -6
  94. package/lib/cli/configure/processing/json.js.map +1 -1
  95. package/lib/cli/configure/processing/loadFiles.js +26 -2
  96. package/lib/cli/configure/processing/loadFiles.js.map +1 -1
  97. package/lib/cli/configure/processing/module.js +28 -4
  98. package/lib/cli/configure/processing/module.js.map +1 -1
  99. package/lib/cli/configure/processing/package.d.ts +67 -1
  100. package/lib/cli/configure/processing/package.js +45 -8
  101. package/lib/cli/configure/processing/package.js.map +3 -3
  102. package/lib/cli/configure/processing/prettier.js +38 -4
  103. package/lib/cli/configure/processing/prettier.js.map +2 -2
  104. package/lib/cli/configure/processing/record.js +41 -5
  105. package/lib/cli/configure/processing/record.js.map +2 -2
  106. package/lib/cli/configure/processing/typescript.js +63 -26
  107. package/lib/cli/configure/processing/typescript.js.map +2 -2
  108. package/lib/cli/configure/types.d.ts +4 -15
  109. package/lib/cli/configure/types.js +16 -0
  110. package/lib/cli/configure/types.js.map +3 -3
  111. package/lib/cli/format/index.js +44 -20
  112. package/lib/cli/format/index.js.map +1 -1
  113. package/lib/cli/help/index.js +30 -6
  114. package/lib/cli/help/index.js.map +1 -1
  115. package/lib/cli/init/getConfig.d.ts +1 -1
  116. package/lib/cli/init/getConfig.js +100 -74
  117. package/lib/cli/init/getConfig.js.map +3 -3
  118. package/lib/cli/init/git.js +51 -16
  119. package/lib/cli/init/git.js.map +2 -2
  120. package/lib/cli/init/index.js +98 -67
  121. package/lib/cli/init/index.js.map +2 -2
  122. package/lib/cli/init/prompts.d.ts +4 -4
  123. package/lib/cli/init/prompts.js +48 -27
  124. package/lib/cli/init/prompts.js.map +2 -2
  125. package/lib/cli/init/types.js +41 -7
  126. package/lib/cli/init/types.js.map +1 -1
  127. package/lib/cli/init/validation.js +30 -2
  128. package/lib/cli/init/validation.js.map +1 -1
  129. package/lib/cli/init/writePackageJson.js +42 -8
  130. package/lib/cli/init/writePackageJson.js.map +2 -2
  131. package/lib/cli/lint/annotate/buildkite/eslint.js +37 -3
  132. package/lib/cli/lint/annotate/buildkite/eslint.js.map +1 -1
  133. package/lib/cli/lint/annotate/buildkite/index.js +45 -11
  134. package/lib/cli/lint/annotate/buildkite/index.js.map +1 -1
  135. package/lib/cli/lint/annotate/buildkite/internal.js +37 -3
  136. package/lib/cli/lint/annotate/buildkite/internal.js.map +1 -1
  137. package/lib/cli/lint/annotate/buildkite/prettier.js +37 -3
  138. package/lib/cli/lint/annotate/buildkite/prettier.js.map +1 -1
  139. package/lib/cli/lint/annotate/buildkite/tsc.js +37 -3
  140. package/lib/cli/lint/annotate/buildkite/tsc.js.map +1 -1
  141. package/lib/cli/lint/annotate/github/eslint.js +26 -2
  142. package/lib/cli/lint/annotate/github/eslint.js.map +1 -1
  143. package/lib/cli/lint/annotate/github/index.js +45 -11
  144. package/lib/cli/lint/annotate/github/index.js.map +1 -1
  145. package/lib/cli/lint/annotate/github/internal.js +26 -2
  146. package/lib/cli/lint/annotate/github/internal.js.map +1 -1
  147. package/lib/cli/lint/annotate/github/prettier.js +26 -2
  148. package/lib/cli/lint/annotate/github/prettier.js.map +1 -1
  149. package/lib/cli/lint/annotate/github/tsc.js +28 -4
  150. package/lib/cli/lint/annotate/github/tsc.js.map +2 -2
  151. package/lib/cli/lint/annotate/index.js +30 -6
  152. package/lib/cli/lint/annotate/index.js.map +1 -1
  153. package/lib/cli/lint/autofix.js +73 -37
  154. package/lib/cli/lint/autofix.js.map +1 -1
  155. package/lib/cli/lint/eslint.js +51 -16
  156. package/lib/cli/lint/eslint.js.map +3 -3
  157. package/lib/cli/lint/external.js +51 -19
  158. package/lib/cli/lint/external.js.map +2 -2
  159. package/lib/cli/lint/index.js +49 -25
  160. package/lib/cli/lint/index.js.map +1 -1
  161. package/lib/cli/lint/internal.js +42 -18
  162. package/lib/cli/lint/internal.js.map +1 -1
  163. package/lib/cli/lint/internalLints/detectBadCodeowners.js +33 -8
  164. package/lib/cli/lint/internalLints/detectBadCodeowners.js.map +1 -1
  165. package/lib/cli/lint/internalLints/noSkubaTemplateJs.js +45 -11
  166. package/lib/cli/lint/internalLints/noSkubaTemplateJs.js.map +2 -2
  167. package/lib/cli/lint/internalLints/patchRenovateConfig.js +55 -21
  168. package/lib/cli/lint/internalLints/patchRenovateConfig.js.map +2 -2
  169. package/lib/cli/lint/internalLints/refreshConfigFiles.js +63 -32
  170. package/lib/cli/lint/internalLints/refreshConfigFiles.js.map +2 -2
  171. package/lib/cli/lint/internalLints/upgrade/index.d.ts +1 -1
  172. package/lib/cli/lint/internalLints/upgrade/index.js +53 -22
  173. package/lib/cli/lint/internalLints/upgrade/index.js.map +3 -3
  174. package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/index.js +28 -4
  175. package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/index.js.map +1 -1
  176. package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/removeYarnIgnoreOptionalFlags.js +45 -11
  177. package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/removeYarnIgnoreOptionalFlags.js.map +2 -2
  178. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/index.js +30 -6
  179. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/index.js.map +1 -1
  180. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/migrateNpmrcToPnpmWorkspace.js +65 -34
  181. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/migrateNpmrcToPnpmWorkspace.js.map +2 -2
  182. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/stopBundlingInCDKTests.js +46 -11
  183. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/stopBundlingInCDKTests.js.map +2 -2
  184. package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/index.js +28 -4
  185. package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/index.js.map +1 -1
  186. package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/unhandledRejections.js +59 -23
  187. package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/unhandledRejections.js.map +2 -2
  188. package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/index.js +28 -4
  189. package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/index.js.map +1 -1
  190. package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/patchJestSnapshots.js +46 -11
  191. package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/patchJestSnapshots.js.map +2 -2
  192. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/index.js +30 -6
  193. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/index.js.map +1 -1
  194. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchApiTokenFromEnvironment.js +46 -11
  195. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchApiTokenFromEnvironment.js.map +2 -2
  196. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchDockerfileSyntaxDirective.js +46 -11
  197. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchDockerfileSyntaxDirective.js.map +2 -2
  198. package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/index.js +28 -4
  199. package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/index.js.map +1 -1
  200. package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/patchDockerfileCIVariable.js +46 -11
  201. package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/patchDockerfileCIVariable.js.map +2 -2
  202. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/configureTsConfigForESM.js +67 -29
  203. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/configureTsConfigForESM.js.map +2 -2
  204. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/index.js +34 -10
  205. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/index.js.map +1 -1
  206. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/patchApiDockerfiles.js +45 -11
  207. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/patchApiDockerfiles.js.map +2 -2
  208. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/rewriteSrcImports.d.ts +0 -4
  209. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/rewriteSrcImports.js +63 -18
  210. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/rewriteSrcImports.js.map +3 -3
  211. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/updateLambdaConfigs.js +50 -15
  212. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/updateLambdaConfigs.js.map +2 -2
  213. package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/index.js +40 -0
  214. package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/index.js.map +7 -0
  215. package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/patchRootTsconfig.d.ts +3 -0
  216. package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/patchRootTsconfig.js +133 -0
  217. package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/patchRootTsconfig.js.map +7 -0
  218. package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/upgradeNode.js +55 -0
  219. package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/upgradeNode.js.map +7 -0
  220. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/addEmptyExports.js +51 -17
  221. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/addEmptyExports.js.map +2 -2
  222. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/index.js +34 -10
  223. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/index.js.map +1 -1
  224. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchDockerfile.js +44 -10
  225. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchDockerfile.js.map +2 -2
  226. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchServerListener.js +46 -12
  227. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchServerListener.js.map +2 -2
  228. package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/index.js +28 -4
  229. package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/index.js.map +1 -1
  230. package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/patchPnpmPackageManager.js +49 -15
  231. package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/patchPnpmPackageManager.js.map +2 -2
  232. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/collapseDuplicateMergeKeys.js +45 -11
  233. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/collapseDuplicateMergeKeys.js.map +2 -2
  234. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/index.js +34 -10
  235. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/index.js.map +1 -1
  236. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/moveNpmrcMounts.js +45 -11
  237. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/moveNpmrcMounts.js.map +2 -2
  238. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerCompose.js +45 -11
  239. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerCompose.js.map +2 -2
  240. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerImages.js +47 -13
  241. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerImages.js.map +2 -2
  242. package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/index.js +28 -4
  243. package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/index.js.map +1 -1
  244. package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/patchPnpmDockerImages.js +45 -11
  245. package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/patchPnpmDockerImages.js.map +2 -2
  246. package/lib/cli/lint/prettier.js +50 -15
  247. package/lib/cli/lint/prettier.js.map +3 -3
  248. package/lib/cli/lint/tsc.js +28 -4
  249. package/lib/cli/lint/tsc.js.map +1 -1
  250. package/lib/cli/lint/types.js +16 -0
  251. package/lib/cli/lint/types.js.map +3 -3
  252. package/lib/cli/migrate/index.d.ts +5 -0
  253. package/lib/cli/migrate/index.js +79 -15
  254. package/lib/cli/migrate/index.js.map +2 -2
  255. package/lib/cli/migrate/nodeVersion/checks.d.ts +1 -14
  256. package/lib/cli/migrate/nodeVersion/checks.js +51 -120
  257. package/lib/cli/migrate/nodeVersion/checks.js.map +2 -2
  258. package/lib/cli/migrate/nodeVersion/index.d.ts +8 -2
  259. package/lib/cli/migrate/nodeVersion/index.js +239 -65
  260. package/lib/cli/migrate/nodeVersion/index.js.map +3 -3
  261. package/lib/cli/migrate/nodeVersion/upgrade.d.ts +8 -0
  262. package/lib/cli/migrate/nodeVersion/upgrade.js +179 -0
  263. package/lib/cli/migrate/nodeVersion/upgrade.js.map +7 -0
  264. package/lib/cli/node/index.js +57 -20
  265. package/lib/cli/node/index.js.map +3 -3
  266. package/lib/cli/release/index.js +28 -4
  267. package/lib/cli/release/index.js.map +1 -1
  268. package/lib/cli/start/index.js +50 -16
  269. package/lib/cli/start/index.js.map +3 -3
  270. package/lib/cli/test/index.js +44 -4
  271. package/lib/cli/test/index.js.map +2 -2
  272. package/lib/cli/test/reporters/github/annotations.d.ts +9 -0
  273. package/lib/cli/test/reporters/github/annotations.js +102 -0
  274. package/lib/cli/test/reporters/github/annotations.js.map +7 -0
  275. package/lib/cli/test/reporters/github/index.d.ts +5 -0
  276. package/lib/cli/test/reporters/github/index.js +74 -0
  277. package/lib/cli/test/reporters/github/index.js.map +7 -0
  278. package/lib/cli/version/index.js +30 -6
  279. package/lib/cli/version/index.js.map +1 -1
  280. package/lib/index.d.ts +1 -0
  281. package/lib/index.js +46 -6
  282. package/lib/index.js.map +2 -2
  283. package/lib/skuba.js +45 -26
  284. package/lib/skuba.js.map +3 -3
  285. package/lib/utils/args.js +43 -6
  286. package/lib/utils/args.js.map +2 -2
  287. package/lib/utils/command.js +42 -4
  288. package/lib/utils/command.js.map +3 -3
  289. package/lib/utils/copy.js +57 -20
  290. package/lib/utils/copy.js.map +2 -2
  291. package/lib/utils/dir.js +72 -32
  292. package/lib/utils/dir.js.map +2 -2
  293. package/lib/utils/env.js +26 -2
  294. package/lib/utils/env.js.map +1 -1
  295. package/lib/utils/error.js +47 -10
  296. package/lib/utils/error.js.map +1 -1
  297. package/lib/utils/exec.js +61 -23
  298. package/lib/utils/exec.js.map +3 -3
  299. package/lib/utils/fs.js +40 -6
  300. package/lib/utils/fs.js.map +2 -2
  301. package/lib/utils/help.js +30 -6
  302. package/lib/utils/help.js.map +1 -1
  303. package/lib/utils/logging.js +38 -11
  304. package/lib/utils/logging.js.map +1 -1
  305. package/lib/utils/logo.js +48 -24
  306. package/lib/utils/logo.js.map +1 -1
  307. package/lib/utils/manifest.d.ts +2 -3
  308. package/lib/utils/manifest.js +48 -8
  309. package/lib/utils/manifest.js.map +3 -3
  310. package/lib/utils/npmrc.js +26 -2
  311. package/lib/utils/npmrc.js.map +1 -1
  312. package/lib/utils/packageManager.js +49 -12
  313. package/lib/utils/packageManager.js.map +2 -2
  314. package/lib/utils/port.js +39 -4
  315. package/lib/utils/port.js.map +2 -2
  316. package/lib/utils/sleep.js +26 -2
  317. package/lib/utils/sleep.js.map +1 -1
  318. package/lib/utils/template.js +55 -18
  319. package/lib/utils/template.js.map +3 -3
  320. package/lib/utils/validation.js +31 -2
  321. package/lib/utils/validation.js.map +1 -1
  322. package/lib/utils/version.js +46 -9
  323. package/lib/utils/version.js.map +2 -2
  324. package/lib/utils/wait.js +32 -7
  325. package/lib/utils/wait.js.map +1 -1
  326. package/lib/utils/worker.js +35 -10
  327. package/lib/utils/worker.js.map +1 -1
  328. package/lib/wrapper/function-arguments.d.js +1 -0
  329. package/lib/wrapper/functionHandler.js +49 -18
  330. package/lib/wrapper/functionHandler.js.map +2 -2
  331. package/lib/wrapper/http.js +43 -8
  332. package/lib/wrapper/http.js.map +2 -2
  333. package/lib/wrapper/index.js +7 -6
  334. package/lib/wrapper/index.js.map +1 -1
  335. package/lib/wrapper/main.js +42 -8
  336. package/lib/wrapper/main.js.map +3 -3
  337. package/lib/wrapper/requestListener.js +47 -13
  338. package/lib/wrapper/requestListener.js.map +2 -2
  339. package/lib/wrapper/server.js +28 -4
  340. package/lib/wrapper/server.js.map +1 -1
  341. package/package.json +42 -43
  342. package/template/base/_.prettierrc.js +1 -1
  343. package/template/base/_eslint.config.js +1 -1
  344. package/template/base/_pnpm-workspace.yaml +4 -3
  345. package/template/base/jest.config.ts +19 -0
  346. package/template/base/jest.setup.ts +3 -0
  347. package/template/express-rest-api/.buildkite/pipeline.yml +1 -1
  348. package/template/express-rest-api/.nvmrc +1 -1
  349. package/template/express-rest-api/package.json +7 -8
  350. package/template/express-rest-api/skuba.template.js +1 -1
  351. package/template/express-rest-api/src/app.test.ts +0 -1
  352. package/template/greeter/.buildkite/pipeline.yml +1 -1
  353. package/template/greeter/.nvmrc +1 -1
  354. package/template/greeter/package.json +4 -5
  355. package/template/greeter/skuba.template.js +1 -1
  356. package/template/greeter/src/app.test.ts +1 -3
  357. package/template/koa-rest-api/.buildkite/pipeline.yml +1 -1
  358. package/template/koa-rest-api/.nvmrc +1 -1
  359. package/template/koa-rest-api/package.json +8 -10
  360. package/template/koa-rest-api/skuba.template.js +1 -1
  361. package/template/koa-rest-api/src/api/jobs/getJobs.test.ts +0 -2
  362. package/template/koa-rest-api/src/api/jobs/postJob.test.ts +0 -2
  363. package/template/koa-rest-api/src/app.test.ts +0 -2
  364. package/template/koa-rest-api/src/framework/server.test.ts +2 -2
  365. package/template/koa-rest-api/src/framework/validation.test.ts +0 -2
  366. package/template/koa-rest-api/src/testing/metrics.ts +0 -2
  367. package/template/lambda-sqs-worker-cdk/.buildkite/pipeline.yml +2 -2
  368. package/template/lambda-sqs-worker-cdk/.nvmrc +1 -1
  369. package/template/lambda-sqs-worker-cdk/infra/__snapshots__/appStack.test.ts.snap +7 -19
  370. package/template/lambda-sqs-worker-cdk/infra/appStack.test.ts +9 -11
  371. package/template/lambda-sqs-worker-cdk/infra/appStack.ts +3 -3
  372. package/template/lambda-sqs-worker-cdk/infra/config.ts +2 -4
  373. package/template/lambda-sqs-worker-cdk/package.json +9 -9
  374. package/template/lambda-sqs-worker-cdk/skuba.template.js +13 -1
  375. package/template/lambda-sqs-worker-cdk/src/app.test.ts +13 -22
  376. package/template/lambda-sqs-worker-cdk/src/framework/handler.test.ts +0 -1
  377. package/template/lambda-sqs-worker-cdk/src/framework/validation.test.ts +31 -33
  378. package/template/lambda-sqs-worker-cdk/src/services/jobScorer.test.ts +2 -8
  379. package/template/lambda-sqs-worker-cdk/src/services/pipelineEventSender.test.ts +2 -3
  380. package/template/lambda-sqs-worker-cdk/src/testing/services.ts +3 -4
  381. package/template/oss-npm-package/.github/workflows/release.yml +1 -1
  382. package/template/oss-npm-package/.github/workflows/validate.yml +1 -1
  383. package/template/oss-npm-package/.nvmrc +1 -1
  384. package/template/oss-npm-package/_package.json +10 -3
  385. package/template/oss-npm-package/skuba.template.js +1 -1
  386. package/template/oss-npm-package/src/index.test.ts +0 -2
  387. package/template/oss-npm-package/tsconfig.json +2 -1
  388. package/template/oss-npm-package/tsdown.config.ts +11 -0
  389. package/template/private-npm-package/.nvmrc +1 -1
  390. package/template/private-npm-package/_package.json +11 -4
  391. package/template/private-npm-package/skuba.template.js +2 -2
  392. package/template/private-npm-package/src/index.test.ts +0 -2
  393. package/template/private-npm-package/tsconfig.json +2 -1
  394. package/template/private-npm-package/tsdown.config.ts +11 -0
  395. package/lib/cli/buildPackage/index.d.ts +0 -1
  396. package/lib/cli/buildPackage/index.js +0 -43
  397. package/lib/cli/buildPackage/index.js.map +0 -7
  398. package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/addTypeModuleToPackageJson.d.ts +0 -6
  399. package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/addTypeModuleToPackageJson.js +0 -86
  400. package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/addTypeModuleToPackageJson.js.map +0 -7
  401. package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/index.js +0 -16
  402. package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/index.js.map +0 -7
  403. package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/rewriteGlobalVars.d.ts +0 -7
  404. package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/rewriteGlobalVars.js +0 -76
  405. package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/rewriteGlobalVars.js.map +0 -7
  406. package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/index.d.ts +0 -2
  407. package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/index.js +0 -11
  408. package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/index.js.map +0 -7
  409. package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/upgradeNode.js +0 -34
  410. package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/upgradeNode.js.map +0 -7
  411. package/lib/eslint.d.js +0 -1
  412. package/lib/eslint.d.js.map +0 -7
  413. package/template/base/vitest.config.ts +0 -25
  414. /package/lib/cli/lint/internalLints/upgrade/patches/{12.5.0 → 13.1.1}/index.d.ts +0 -0
  415. /package/lib/cli/lint/internalLints/upgrade/patches/{9.1.0 → 13.1.1}/upgradeNode.d.ts +0 -0
@@ -1,136 +1,67 @@
1
- import findUp from "find-up";
2
- import fs from "fs-extra";
3
- import { coerce, lte, satisfies } from "semver";
4
- import * as z from "zod/v4";
5
- import { log } from "../../../utils/logging.js";
6
- const getParentFile = async (file, cwd = process.cwd()) => {
7
- const path = await findUp(file, { cwd });
8
- if (!path) {
9
- return void 0;
10
- }
11
- return {
12
- fileContent: await fs.readFile(path, "utf-8"),
13
- path
14
- };
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 });
15
9
  };
16
- const extractFromParentPackageJson = async (schema, currentPath) => {
17
- const file = await getParentFile("package.json", currentPath);
18
- if (!file) {
19
- return { packageJson: void 0, packageJsonRelativePath: void 0 };
20
- }
21
- const { fileContent: packageJson, path } = file;
22
- let rawJSON;
23
- try {
24
- rawJSON = JSON.parse(packageJson);
25
- } catch {
26
- throw new Error(`${path} is not valid JSON`);
27
- }
28
- const result = schema.safeParse(rawJSON);
29
- if (!result.success) {
30
- return { packageJson: void 0, packageJsonRelativePath: path };
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 });
31
15
  }
32
- return { packageJson: result.data, packageJsonRelativePath: path };
16
+ return to;
33
17
  };
34
- const isPatchableServerlessVersion = async (currentPath) => {
35
- const { packageJson, packageJsonRelativePath } = await extractFromParentPackageJson(
36
- z.object({
37
- devDependencies: z.object({
38
- serverless: z.string().optional()
39
- })
40
- }),
41
- currentPath
42
- );
43
- if (!packageJson) {
44
- log.warn("package.json not found, ensure it is in the correct location");
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var checks_exports = {};
20
+ __export(checks_exports, {
21
+ isLikelyPackage: () => isLikelyPackage
22
+ });
23
+ module.exports = __toCommonJS(checks_exports);
24
+ var import_logging = require("../../../utils/logging.js");
25
+ var import_manifest = require("../../../utils/manifest.js");
26
+ const isLikelyPackage = async (currentPath) => {
27
+ const nearestPackageJsonResult = await (0, import_manifest.getConsumerManifest)(currentPath);
28
+ if (!nearestPackageJsonResult) {
29
+ import_logging.log.warn("package.json not found");
45
30
  return false;
46
31
  }
47
- const serverlessVersion = packageJson?.devDependencies.serverless;
48
- if (!serverlessVersion) {
49
- log.subtle(
50
- `Serverless version not found in ${packageJsonRelativePath}, assuming it is not a dependency`
51
- );
32
+ const { packageJson } = nearestPackageJsonResult;
33
+ const type = packageJson.skuba?.type;
34
+ if (type === "application") {
35
+ return false;
36
+ }
37
+ if (type === "package") {
52
38
  return true;
53
39
  }
54
- if (!satisfies(serverlessVersion, "4.x.x")) {
55
- log.warn(
56
- `Serverless version ${serverlessVersion} cannot be migrated; use Serverless 4.x to automatically migrate Serverless files`
57
- );
58
- return false;
40
+ if (typeof packageJson.sideEffects === "boolean") {
41
+ return true;
59
42
  }
60
- log.ok(
61
- `Proceeding with migration of Serverless version ${serverlessVersion}`
62
- );
63
- return true;
64
- };
65
- const isPatchableSkubaType = async (currentPath) => {
66
- const { packageJson, packageJsonRelativePath } = await extractFromParentPackageJson(
67
- z.object({
68
- skuba: z.object({
69
- type: z.string().optional()
70
- }).optional(),
71
- files: z.string().array().optional()
72
- }),
73
- currentPath
74
- );
75
- if (!packageJson) {
76
- log.warn("package.json not found, ensure it is in the correct location");
77
- return false;
43
+ if (typeof packageJson.types === "string" && typeof packageJson.module === "string" && typeof packageJson.main === "string") {
44
+ return true;
78
45
  }
79
- if (packageJson.files) {
80
- log.warn(
81
- "Migrations are not supported for packages; update manually to ensure major runtime deprecations are intended"
82
- );
83
- return false;
46
+ if (typeof packageJson.exports === "object") {
47
+ return true;
84
48
  }
85
- const type = packageJson?.skuba?.type;
86
- if (!type) {
87
- log.warn(
88
- `skuba project type not found in ${packageJsonRelativePath}; add a package.json#/skuba/type to ensure the correct migration can be applied`
89
- );
49
+ if (packageJson.private === true) {
90
50
  return false;
91
51
  }
92
- if (type === "package") {
93
- log.warn(
94
- "Migrations are not supported for packages; update manually to ensure major runtime deprecations are intended"
95
- );
96
- return false;
52
+ if (packageJson.publishConfig) {
53
+ return true;
97
54
  }
98
- log.ok(`Proceeding with migration of skuba project type ${type}`);
99
- return true;
100
- };
101
- const isPatchableNodeVersion = async (targetNodeVersion, currentPath) => {
102
- const nvmrcFile = await getParentFile(".nvmrc");
103
- const nodeVersionFile = await getParentFile(".node-version");
104
- const { packageJson } = await extractFromParentPackageJson(
105
- z.object({
106
- engines: z.object({
107
- node: z.string()
108
- })
109
- }),
110
- currentPath
111
- );
112
- const nvmrcNodeVersion = nvmrcFile?.fileContent;
113
- const nodeVersion = nodeVersionFile?.fileContent;
114
- const engineVersion = packageJson?.engines.node;
115
- const currentNodeVersion = nvmrcNodeVersion || nodeVersion || engineVersion;
116
- const coercedTargetVersion = coerce(targetNodeVersion.toString())?.version;
117
- const coercedCurrentVersion = coerce(currentNodeVersion)?.version;
118
- const isNodeVersionValid = coercedTargetVersion && coercedCurrentVersion && lte(coercedCurrentVersion, coercedTargetVersion);
119
- if (!isNodeVersionValid) {
120
- log.warn(
121
- `Node.js version ${coercedCurrentVersion ?? "unknown"} cannot be migrated to ${coercedTargetVersion}`
122
- );
123
- return false;
55
+ if (typeof packageJson.types === "string") {
56
+ return true;
124
57
  }
125
- log.ok(
126
- `Proceeding with migration from Node.js ${coercedCurrentVersion} to ${coercedTargetVersion}`
127
- );
128
- return true;
129
- };
130
- export {
131
- extractFromParentPackageJson,
132
- isPatchableNodeVersion,
133
- isPatchableServerlessVersion,
134
- isPatchableSkubaType
58
+ if (typeof packageJson.module === "string") {
59
+ return true;
60
+ }
61
+ return false;
135
62
  };
63
+ // Annotate the CommonJS export names for ESM import in node:
64
+ 0 && (module.exports = {
65
+ isLikelyPackage
66
+ });
136
67
  //# sourceMappingURL=checks.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/cli/migrate/nodeVersion/checks.ts"],
4
- "sourcesContent": ["import findUp from 'find-up';\nimport fs from 'fs-extra';\nimport { coerce, lte, satisfies } from 'semver';\nimport * as z from 'zod/v4';\n\nimport { log } from '../../../utils/logging.js';\n\nconst getParentFile = async (file: string, cwd: string = process.cwd()) => {\n const path = await findUp(file, { cwd });\n if (!path) {\n return undefined;\n }\n return {\n fileContent: await fs.readFile(path, 'utf-8'),\n path,\n };\n};\n\nexport const extractFromParentPackageJson = async <T extends z.ZodRawShape>(\n schema: z.ZodObject<T>,\n currentPath: string,\n) => {\n const file = await getParentFile('package.json', currentPath);\n if (!file) {\n return { packageJson: undefined, packageJsonRelativePath: undefined };\n }\n const { fileContent: packageJson, path } = file;\n let rawJSON;\n try {\n rawJSON = JSON.parse(packageJson) as unknown;\n } catch {\n throw new Error(`${path} is not valid JSON`);\n }\n const result = schema.safeParse(rawJSON);\n if (!result.success) {\n return { packageJson: undefined, packageJsonRelativePath: path };\n }\n\n return { packageJson: result.data, packageJsonRelativePath: path };\n};\n\nexport const isPatchableServerlessVersion = async (\n currentPath: string,\n): Promise<boolean> => {\n const { packageJson, packageJsonRelativePath } =\n await extractFromParentPackageJson(\n z.object({\n devDependencies: z.object({\n serverless: z.string().optional(),\n }),\n }),\n currentPath,\n );\n if (!packageJson) {\n log.warn('package.json not found, ensure it is in the correct location');\n return false;\n }\n\n const serverlessVersion = packageJson?.devDependencies.serverless;\n\n if (!serverlessVersion) {\n log.subtle(\n `Serverless version not found in ${packageJsonRelativePath}, assuming it is not a dependency`,\n );\n return true;\n }\n\n if (!satisfies(serverlessVersion, '4.x.x')) {\n log.warn(\n `Serverless version ${serverlessVersion} cannot be migrated; use Serverless 4.x to automatically migrate Serverless files`,\n );\n return false;\n }\n\n log.ok(\n `Proceeding with migration of Serverless version ${serverlessVersion}`,\n );\n return true;\n};\n\nexport const isPatchableSkubaType = async (\n currentPath: string,\n): Promise<boolean> => {\n const { packageJson, packageJsonRelativePath } =\n await extractFromParentPackageJson(\n z.object({\n skuba: z\n .object({\n type: z.string().optional(),\n })\n .optional(),\n files: z.string().array().optional(),\n }),\n currentPath,\n );\n\n if (!packageJson) {\n log.warn('package.json not found, ensure it is in the correct location');\n return false;\n }\n\n if (packageJson.files) {\n log.warn(\n 'Migrations are not supported for packages; update manually to ensure major runtime deprecations are intended',\n );\n return false;\n }\n\n const type = packageJson?.skuba?.type;\n\n if (!type) {\n log.warn(\n `skuba project type not found in ${packageJsonRelativePath}; add a package.json#/skuba/type to ensure the correct migration can be applied`,\n );\n return false;\n }\n if (type === 'package') {\n log.warn(\n 'Migrations are not supported for packages; update manually to ensure major runtime deprecations are intended',\n );\n return false;\n }\n\n log.ok(`Proceeding with migration of skuba project type ${type}`);\n return true;\n};\n\nexport const isPatchableNodeVersion = async (\n targetNodeVersion: number,\n currentPath: string,\n): Promise<boolean> => {\n const nvmrcFile = await getParentFile('.nvmrc');\n const nodeVersionFile = await getParentFile('.node-version');\n const { packageJson } = await extractFromParentPackageJson(\n z.object({\n engines: z.object({\n node: z.string(),\n }),\n }),\n currentPath,\n );\n\n const nvmrcNodeVersion = nvmrcFile?.fileContent;\n const nodeVersion = nodeVersionFile?.fileContent;\n const engineVersion = packageJson?.engines.node;\n\n const currentNodeVersion = nvmrcNodeVersion || nodeVersion || engineVersion;\n\n const coercedTargetVersion = coerce(targetNodeVersion.toString())?.version;\n const coercedCurrentVersion = coerce(currentNodeVersion)?.version;\n\n const isNodeVersionValid =\n coercedTargetVersion &&\n coercedCurrentVersion &&\n lte(coercedCurrentVersion, coercedTargetVersion);\n\n if (!isNodeVersionValid) {\n log.warn(\n `Node.js version ${coercedCurrentVersion ?? 'unknown'} cannot be migrated to ${coercedTargetVersion}`,\n );\n return false;\n }\n\n log.ok(\n `Proceeding with migration from Node.js ${coercedCurrentVersion} to ${coercedTargetVersion}`,\n );\n return true;\n};\n"],
5
- "mappings": "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",
4
+ "sourcesContent": ["import { log } from '../../../utils/logging.js';\nimport { getConsumerManifest } from '../../../utils/manifest.js';\nimport type { SkubaPackageJson } from '../../init/writePackageJson.js';\n\nexport const isLikelyPackage = async (\n currentPath: string,\n): Promise<boolean> => {\n const nearestPackageJsonResult = await getConsumerManifest(currentPath);\n if (!nearestPackageJsonResult) {\n log.warn('package.json not found');\n return false;\n }\n\n const { packageJson } = nearestPackageJsonResult;\n\n const type = (packageJson.skuba as SkubaPackageJson)?.type;\n\n if (type === 'application') {\n return false;\n }\n\n if (type === 'package') {\n return true;\n }\n\n if (typeof packageJson.sideEffects === 'boolean') {\n return true;\n }\n\n if (\n typeof packageJson.types === 'string' &&\n typeof packageJson.module === 'string' &&\n typeof packageJson.main === 'string'\n ) {\n return true;\n }\n\n if (typeof packageJson.exports === 'object') {\n return true;\n }\n\n // private true would imply this is either an internal package or application\n if (packageJson.private === true) {\n return false;\n }\n\n if (packageJson.publishConfig) {\n return true;\n }\n\n if (typeof packageJson.types === 'string') {\n return true;\n }\n\n if (typeof packageJson.module === 'string') {\n return true;\n }\n\n return false;\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAoB;AACpB,sBAAoC;AAG7B,MAAM,kBAAkB,OAC7B,gBACqB;AACrB,QAAM,2BAA2B,UAAM,qCAAoB,WAAW;AACtE,MAAI,CAAC,0BAA0B;AAC7B,uBAAI,KAAK,wBAAwB;AACjC,WAAO;AAAA,EACT;AAEA,QAAM,EAAE,YAAY,IAAI;AAExB,QAAM,OAAQ,YAAY,OAA4B;AAEtD,MAAI,SAAS,eAAe;AAC1B,WAAO;AAAA,EACT;AAEA,MAAI,SAAS,WAAW;AACtB,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,YAAY,gBAAgB,WAAW;AAChD,WAAO;AAAA,EACT;AAEA,MACE,OAAO,YAAY,UAAU,YAC7B,OAAO,YAAY,WAAW,YAC9B,OAAO,YAAY,SAAS,UAC5B;AACA,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,YAAY,YAAY,UAAU;AAC3C,WAAO;AAAA,EACT;AAGA,MAAI,YAAY,YAAY,MAAM;AAChC,WAAO;AAAA,EACT;AAEA,MAAI,YAAY,eAAe;AAC7B,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,YAAY,UAAU,UAAU;AACzC,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,YAAY,WAAW,UAAU;AAC1C,WAAO;AAAA,EACT;AAEA,SAAO;AACT;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,10 @@
1
- export declare const nodeVersionMigration: ({ nodeVersion, ECMAScriptVersion, }: {
2
- nodeVersion: number;
1
+ export declare const nodeVersionMigration: ({ nodeVersion, ECMAScriptVersion, packageNodeVersion, packageECMAScriptVersion, infraPackages, }: {
2
+ nodeVersion: string;
3
3
  ECMAScriptVersion: string;
4
+ packageNodeVersion: string;
5
+ packageECMAScriptVersion: string;
6
+ infraPackages: Array<{
7
+ name: string;
8
+ version: string;
9
+ }>;
4
10
  }, dir?: string) => Promise<void>;
@@ -1,88 +1,235 @@
1
- import { inspect } from "util";
2
- import { glob } from "fast-glob";
3
- import fs from "fs-extra";
4
- import { log } from "../../../utils/logging.js";
5
- import { createDestinationFileReader } from "../../configure/analysis/project.js";
6
- import {
7
- isPatchableNodeVersion,
8
- isPatchableServerlessVersion,
9
- isPatchableSkubaType
10
- } from "./checks.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 nodeVersion_exports = {};
30
+ __export(nodeVersion_exports, {
31
+ nodeVersionMigration: () => nodeVersionMigration
32
+ });
33
+ module.exports = __toCommonJS(nodeVersion_exports);
34
+ var import_util = require("util");
35
+ var import_fast_glob = require("fast-glob");
36
+ var import_fs_extra = __toESM(require("fs-extra"));
37
+ var import_semver = require("semver");
38
+ var import_logging = require("../../../utils/logging.js");
39
+ var import_project = require("../../configure/analysis/project.js");
40
+ var import_checks = require("./checks.js");
41
+ var import_upgrade = require("./upgrade.js");
11
42
  const subPatches = ({
12
43
  nodeVersion,
13
- ECMAScriptVersion
44
+ ECMAScriptVersion,
45
+ packageECMAScriptVersion,
46
+ packageNodeVersion
14
47
  }) => [
15
- { file: ".nvmrc", replace: `${nodeVersion}
16
- ` },
17
48
  {
49
+ type: "nodejs",
50
+ file: ".nvmrc",
51
+ regex: () => /.*([0-9.]+).*/gm,
52
+ replace: {
53
+ default: {
54
+ captureGroup: 1,
55
+ string: nodeVersion,
56
+ version: nodeVersion
57
+ }
58
+ }
59
+ },
60
+ {
61
+ type: "nodejs",
18
62
  files: "**/Dockerfile*",
19
63
  regex: () => /^FROM(.*) (public.ecr.aws\/docker\/library\/)?node:([0-9]+(?:\.[0-9]+(?:\.[0-9]+)?)?)(-[a-z0-9]+)?(@sha256:[a-f0-9]{64})?( .*)?$/gm,
20
- replace: `FROM$1 $2node:${nodeVersion}$4$6`
64
+ replace: {
65
+ default: {
66
+ captureGroup: 3,
67
+ string: `FROM$1 $2node:${nodeVersion}$4$6`,
68
+ version: nodeVersion
69
+ }
70
+ }
21
71
  },
22
72
  {
73
+ type: "nodejs",
23
74
  files: "**/Dockerfile*",
24
- regex: () => /^FROM(.*) gcr.io\/distroless\/nodejs\d+-debian(\d+)(@sha256:[a-f0-9]{64})?(\.[^- \n]+)?(-[^ \n]+)?( .+|)$/gm,
25
- replace: `FROM$1 gcr.io/distroless/nodejs${nodeVersion}-debian$2$4$5$6`
75
+ regex: () => /^FROM(.*) gcr.io\/distroless\/nodejs(\d+)-debian(\d+)(@sha256:[a-f0-9]{64})?(\.[^- \n]+)?(-[^ \n]+)?( .+|)$/gm,
76
+ replace: {
77
+ default: {
78
+ captureGroup: 2,
79
+ string: `FROM$1 gcr.io/distroless/nodejs${nodeVersion}-debian$3$6$7`,
80
+ version: nodeVersion
81
+ }
82
+ }
26
83
  },
27
84
  {
85
+ type: "nodejs",
28
86
  files: "**/serverless*.y*ml",
29
- regex: () => /\bnodejs\d+.x\b/gm,
30
- tests: [isPatchableServerlessVersion],
31
- replace: `nodejs${nodeVersion}.x`
87
+ regex: () => /\bnodejs(\d+).x\b/gm,
88
+ replace: {
89
+ default: {
90
+ captureGroup: 1,
91
+ string: `nodejs${nodeVersion}.x`,
92
+ version: nodeVersion
93
+ }
94
+ }
32
95
  },
33
96
  {
97
+ type: "nodejs",
34
98
  files: "**/serverless*.y*ml",
35
- regex: () => /\bnode\d+\b/gm,
36
- tests: [isPatchableServerlessVersion],
37
- replace: `node${nodeVersion}`
99
+ regex: () => /\bnode(\d+)\b/gm,
100
+ replace: {
101
+ default: {
102
+ captureGroup: 1,
103
+ string: `node${nodeVersion}`,
104
+ version: nodeVersion
105
+ }
106
+ }
38
107
  },
39
108
  {
109
+ type: "nodejs",
40
110
  files: "**/infra/**/*.ts",
41
- regex: () => /NODEJS_\d+_X/g,
42
- replace: `NODEJS_${nodeVersion}_X`
111
+ regex: () => /NODEJS_(\d+)_X/g,
112
+ replace: {
113
+ default: {
114
+ captureGroup: 1,
115
+ string: `NODEJS_${nodeVersion}_X`,
116
+ version: nodeVersion
117
+ }
118
+ }
43
119
  },
44
120
  {
121
+ type: "nodejs",
45
122
  files: "**/infra/**/*.ts",
46
123
  regex: () => /(target:\s*'node)(\d+)(.+)$/gm,
47
- replace: `$1${nodeVersion}$3`
124
+ replace: {
125
+ default: {
126
+ captureGroup: 2,
127
+ string: `$1${nodeVersion}$3`,
128
+ version: nodeVersion
129
+ }
130
+ }
48
131
  },
49
132
  {
133
+ type: "nodejs",
50
134
  files: "**/.buildkite/*",
51
- regex: () => /(image: )(public.ecr.aws\/docker\/library\/)?(node:)[0-9.]+(\.[^- \n]+)?(-[^ \n]+)?$/gm,
52
- replace: `$1$2$3${nodeVersion}$5`
135
+ regex: () => /(image: )(public.ecr.aws\/docker\/library\/)?(node:)([0-9.]+)(\.[^- \n]+)?(-[^ \n]+)?$/gm,
136
+ replace: {
137
+ default: {
138
+ captureGroup: 4,
139
+ string: `$1$2$3${nodeVersion}$5$6`,
140
+ version: nodeVersion
141
+ }
142
+ }
53
143
  },
54
144
  {
145
+ type: "nodejs",
55
146
  files: ".node-version*",
56
147
  regex: () => /(\d+(?:\.\d+)*)/g,
57
- replace: `${nodeVersion}`
148
+ replace: {
149
+ default: {
150
+ captureGroup: 1,
151
+ string: `${nodeVersion}`,
152
+ version: nodeVersion
153
+ }
154
+ }
58
155
  },
59
156
  {
157
+ type: "nodejs",
60
158
  files: "**/package.json",
61
159
  regex: () => /(["']engines["']:\s*{[\s\S]*?["']node["']:\s*["']>=)(\d+(?:\.\d+)*)(['"]\s*})/gm,
62
- tests: [isPatchableServerlessVersion, isPatchableSkubaType],
63
- replace: `$1${nodeVersion}$3`
160
+ replace: {
161
+ package: {
162
+ string: `$1${packageNodeVersion}$3`,
163
+ version: packageNodeVersion,
164
+ captureGroup: 2
165
+ },
166
+ default: {
167
+ string: `$1${nodeVersion}$3`,
168
+ version: nodeVersion,
169
+ captureGroup: 2
170
+ }
171
+ }
64
172
  },
65
173
  {
174
+ type: "nodejs",
175
+ files: "**/docker-compose*.y*ml",
176
+ regex: () => /(image: )(public.ecr.aws\/docker\/library\/)?(node:)([0-9.]+)(\.[^- \n]+)?(-[^ \n]+)?$/gm,
177
+ replace: {
178
+ default: {
179
+ captureGroup: 4,
180
+ string: `$1$2$3${nodeVersion}$5$6`,
181
+ version: nodeVersion
182
+ }
183
+ }
184
+ },
185
+ {
186
+ type: "ecmascript",
66
187
  files: "**/tsconfig*.json",
67
188
  regex: () => /("target":\s*")(ES\d+)"/gim,
68
- tests: [isPatchableServerlessVersion, isPatchableSkubaType],
69
- replace: `$1${ECMAScriptVersion}"`
189
+ replace: {
190
+ package: {
191
+ string: `$1${packageECMAScriptVersion}"`,
192
+ version: packageECMAScriptVersion,
193
+ captureGroup: 2
194
+ },
195
+ default: {
196
+ string: `$1${ECMAScriptVersion}"`,
197
+ version: ECMAScriptVersion,
198
+ captureGroup: 2
199
+ }
200
+ }
70
201
  },
71
202
  {
203
+ type: "ecmascript",
72
204
  files: "**/tsconfig*.json",
73
205
  regex: () => /("lib":\s*\[)([\S\s]*?)(ES\d+)([\S\s]*?)(\])/gim,
74
- tests: [isPatchableServerlessVersion, isPatchableSkubaType],
75
- replace: `$1$2${ECMAScriptVersion}$4$5`
76
- },
77
- {
78
- files: "**/docker-compose*.y*ml",
79
- regex: () => /(image: )(public.ecr.aws\/docker\/library\/)?(node:)[0-9.]+(\.[^- \n]+)?(-[^ \n]+)?$/gm,
80
- replace: `$1$2$3${nodeVersion}$5`
206
+ replace: {
207
+ package: {
208
+ string: `$1$2${packageECMAScriptVersion}$4$5`,
209
+ version: packageECMAScriptVersion,
210
+ captureGroup: 3
211
+ },
212
+ default: {
213
+ string: `$1$2${ECMAScriptVersion}$4$5`,
214
+ version: ECMAScriptVersion,
215
+ captureGroup: 3
216
+ }
217
+ }
81
218
  }
82
219
  ];
220
+ const getTemplatedReplace = async (path, replace) => {
221
+ if (!replace.package) {
222
+ return replace.default;
223
+ }
224
+ const isPackage = await (0, import_checks.isLikelyPackage)(path);
225
+ if (isPackage) {
226
+ return replace.package;
227
+ }
228
+ return replace.default;
229
+ };
83
230
  const runSubPatch = async (dir, patch) => {
84
- const readFile = createDestinationFileReader(dir);
85
- const paths = patch.file ? [patch.file] : await glob(patch.files ?? [], {
231
+ const readFile = (0, import_project.createDestinationFileReader)(dir);
232
+ const paths = patch.file ? [patch.file] : await (0, import_fast_glob.glob)(patch.files ?? [], {
86
233
  cwd: dir,
87
234
  ignore: ["**/node_modules/**"]
88
235
  });
@@ -92,35 +239,48 @@ const runSubPatch = async (dir, patch) => {
92
239
  if (!contents) {
93
240
  return;
94
241
  }
95
- if (patch.regex && !patch.regex().test(contents)) {
242
+ const regexResult = patch.regex().exec(contents);
243
+ if (!regexResult) {
96
244
  return;
97
245
  }
98
- if (patch.tests) {
99
- const results = await Promise.all(
100
- patch.tests.map((test) => test(path))
101
- );
102
- if (!results.every(Boolean)) {
103
- return;
104
- }
246
+ const templateReplace = await getTemplatedReplace(path, patch.replace);
247
+ if (!lessThan(
248
+ regexResult[templateReplace.captureGroup],
249
+ templateReplace.version
250
+ )) {
251
+ return;
105
252
  }
106
253
  await writePatchedContents({
107
254
  path,
108
255
  contents,
109
- templated: patch.replace,
256
+ templated: templateReplace.string,
110
257
  regex: patch.regex
111
258
  });
112
259
  })
113
260
  );
114
261
  };
262
+ const lessThan = (versionA, versionB) => {
263
+ if (versionA.toLowerCase().startsWith("es")) {
264
+ return Number(versionA.slice(2)) < Number(versionB.slice(2));
265
+ }
266
+ const coersedA = (0, import_semver.coerce)(versionA);
267
+ const coersedB = (0, import_semver.coerce)(versionB);
268
+ if (!coersedA || !coersedB) {
269
+ throw new Error(
270
+ `Unable to coerce versions for comparison: "${versionA}" and "${versionB}"`
271
+ );
272
+ }
273
+ return (0, import_semver.lt)(coersedA, coersedB);
274
+ };
115
275
  const writePatchedContents = async ({
116
276
  path,
117
277
  contents,
118
278
  templated,
119
279
  regex
120
- }) => await fs.promises.writeFile(
121
- path,
122
- regex ? contents.replaceAll(regex(), templated) : templated
123
- );
280
+ }) => {
281
+ const modified = contents.replaceAll(regex(), templated);
282
+ await import_fs_extra.default.promises.writeFile(path, modified);
283
+ };
124
284
  const upgrade = async (versions, dir) => {
125
285
  for (const subPatch of subPatches(versions)) {
126
286
  await runSubPatch(dir, subPatch);
@@ -128,22 +288,36 @@ const upgrade = async (versions, dir) => {
128
288
  };
129
289
  const nodeVersionMigration = async ({
130
290
  nodeVersion,
131
- ECMAScriptVersion
291
+ ECMAScriptVersion,
292
+ packageNodeVersion,
293
+ packageECMAScriptVersion,
294
+ infraPackages
132
295
  }, dir = process.cwd()) => {
133
- log.ok(`Upgrading to Node.js ${nodeVersion}`);
296
+ import_logging.log.ok(
297
+ `Upgrading project to Node.js ${nodeVersion} and package targets to Node.js ${packageNodeVersion}`
298
+ );
134
299
  try {
135
- if (!await isPatchableNodeVersion(nodeVersion, dir)) {
136
- throw new Error("Node.js version is not patchable");
137
- }
138
- await upgrade({ nodeVersion, ECMAScriptVersion }, dir);
139
- log.ok("Upgraded to Node.js", nodeVersion);
300
+ await (0, import_upgrade.tryUpgradeInfraPackages)("format", infraPackages);
301
+ await upgrade(
302
+ {
303
+ nodeVersion,
304
+ ECMAScriptVersion,
305
+ packageNodeVersion,
306
+ packageECMAScriptVersion
307
+ },
308
+ dir
309
+ );
310
+ import_logging.log.ok(
311
+ `Upgraded project to Node.js ${nodeVersion} and package targets to Node.js ${packageNodeVersion}`
312
+ );
140
313
  } catch (error) {
141
- log.err("Failed to upgrade");
142
- log.subtle(inspect(error));
314
+ import_logging.log.err("Failed to upgrade");
315
+ import_logging.log.subtle((0, import_util.inspect)(error));
143
316
  process.exitCode = 1;
144
317
  }
145
318
  };
146
- export {
319
+ // Annotate the CommonJS export names for ESM import in node:
320
+ 0 && (module.exports = {
147
321
  nodeVersionMigration
148
- };
322
+ });
149
323
  //# sourceMappingURL=index.js.map