skuba 14.0.0-replace-global-vars-20251117052457 → 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 (406) 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 -21
  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/index.js +0 -11
  393. package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/index.js.map +0 -7
  394. package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/rewriteGlobalVars.d.ts +0 -5
  395. package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/rewriteGlobalVars.js +0 -72
  396. package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/rewriteGlobalVars.js.map +0 -7
  397. package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/index.d.ts +0 -2
  398. package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/index.js +0 -11
  399. package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/index.js.map +0 -7
  400. package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/upgradeNode.js +0 -34
  401. package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/upgradeNode.js.map +0 -7
  402. package/lib/eslint.d.js +0 -1
  403. package/lib/eslint.d.js.map +0 -7
  404. package/template/base/vitest.config.ts +0 -25
  405. /package/lib/cli/lint/internalLints/upgrade/patches/{12.5.0 → 13.1.1}/index.d.ts +0 -0
  406. /package/lib/cli/lint/internalLints/upgrade/patches/{9.1.0 → 13.1.1}/upgradeNode.d.ts +0 -0
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../src/cli/lint/internalLints/upgrade/patches/13.1.1/upgradeNode.ts"],
4
+ "sourcesContent": ["import { inspect } from 'util';\n\nimport { log } from '../../../../../../utils/logging.js';\nimport { migrations } from '../../../../../migrate/index.js';\nimport type { PatchFunction, PatchReturnType } from '../../index.js';\n\nconst upgradeNode: PatchFunction = async ({\n mode,\n}): Promise<PatchReturnType> => {\n if (process.env.SKIP_NODE_UPGRADE) {\n return {\n result: 'skip',\n reason: 'SKIP_NODE_UPGRADE environment variable set',\n };\n }\n if (mode === 'lint') {\n return { result: 'apply' };\n }\n\n await migrations.node24();\n\n return { result: 'apply' };\n};\n\nexport const tryUpgradeNode: PatchFunction = async (config) => {\n try {\n return await upgradeNode(config);\n } catch (err) {\n log.warn('Failed to upgrade node version');\n log.subtle(inspect(err));\n return { result: 'skip', reason: 'due to an error' };\n }\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAwB;AAExB,qBAAoB;AACpB,qBAA2B;AAG3B,MAAM,cAA6B,OAAO;AAAA,EACxC;AACF,MAAgC;AAC9B,MAAI,QAAQ,IAAI,mBAAmB;AACjC,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,QAAQ;AAAA,IACV;AAAA,EACF;AACA,MAAI,SAAS,QAAQ;AACnB,WAAO,EAAE,QAAQ,QAAQ;AAAA,EAC3B;AAEA,QAAM,0BAAW,OAAO;AAExB,SAAO,EAAE,QAAQ,QAAQ;AAC3B;AAEO,MAAM,iBAAgC,OAAO,WAAW;AAC7D,MAAI;AACF,WAAO,MAAM,YAAY,MAAM;AAAA,EACjC,SAAS,KAAK;AACZ,uBAAI,KAAK,gCAAgC;AACzC,uBAAI,WAAO,qBAAQ,GAAG,CAAC;AACvB,WAAO,EAAE,QAAQ,QAAQ,QAAQ,kBAAkB;AAAA,EACrD;AACF;",
6
+ "names": []
7
+ }
@@ -1,15 +1,48 @@
1
- import path from "path";
2
- import { inspect } from "util";
3
- import fs from "fs-extra";
4
- import { log } from "../../../../../../utils/logging.js";
5
- import { getDestinationManifest } from "../../../../../configure/analysis/package.js";
6
- import { createDestinationFileReader } from "../../../../../configure/analysis/project.js";
7
- import { formatPrettier } from "../../../../../configure/processing/prettier.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 addEmptyExports_exports = {};
30
+ __export(addEmptyExports_exports, {
31
+ tryAddEmptyExports: () => tryAddEmptyExports
32
+ });
33
+ module.exports = __toCommonJS(addEmptyExports_exports);
34
+ var import_path = __toESM(require("path"));
35
+ var import_util = require("util");
36
+ var import_fs_extra = __toESM(require("fs-extra"));
37
+ var import_logging = require("../../../../../../utils/logging.js");
38
+ var import_package = require("../../../../../configure/analysis/package.js");
39
+ var import_project = require("../../../../../configure/analysis/project.js");
40
+ var import_prettier = require("../../../../../configure/processing/prettier.js");
8
41
  const JEST_SETUP_FILES = ["jest.setup.ts", "jest.setup.int.ts"];
9
42
  const addEmptyExports = async (mode) => {
10
- const manifest = await getDestinationManifest();
11
- const destinationRoot = path.dirname(manifest.path);
12
- const readDestinationFile = createDestinationFileReader(destinationRoot);
43
+ const manifest = await (0, import_package.getDestinationManifest)();
44
+ const destinationRoot = import_path.default.dirname(manifest.path);
45
+ const readDestinationFile = (0, import_project.createDestinationFileReader)(destinationRoot);
13
46
  const addEmptyExport = async (filename) => {
14
47
  const inputFile = await readDestinationFile(filename);
15
48
  if (!inputFile || // The file appears to have an import or export so it should be compatible
@@ -21,11 +54,11 @@ const addEmptyExports = async (mode) => {
21
54
  if (mode === "lint") {
22
55
  return "apply";
23
56
  }
24
- const data = await formatPrettier([inputFile, "export {}"].join("\n\n"), {
57
+ const data = await (0, import_prettier.formatPrettier)([inputFile, "export {}"].join("\n\n"), {
25
58
  parser: "typescript"
26
59
  });
27
- const filepath = path.join(destinationRoot, filename);
28
- await fs.promises.writeFile(filepath, data);
60
+ const filepath = import_path.default.join(destinationRoot, filename);
61
+ await import_fs_extra.default.promises.writeFile(filepath, data);
29
62
  return "apply";
30
63
  };
31
64
  const results = await Promise.all(JEST_SETUP_FILES.map(addEmptyExport));
@@ -35,12 +68,13 @@ const tryAddEmptyExports = async ({ mode }) => {
35
68
  try {
36
69
  return { result: await addEmptyExports(mode) };
37
70
  } catch (err) {
38
- log.warn("Failed to convert Jest setup files to isolated modules.");
39
- log.subtle(inspect(err));
71
+ import_logging.log.warn("Failed to convert Jest setup files to isolated modules.");
72
+ import_logging.log.subtle((0, import_util.inspect)(err));
40
73
  return { result: "skip", reason: "due to an error" };
41
74
  }
42
75
  };
43
- export {
76
+ // Annotate the CommonJS export names for ESM import in node:
77
+ 0 && (module.exports = {
44
78
  tryAddEmptyExports
45
- };
79
+ });
46
80
  //# sourceMappingURL=addEmptyExports.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../src/cli/lint/internalLints/upgrade/patches/7.3.1/addEmptyExports.ts"],
4
4
  "sourcesContent": ["import path from 'path';\nimport { inspect } from 'util';\n\nimport fs from 'fs-extra';\n\nimport { log } from '../../../../../../utils/logging.js';\nimport { getDestinationManifest } from '../../../../../configure/analysis/package.js';\nimport { createDestinationFileReader } from '../../../../../configure/analysis/project.js';\nimport { formatPrettier } from '../../../../../configure/processing/prettier.js';\nimport type { PatchFunction } from '../../index.js';\n\nconst JEST_SETUP_FILES = ['jest.setup.ts', 'jest.setup.int.ts'];\n\nconst addEmptyExports = async (mode: 'format' | 'lint') => {\n const manifest = await getDestinationManifest();\n\n const destinationRoot = path.dirname(manifest.path);\n\n const readDestinationFile = createDestinationFileReader(destinationRoot);\n\n const addEmptyExport = async (filename: string) => {\n const inputFile = await readDestinationFile(filename);\n\n if (\n !inputFile ||\n // The file appears to have an import or export so it should be compatible\n // with isolated modules. This is a very naive check that we don't want to\n // overcomplicate because it is invoked before many skuba commands.\n inputFile.includes('import ') ||\n inputFile.includes('export ')\n ) {\n return 'skip';\n }\n\n if (mode === 'lint') {\n return 'apply';\n }\n\n const data = await formatPrettier([inputFile, 'export {}'].join('\\n\\n'), {\n parser: 'typescript',\n });\n\n const filepath = path.join(destinationRoot, filename);\n\n await fs.promises.writeFile(filepath, data);\n\n return 'apply';\n };\n\n const results = await Promise.all(JEST_SETUP_FILES.map(addEmptyExport));\n return results.every((result) => result === 'skip') ? 'skip' : 'apply';\n};\n\n/**\n * Tries to add an empty `export {}` statement to the bottom of Jest setup files\n * for compliance with TypeScript isolated modules.\n */\nexport const tryAddEmptyExports: PatchFunction = async ({ mode }) => {\n try {\n return { result: await addEmptyExports(mode) };\n } catch (err) {\n log.warn('Failed to convert Jest setup files to isolated modules.');\n log.subtle(inspect(err));\n return { result: 'skip', reason: 'due to an error' };\n }\n};\n"],
5
- "mappings": "AAAA,OAAO,UAAU;AACjB,SAAS,eAAe;AAExB,OAAO,QAAQ;AAEf,SAAS,WAAW;AACpB,SAAS,8BAA8B;AACvC,SAAS,mCAAmC;AAC5C,SAAS,sBAAsB;AAG/B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MAAM,mBAAmB,CAAC,iBAAiB,mBAAmB;AAE9D,MAAM,kBAAkB,OAAO,SAA4B;AACzD,QAAM,WAAW,UAAM,uCAAuB;AAE9C,QAAM,kBAAkB,YAAAA,QAAK,QAAQ,SAAS,IAAI;AAElD,QAAM,0BAAsB,4CAA4B,eAAe;AAEvE,QAAM,iBAAiB,OAAO,aAAqB;AACjD,UAAM,YAAY,MAAM,oBAAoB,QAAQ;AAEpD,QACE,CAAC;AAAA;AAAA;AAAA,IAID,UAAU,SAAS,SAAS,KAC5B,UAAU,SAAS,SAAS,GAC5B;AACA,aAAO;AAAA,IACT;AAEA,QAAI,SAAS,QAAQ;AACnB,aAAO;AAAA,IACT;AAEA,UAAM,OAAO,UAAM,gCAAe,CAAC,WAAW,WAAW,EAAE,KAAK,MAAM,GAAG;AAAA,MACvE,QAAQ;AAAA,IACV,CAAC;AAED,UAAM,WAAW,YAAAA,QAAK,KAAK,iBAAiB,QAAQ;AAEpD,UAAM,gBAAAC,QAAG,SAAS,UAAU,UAAU,IAAI;AAE1C,WAAO;AAAA,EACT;AAEA,QAAM,UAAU,MAAM,QAAQ,IAAI,iBAAiB,IAAI,cAAc,CAAC;AACtE,SAAO,QAAQ,MAAM,CAAC,WAAW,WAAW,MAAM,IAAI,SAAS;AACjE;AAMO,MAAM,qBAAoC,OAAO,EAAE,KAAK,MAAM;AACnE,MAAI;AACF,WAAO,EAAE,QAAQ,MAAM,gBAAgB,IAAI,EAAE;AAAA,EAC/C,SAAS,KAAK;AACZ,uBAAI,KAAK,yDAAyD;AAClE,uBAAI,WAAO,qBAAQ,GAAG,CAAC;AACvB,WAAO,EAAE,QAAQ,QAAQ,QAAQ,kBAAkB;AAAA,EACrD;AACF;",
6
+ "names": ["path", "fs"]
7
7
  }
@@ -1,26 +1,50 @@
1
- import { tryPatchRenovateConfig } from "../../../patchRenovateConfig.js";
2
- import { tryAddEmptyExports } from "./addEmptyExports.js";
3
- import { tryPatchDockerfile } from "./patchDockerfile.js";
4
- import { tryPatchServerListener } from "./patchServerListener.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 __exports = {};
20
+ __export(__exports, {
21
+ patches: () => patches
22
+ });
23
+ module.exports = __toCommonJS(__exports);
24
+ var import_patchRenovateConfig = require("../../../patchRenovateConfig.js");
25
+ var import_addEmptyExports = require("./addEmptyExports.js");
26
+ var import_patchDockerfile = require("./patchDockerfile.js");
27
+ var import_patchServerListener = require("./patchServerListener.js");
5
28
  const patches = [
6
29
  {
7
- apply: tryAddEmptyExports,
30
+ apply: import_addEmptyExports.tryAddEmptyExports,
8
31
  description: "Add empty exports to Jest files for compliance with TypeScript isolated modules"
9
32
  },
10
33
  {
11
- apply: tryPatchRenovateConfig,
34
+ apply: import_patchRenovateConfig.tryPatchRenovateConfig,
12
35
  description: "Update Renovate config to support private SEEK packages"
13
36
  },
14
37
  {
15
- apply: tryPatchDockerfile,
38
+ apply: import_patchDockerfile.tryPatchDockerfile,
16
39
  description: "Upgrade Node.js Distroless Docker image to -debian12 variant"
17
40
  },
18
41
  {
19
- apply: tryPatchServerListener,
42
+ apply: import_patchServerListener.tryPatchServerListener,
20
43
  description: "Add keepAliveTimeout to server listener"
21
44
  }
22
45
  ];
23
- export {
46
+ // Annotate the CommonJS export names for ESM import in node:
47
+ 0 && (module.exports = {
24
48
  patches
25
- };
49
+ });
26
50
  //# sourceMappingURL=index.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../src/cli/lint/internalLints/upgrade/patches/7.3.1/index.ts"],
4
4
  "sourcesContent": ["import { tryPatchRenovateConfig } from '../../../patchRenovateConfig.js';\nimport type { Patches } from '../../index.js';\n\nimport { tryAddEmptyExports } from './addEmptyExports.js';\nimport { tryPatchDockerfile } from './patchDockerfile.js';\nimport { tryPatchServerListener } from './patchServerListener.js';\n\nexport const patches: Patches = [\n {\n apply: tryAddEmptyExports,\n description:\n 'Add empty exports to Jest files for compliance with TypeScript isolated modules',\n },\n {\n apply: tryPatchRenovateConfig,\n description: 'Update Renovate config to support private SEEK packages',\n },\n {\n apply: tryPatchDockerfile,\n description: 'Upgrade Node.js Distroless Docker image to -debian12 variant',\n },\n {\n apply: tryPatchServerListener,\n description: 'Add keepAliveTimeout to server listener',\n },\n];\n"],
5
- "mappings": "AAAA,SAAS,8BAA8B;AAGvC,SAAS,0BAA0B;AACnC,SAAS,0BAA0B;AACnC,SAAS,8BAA8B;AAEhC,MAAM,UAAmB;AAAA,EAC9B;AAAA,IACE,OAAO;AAAA,IACP,aACE;AAAA,EACJ;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AACF;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iCAAuC;AAGvC,6BAAmC;AACnC,6BAAmC;AACnC,iCAAuC;AAEhC,MAAM,UAAmB;AAAA,EAC9B;AAAA,IACE,OAAO;AAAA,IACP,aACE;AAAA,EACJ;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AACF;",
6
6
  "names": []
7
7
  }
@@ -1,13 +1,46 @@
1
- import { inspect } from "util";
2
- import fs from "fs-extra";
3
- import { log } from "../../../../../../utils/logging.js";
4
- import { createDestinationFileReader } from "../../../../../configure/analysis/project.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 patchDockerfile_exports = {};
30
+ __export(patchDockerfile_exports, {
31
+ tryPatchDockerfile: () => tryPatchDockerfile
32
+ });
33
+ module.exports = __toCommonJS(patchDockerfile_exports);
34
+ var import_util = require("util");
35
+ var import_fs_extra = __toESM(require("fs-extra"));
36
+ var import_logging = require("../../../../../../utils/logging.js");
37
+ var import_project = require("../../../../../configure/analysis/project.js");
5
38
  const DOCKERFILE_FILENAME = "Dockerfile";
6
39
  const NON_DEBIAN_REGEX = /gcr.io\/distroless\/nodejs:(18|20)/g;
7
40
  const DEBIAN_REGEX = /gcr.io\/distroless\/nodejs(18|20)-debian11/g;
8
41
  const VERSION_DEBIAN_REPLACE = "gcr.io/distroless/nodejs$1-debian12";
9
42
  const patchDockerfile = async (mode, dir) => {
10
- const readFile = createDestinationFileReader(dir);
43
+ const readFile = (0, import_project.createDestinationFileReader)(dir);
11
44
  const maybeDockerfile = await readFile(DOCKERFILE_FILENAME);
12
45
  if (!maybeDockerfile) {
13
46
  return { result: "skip", reason: "no Dockerfile found" };
@@ -19,7 +52,7 @@ const patchDockerfile = async (mode, dir) => {
19
52
  if (mode === "lint") {
20
53
  return { result: "apply" };
21
54
  }
22
- await fs.promises.writeFile(DOCKERFILE_FILENAME, patched);
55
+ await import_fs_extra.default.promises.writeFile(DOCKERFILE_FILENAME, patched);
23
56
  return { result: "apply" };
24
57
  };
25
58
  const tryPatchDockerfile = async ({
@@ -29,12 +62,13 @@ const tryPatchDockerfile = async ({
29
62
  try {
30
63
  return await patchDockerfile(mode, dir);
31
64
  } catch (err) {
32
- log.warn("Failed to patch Dockerfile.");
33
- log.subtle(inspect(err));
65
+ import_logging.log.warn("Failed to patch Dockerfile.");
66
+ import_logging.log.subtle((0, import_util.inspect)(err));
34
67
  return { result: "skip", reason: "due to an error" };
35
68
  }
36
69
  };
37
- export {
70
+ // Annotate the CommonJS export names for ESM import in node:
71
+ 0 && (module.exports = {
38
72
  tryPatchDockerfile
39
- };
73
+ });
40
74
  //# sourceMappingURL=patchDockerfile.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../src/cli/lint/internalLints/upgrade/patches/7.3.1/patchDockerfile.ts"],
4
4
  "sourcesContent": ["import { inspect } from 'util';\n\nimport fs from 'fs-extra';\n\nimport { log } from '../../../../../../utils/logging.js';\nimport { createDestinationFileReader } from '../../../../../configure/analysis/project.js';\nimport type { PatchFunction, PatchReturnType } from '../../index.js';\n\nconst DOCKERFILE_FILENAME = 'Dockerfile';\n\nconst NON_DEBIAN_REGEX = /gcr.io\\/distroless\\/nodejs:(18|20)/g;\nconst DEBIAN_REGEX = /gcr.io\\/distroless\\/nodejs(18|20)-debian11/g;\nconst VERSION_DEBIAN_REPLACE = 'gcr.io/distroless/nodejs$1-debian12';\n\nconst patchDockerfile = async (\n mode: 'format' | 'lint',\n dir: string,\n): Promise<PatchReturnType> => {\n const readFile = createDestinationFileReader(dir);\n\n const maybeDockerfile = await readFile(DOCKERFILE_FILENAME);\n\n if (!maybeDockerfile) {\n return { result: 'skip', reason: 'no Dockerfile found' };\n }\n\n const patched = maybeDockerfile\n .replaceAll(NON_DEBIAN_REGEX, VERSION_DEBIAN_REPLACE)\n .replaceAll(DEBIAN_REGEX, VERSION_DEBIAN_REPLACE);\n\n if (patched === maybeDockerfile) {\n return { result: 'skip' };\n }\n\n if (mode === 'lint') {\n return { result: 'apply' };\n }\n\n await fs.promises.writeFile(DOCKERFILE_FILENAME, patched);\n\n return { result: 'apply' };\n};\n\nexport const tryPatchDockerfile: PatchFunction = async ({\n mode,\n dir = process.cwd(),\n}) => {\n try {\n return await patchDockerfile(mode, dir);\n } catch (err) {\n log.warn('Failed to patch Dockerfile.');\n log.subtle(inspect(err));\n return { result: 'skip', reason: 'due to an error' };\n }\n};\n"],
5
- "mappings": "AAAA,SAAS,eAAe;AAExB,OAAO,QAAQ;AAEf,SAAS,WAAW;AACpB,SAAS,mCAAmC;AAG5C,MAAM,sBAAsB;AAE5B,MAAM,mBAAmB;AACzB,MAAM,eAAe;AACrB,MAAM,yBAAyB;AAE/B,MAAM,kBAAkB,OACtB,MACA,QAC6B;AAC7B,QAAM,WAAW,4BAA4B,GAAG;AAEhD,QAAM,kB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B,WAAO,EAAE,QAAQ,OAAO;AAAA,EAC1B;AAEA,MAAI,SAAS,QAAQ;AACnB,WAAO,EAAE,QAAQ,QAAQ;AAAA,EAC3B;AAEA,QAAM,gBAAAA,QAAG,SAAS,UAAU,qBAAqB,OAAO;AAExD,SAAO,EAAE,QAAQ,QAAQ;AAC3B;AAEO,MAAM,qBAAoC,OAAO;AAAA,EACtD;AAAA,EACA,MAAM,QAAQ,IAAI;AACpB,MAAM;AACJ,MAAI;AACF,WAAO,MAAM,gBAAgB,MAAM,GAAG;AAAA,EACxC,SAAS,KAAK;AACZ,uBAAI,KAAK,6BAA6B;AACtC,uBAAI,WAAO,qBAAQ,GAAG,CAAC;AACvB,WAAO,EAAE,QAAQ,QAAQ,QAAQ,kBAAkB;AAAA,EACrD;AACF;",
6
+ "names": ["fs"]
7
7
  }
@@ -1,8 +1,41 @@
1
- import { inspect } from "util";
2
- import fs from "fs-extra";
3
- import { log } from "../../../../../../utils/logging.js";
4
- import { createDestinationFileReader } from "../../../../../configure/analysis/project.js";
5
- import { formatPrettier } from "../../../../../configure/processing/prettier.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 patchServerListener_exports = {};
30
+ __export(patchServerListener_exports, {
31
+ tryPatchServerListener: () => tryPatchServerListener
32
+ });
33
+ module.exports = __toCommonJS(patchServerListener_exports);
34
+ var import_util = require("util");
35
+ var import_fs_extra = __toESM(require("fs-extra"));
36
+ var import_logging = require("../../../../../../utils/logging.js");
37
+ var import_project = require("../../../../../configure/analysis/project.js");
38
+ var import_prettier = require("../../../../../configure/processing/prettier.js");
6
39
  const SERVER_LISTENER_FILENAME = "src/listen.ts";
7
40
  const KEEP_ALIVE_CODE = `
8
41
  // Gantry ALB default idle timeout is 30 seconds
@@ -13,7 +46,7 @@ const KEEP_ALIVE_CODE = `
13
46
  listener.keepAliveTimeout = 31000;
14
47
  `;
15
48
  const patchServerListener = async (mode, dir) => {
16
- const readFile = createDestinationFileReader(dir);
49
+ const readFile = (0, import_project.createDestinationFileReader)(dir);
17
50
  let listener = await readFile(SERVER_LISTENER_FILENAME);
18
51
  if (!listener) {
19
52
  return { result: "skip", reason: "no listener file found" };
@@ -34,9 +67,9 @@ const patchServerListener = async (mode, dir) => {
34
67
  return { result: "apply" };
35
68
  }
36
69
  listener = `${listener}${KEEP_ALIVE_CODE}`;
37
- await fs.promises.writeFile(
70
+ await import_fs_extra.default.promises.writeFile(
38
71
  SERVER_LISTENER_FILENAME,
39
- await formatPrettier(listener, {
72
+ await (0, import_prettier.formatPrettier)(listener, {
40
73
  parser: "typescript"
41
74
  })
42
75
  );
@@ -49,12 +82,13 @@ const tryPatchServerListener = async ({
49
82
  try {
50
83
  return await patchServerListener(mode, dir);
51
84
  } catch (err) {
52
- log.warn("Failed to patch server listener.");
53
- log.subtle(inspect(err));
85
+ import_logging.log.warn("Failed to patch server listener.");
86
+ import_logging.log.subtle((0, import_util.inspect)(err));
54
87
  return { result: "skip", reason: "due to an error" };
55
88
  }
56
89
  };
57
- export {
90
+ // Annotate the CommonJS export names for ESM import in node:
91
+ 0 && (module.exports = {
58
92
  tryPatchServerListener
59
- };
93
+ });
60
94
  //# sourceMappingURL=patchServerListener.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../src/cli/lint/internalLints/upgrade/patches/7.3.1/patchServerListener.ts"],
4
4
  "sourcesContent": ["import { inspect } from 'util';\n\nimport fs from 'fs-extra';\n\nimport { log } from '../../../../../../utils/logging.js';\nimport { createDestinationFileReader } from '../../../../../configure/analysis/project.js';\nimport { formatPrettier } from '../../../../../configure/processing/prettier.js';\nimport type { PatchFunction, PatchReturnType } from '../../index.js';\n\nconst SERVER_LISTENER_FILENAME = 'src/listen.ts';\n\nconst KEEP_ALIVE_CODE = `\n// Gantry ALB default idle timeout is 30 seconds\n// https://nodejs.org/docs/latest-v20.x/api/http.html#serverkeepalivetimeout\n// Node default is 5 seconds\n// https://docs.aws.amazon.com/elasticloadbalancing/latest/application/application-load-balancers.html#connection-idle-timeout\n// AWS recommends setting an application timeout larger than the load balancer\nlistener.keepAliveTimeout = 31000;\n`;\n\nconst patchServerListener = async (\n mode: 'format' | 'lint',\n dir: string,\n): Promise<PatchReturnType> => {\n const readFile = createDestinationFileReader(dir);\n\n let listener = await readFile(SERVER_LISTENER_FILENAME);\n if (!listener) {\n return { result: 'skip', reason: 'no listener file found' };\n }\n\n if (listener.includes('keepAliveTimeout')) {\n return { result: 'skip', reason: 'keepAliveTimeout already configured' };\n }\n\n if (listener.includes('\\napp.listen(')) {\n listener = listener.replace(\n '\\napp.listen(',\n '\\nconst listener = app.listen(',\n );\n }\n\n if (!listener.includes('\\nconst listener = app.listen(')) {\n return { result: 'skip', reason: 'no server listener found' };\n }\n\n if (mode === 'lint') {\n return { result: 'apply' };\n }\n\n listener = `${listener}${KEEP_ALIVE_CODE}`;\n\n await fs.promises.writeFile(\n SERVER_LISTENER_FILENAME,\n await formatPrettier(listener, {\n parser: 'typescript',\n }),\n );\n\n return { result: 'apply' };\n};\n\nexport const tryPatchServerListener: PatchFunction = async ({\n mode,\n dir = process.cwd(),\n}) => {\n try {\n return await patchServerListener(mode, dir);\n } catch (err) {\n log.warn('Failed to patch server listener.');\n log.subtle(inspect(err));\n return { result: 'skip', reason: 'due to an error' };\n }\n};\n"],
5
- "mappings": "AAAA,SAAS,eAAe;AAExB,OAAO,QAAQ;AAEf,SAAS,WAAW;AACpB,SAAS,mCAAmC;AAC5C,SAAS,sBAAsB;AAG/B,MAAM,2BAA2B;AAEjC,MAAM,kBAAkB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASxB,MAAM,sBAAsB,OAC1B,MACA,QAC6B;AAC7B,QAAM,WAAW,4BAA4B,GAAG;AAEhD,MAAI,WAAW,MAAM,SAAS,wBAAwB;AACtD,MAAI,CAAC,UAAU;AACb,WAAO,EAAE,QAAQ,QAAQ,QAAQ,yBAAyB;AAAA,EAC5D;AAEA,MAAI,SAAS,SAAS,kBAAkB,GAAG;AACzC,WAAO,EAAE,QAAQ,QAAQ,QAAQ,sCAAsC;AAAA,EACzE;AAEA,MAAI,SAAS,SAAS,eAAe,GAAG;AACtC,eAAW,SAAS;AAAA,MAClB;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,MAAI,CAAC,SAAS,SAAS,gCAAgC,GAAG;AACxD,WAAO,EAAE,QAAQ,QAAQ,QAAQ,2BAA2B;AAAA,EAC9D;AAEA,MAAI,SAAS,QAAQ;AACnB,WAAO,EAAE,QAAQ,QAAQ;AAAA,EAC3B;AAEA,aAAW,GAAG,QAAQ,GAAG,eAAe;AAExC,QAAM,GAAG,SAAS;AAAA,IAChB;AAAA,IACA,MA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GAAG,eAAe;AAExC,QAAM,gBAAAA,QAAG,SAAS;AAAA,IAChB;AAAA,IACA,UAAM,gCAAe,UAAU;AAAA,MAC7B,QAAQ;AAAA,IACV,CAAC;AAAA,EACH;AAEA,SAAO,EAAE,QAAQ,QAAQ;AAC3B;AAEO,MAAM,yBAAwC,OAAO;AAAA,EAC1D;AAAA,EACA,MAAM,QAAQ,IAAI;AACpB,MAAM;AACJ,MAAI;AACF,WAAO,MAAM,oBAAoB,MAAM,GAAG;AAAA,EAC5C,SAAS,KAAK;AACZ,uBAAI,KAAK,kCAAkC;AAC3C,uBAAI,WAAO,qBAAQ,GAAG,CAAC;AACvB,WAAO,EAAE,QAAQ,QAAQ,QAAQ,kBAAkB;AAAA,EACrD;AACF;",
6
+ "names": ["fs"]
7
7
  }
@@ -1,11 +1,35 @@
1
- import { tryPatchPnpmPackageManager } from "./patchPnpmPackageManager.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 __exports = {};
20
+ __export(__exports, {
21
+ patches: () => patches
22
+ });
23
+ module.exports = __toCommonJS(__exports);
24
+ var import_patchPnpmPackageManager = require("./patchPnpmPackageManager.js");
2
25
  const patches = [
3
26
  {
4
- apply: tryPatchPnpmPackageManager,
27
+ apply: import_patchPnpmPackageManager.tryPatchPnpmPackageManager,
5
28
  description: "Ensure the pnpm package manager version specified in package.json is used in Dockerfiles"
6
29
  }
7
30
  ];
8
- export {
31
+ // Annotate the CommonJS export names for ESM import in node:
32
+ 0 && (module.exports = {
9
33
  patches
10
- };
34
+ });
11
35
  //# sourceMappingURL=index.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../src/cli/lint/internalLints/upgrade/patches/8.0.0/index.ts"],
4
4
  "sourcesContent": ["import type { Patches } from '../../index.js';\n\nimport { tryPatchPnpmPackageManager } from './patchPnpmPackageManager.js';\n\nexport const patches: Patches = [\n {\n apply: tryPatchPnpmPackageManager,\n description:\n 'Ensure the pnpm package manager version specified in package.json is used in Dockerfiles',\n },\n];\n"],
5
- "mappings": "AAEA,SAAS,kCAAkC;AAEpC,MAAM,UAAmB;AAAA,EAC9B;AAAA,IACE,OAAO;AAAA,IACP,aACE;AAAA,EACJ;AACF;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,qCAA2C;AAEpC,MAAM,UAAmB;AAAA,EAC9B;AAAA,IACE,OAAO;AAAA,IACP,aACE;AAAA,EACJ;AACF;",
6
6
  "names": []
7
7
  }
@@ -1,8 +1,41 @@
1
- import { inspect } from "util";
2
- import fg from "fast-glob";
3
- import fs from "fs-extra";
4
- import { lt } from "semver";
5
- import { log } from "../../../../../../utils/logging.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 patchPnpmPackageManager_exports = {};
30
+ __export(patchPnpmPackageManager_exports, {
31
+ tryPatchPnpmPackageManager: () => tryPatchPnpmPackageManager
32
+ });
33
+ module.exports = __toCommonJS(patchPnpmPackageManager_exports);
34
+ var import_util = require("util");
35
+ var import_fast_glob = __toESM(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");
6
39
  const DOCKERFILE_COREPACK_COMMAND = "RUN corepack enable pnpm";
7
40
  const PACKAGE_JSON_MOUNT = `RUN --mount=type=bind,source=package.json,target=package.json \\
8
41
  corepack enable pnpm && corepack install`;
@@ -11,7 +44,7 @@ const BEFORE_PIPELINE_REGEX = /(\s*cache-on:\s*\n\s*-\s*\.npmrc\s*\n)((\s*)-\s*p
11
44
  const ECR_REGEX = /seek-oss\/docker-ecr-cache#v([\d\.]+)/gm;
12
45
  const fetchFiles = async (files) => Promise.all(
13
46
  files.map(async (file) => {
14
- const contents = await fs.readFile(file, "utf8");
47
+ const contents = await import_fs_extra.default.readFile(file, "utf8");
15
48
  return {
16
49
  file,
17
50
  contents
@@ -36,8 +69,8 @@ const patchPnpmPackageManager = async ({
36
69
  };
37
70
  }
38
71
  const [maybeDockerfiles, maybePipelines] = await Promise.all([
39
- fg(["Dockerfile*"]),
40
- fg([".buildkite/*.yml"])
72
+ (0, import_fast_glob.default)(["Dockerfile*"]),
73
+ (0, import_fast_glob.default)([".buildkite/*.yml"])
41
74
  ]);
42
75
  if (!maybeDockerfiles.length || !maybePipelines.length) {
43
76
  return {
@@ -71,7 +104,7 @@ const patchPnpmPackageManager = async ({
71
104
  DOCKERFILE_COREPACK_COMMAND,
72
105
  PACKAGE_JSON_MOUNT
73
106
  );
74
- await fs.writeFile(file, patchedContent);
107
+ await import_fs_extra.default.writeFile(file, patchedContent);
75
108
  })
76
109
  );
77
110
  }
@@ -86,13 +119,13 @@ $2`
86
119
  const patchedEcrContent = patchedContent.replace(
87
120
  ECR_REGEX,
88
121
  (match, version) => {
89
- if (typeof version === "string" && lt(version, "2.2.0")) {
122
+ if (typeof version === "string" && (0, import_semver.lt)(version, "2.2.0")) {
90
123
  return "seek-oss/docker-ecr-cache#v2.2.0";
91
124
  }
92
125
  return match;
93
126
  }
94
127
  );
95
- await fs.writeFile(file, patchedEcrContent);
128
+ await import_fs_extra.default.writeFile(file, patchedEcrContent);
96
129
  })
97
130
  );
98
131
  }
@@ -102,12 +135,13 @@ const tryPatchPnpmPackageManager = async (config) => {
102
135
  try {
103
136
  return await patchPnpmPackageManager(config);
104
137
  } catch (err) {
105
- log.warn("Failed to patch pnpm packageManager CI configuration.");
106
- log.subtle(inspect(err));
138
+ import_logging.log.warn("Failed to patch pnpm packageManager CI configuration.");
139
+ import_logging.log.subtle((0, import_util.inspect)(err));
107
140
  return { result: "skip", reason: "due to an error" };
108
141
  }
109
142
  };
110
- export {
143
+ // Annotate the CommonJS export names for ESM import in node:
144
+ 0 && (module.exports = {
111
145
  tryPatchPnpmPackageManager
112
- };
146
+ });
113
147
  //# sourceMappingURL=patchPnpmPackageManager.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../src/cli/lint/internalLints/upgrade/patches/8.0.0/patchPnpmPackageManager.ts"],
4
4
  "sourcesContent": ["import { inspect } from 'util';\n\nimport fg from 'fast-glob';\nimport fs from 'fs-extra';\nimport { lt } from 'semver';\n\nimport { log } from '../../../../../../utils/logging.js';\nimport type { PatchFunction, PatchReturnType } from '../../index.js';\n\nconst DOCKERFILE_COREPACK_COMMAND = 'RUN corepack enable pnpm';\nconst PACKAGE_JSON_MOUNT = `RUN --mount=type=bind,source=package.json,target=package.json \\\\\n corepack enable pnpm && corepack install`;\nconst PACKAGE_JSON_CACHE = '- package.json#.packageManager';\n\nconst BEFORE_PIPELINE_REGEX =\n /(\\s*cache-on:\\s*\\n\\s*-\\s*\\.npmrc\\s*\\n)((\\s*)-\\s*pnpm-lock\\.yaml)/gm;\nconst ECR_REGEX = /seek-oss\\/docker-ecr-cache#v([\\d\\.]+)/gm;\n\nconst fetchFiles = async (files: string[]) =>\n Promise.all(\n files.map(async (file) => {\n const contents = await fs.readFile(file, 'utf8');\n\n return {\n file,\n contents,\n };\n }),\n );\n\nconst patchPnpmPackageManager: PatchFunction = async ({\n mode,\n manifest,\n packageManager,\n}): Promise<PatchReturnType> => {\n if (packageManager.command !== 'pnpm') {\n return {\n result: 'skip',\n reason: 'not using pnpm',\n };\n }\n\n if (\n !(\n manifest.packageJson as { packageManager?: string }\n ).packageManager?.includes('pnpm')\n ) {\n return {\n result: 'skip',\n reason: 'no packageManager declaration in package.json found',\n };\n }\n\n const [maybeDockerfiles, maybePipelines] = await Promise.all([\n fg(['Dockerfile*']),\n fg(['.buildkite/*.yml']),\n ]);\n\n if (!maybeDockerfiles.length || !maybePipelines.length) {\n return {\n result: 'skip',\n reason: 'Either dockerfiles or pipelines were not found',\n };\n }\n\n const [dockerfiles, pipelines] = await Promise.all([\n fetchFiles(maybeDockerfiles),\n fetchFiles(maybePipelines),\n ]);\n\n const dockerFilesToPatch = dockerfiles.filter(\n ({ contents }) =>\n contents.includes(DOCKERFILE_COREPACK_COMMAND) &&\n !contents.includes('target=package.json'),\n );\n\n const pipelinesToPatch = pipelines.filter(({ contents }) =>\n Boolean(BEFORE_PIPELINE_REGEX.exec(contents)),\n );\n\n if (!dockerFilesToPatch.length && !pipelinesToPatch.length) {\n return {\n result: 'skip',\n reason: 'no pipeline or dockerfiles to patch',\n };\n }\n\n if (mode === 'lint') {\n return { result: 'apply' };\n }\n\n if (dockerFilesToPatch.length) {\n await Promise.all(\n dockerFilesToPatch.map(async ({ file, contents }) => {\n const patchedContent = contents.replace(\n DOCKERFILE_COREPACK_COMMAND,\n PACKAGE_JSON_MOUNT,\n );\n await fs.writeFile(file, patchedContent);\n }),\n );\n }\n\n if (pipelinesToPatch.length) {\n await Promise.all(\n pipelinesToPatch.map(async ({ file, contents }) => {\n const patchedContent = contents.replace(\n BEFORE_PIPELINE_REGEX,\n `$1$3${PACKAGE_JSON_CACHE}\\n$2`,\n );\n\n const patchedEcrContent = patchedContent.replace(\n ECR_REGEX,\n (match, version) => {\n if (typeof version === 'string' && lt(version, '2.2.0')) {\n return 'seek-oss/docker-ecr-cache#v2.2.0';\n }\n return match;\n },\n );\n\n await fs.writeFile(file, patchedEcrContent);\n }),\n );\n }\n\n return { result: 'apply' };\n};\n\nexport const tryPatchPnpmPackageManager: PatchFunction = async (config) => {\n try {\n return await patchPnpmPackageManager(config);\n } catch (err) {\n log.warn('Failed to patch pnpm packageManager CI configuration.');\n log.subtle(inspect(err));\n return { result: 'skip', reason: 'due to an error' };\n }\n};\n"],
5
- "mappings": "AAAA,SAAS,eAAe;AAExB,OAAO,QAAQ;AACf,OAAO,QAAQ;AACf,SAAS,UAAU;AAEnB,SAAS,WAAW;AAGpB,MAAM,8BAA8B;AACpC,MAAM,qBAAqB;AAAA;AAE3B,MAAM,qBAAqB;AAE3B,MAAM,wBACJ;AACF,MAAM,YAAY;AAElB,MAAM,aAAa,OAAO,UACxB,QAAQ;AAAA,EACN,MAAM,IAAI,OAA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