skuba 14.0.0-esmify-skuba-20251105032119 → 14.0.0-hacky-hack-lang-json-20260108235938

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 (539) hide show
  1. package/config/eslint.js +1 -1
  2. package/config/jest.js +1 -0
  3. package/config/prettier.d.ts +4 -0
  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 +3 -3
  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/{src/cli → cli}/build/assets.d.ts +3 -2
  19. package/lib/cli/build/assets.js +60 -28
  20. package/lib/cli/build/assets.js.map +3 -3
  21. package/lib/cli/build/esbuild.d.ts +8 -0
  22. package/lib/cli/build/esbuild.js +64 -23
  23. package/lib/cli/build/esbuild.js.map +2 -2
  24. package/lib/cli/build/index.js +53 -21
  25. package/lib/cli/build/index.js.map +2 -2
  26. package/lib/cli/build/tsc.js +60 -24
  27. package/lib/cli/build/tsc.js.map +3 -3
  28. package/lib/cli/buildPackage/index.js +32 -8
  29. package/lib/cli/buildPackage/index.js.map +1 -1
  30. package/lib/cli/configure/analyseConfiguration.js +50 -16
  31. package/lib/cli/configure/analyseConfiguration.js.map +2 -2
  32. package/lib/{src/cli → cli}/configure/analyseDependencies.d.ts +1 -1
  33. package/lib/cli/configure/analyseDependencies.js +59 -25
  34. package/lib/cli/configure/analyseDependencies.js.map +3 -3
  35. package/lib/cli/configure/analysis/diff.js +29 -5
  36. package/lib/cli/configure/analysis/diff.js.map +2 -2
  37. package/lib/cli/configure/analysis/files.js +42 -8
  38. package/lib/cli/configure/analysis/files.js.map +2 -2
  39. package/lib/cli/configure/analysis/git.js +46 -12
  40. package/lib/cli/configure/analysis/git.js.map +2 -2
  41. package/lib/{src/cli → cli}/configure/analysis/package.d.ts +3 -2
  42. package/lib/cli/configure/analysis/package.js +45 -10
  43. package/lib/cli/configure/analysis/package.js.map +3 -3
  44. package/lib/cli/configure/analysis/project.js +50 -18
  45. package/lib/cli/configure/analysis/project.js.map +2 -2
  46. package/lib/cli/configure/dependencies/index.js +35 -7
  47. package/lib/cli/configure/dependencies/index.js.map +1 -1
  48. package/lib/cli/configure/dependencies/seekDatadogCustomMetrics.js +28 -4
  49. package/lib/cli/configure/dependencies/seekDatadogCustomMetrics.js.map +1 -1
  50. package/lib/cli/configure/dependencies/seekKoala.js +28 -4
  51. package/lib/cli/configure/dependencies/seekKoala.js.map +1 -1
  52. package/lib/cli/configure/dependencies/skuba.js +28 -4
  53. package/lib/cli/configure/dependencies/skuba.js.map +1 -1
  54. package/lib/cli/configure/dependencies/skubaDeps.js +26 -2
  55. package/lib/cli/configure/dependencies/skubaDeps.js.map +1 -1
  56. package/lib/cli/configure/dependencies/skubaDive.js +29 -4
  57. package/lib/cli/configure/dependencies/skubaDive.js.map +1 -1
  58. package/lib/{src/cli → cli}/configure/ensureTemplateCompletion.d.ts +1 -1
  59. package/lib/cli/configure/ensureTemplateCompletion.js +63 -32
  60. package/lib/cli/configure/ensureTemplateCompletion.js.map +3 -3
  61. package/lib/{src/cli → cli}/configure/getEntryPoint.d.ts +2 -2
  62. package/lib/cli/configure/getEntryPoint.js +51 -19
  63. package/lib/cli/configure/getEntryPoint.js.map +3 -3
  64. package/lib/{src/cli → cli}/configure/getProjectType.d.ts +1 -1
  65. package/lib/cli/configure/getProjectType.js +36 -17
  66. package/lib/cli/configure/getProjectType.js.map +2 -2
  67. package/lib/cli/configure/index.js +91 -56
  68. package/lib/cli/configure/index.js.map +3 -3
  69. package/lib/cli/configure/modules/eslint.js +34 -10
  70. package/lib/cli/configure/modules/eslint.js.map +1 -1
  71. package/lib/cli/configure/modules/ignore.js +32 -8
  72. package/lib/cli/configure/modules/ignore.js.map +1 -1
  73. package/lib/cli/configure/modules/index.js +44 -18
  74. package/lib/cli/configure/modules/index.js.map +2 -2
  75. package/lib/cli/configure/modules/jest.d.ts +2 -0
  76. package/lib/cli/configure/modules/jest.js +86 -0
  77. package/lib/cli/configure/modules/jest.js.map +7 -0
  78. package/lib/cli/configure/modules/nodemon.js +28 -4
  79. package/lib/cli/configure/modules/nodemon.js.map +1 -1
  80. package/lib/cli/configure/modules/package.js +34 -10
  81. package/lib/cli/configure/modules/package.js.map +1 -1
  82. package/lib/cli/configure/modules/prettier.js +35 -11
  83. package/lib/cli/configure/modules/prettier.js.map +1 -1
  84. package/lib/cli/configure/modules/renovate.js +40 -17
  85. package/lib/cli/configure/modules/renovate.js.map +2 -2
  86. package/lib/cli/configure/modules/serverless.js +26 -2
  87. package/lib/cli/configure/modules/serverless.js.map +1 -1
  88. package/lib/cli/configure/modules/tslint.js +28 -4
  89. package/lib/cli/configure/modules/tslint.js.map +1 -1
  90. package/lib/cli/configure/processing/configFile.js +39 -3
  91. package/lib/cli/configure/processing/configFile.js.map +1 -1
  92. package/lib/cli/configure/processing/deleteFiles.js +26 -2
  93. package/lib/cli/configure/processing/deleteFiles.js.map +1 -1
  94. package/lib/cli/configure/processing/javascript.js +27 -2
  95. package/lib/cli/configure/processing/javascript.js.map +1 -1
  96. package/lib/cli/configure/processing/json.js +31 -6
  97. package/lib/cli/configure/processing/json.js.map +1 -1
  98. package/lib/cli/configure/processing/loadFiles.js +26 -2
  99. package/lib/cli/configure/processing/loadFiles.js.map +1 -1
  100. package/lib/cli/configure/processing/module.js +28 -4
  101. package/lib/cli/configure/processing/module.js.map +1 -1
  102. package/lib/cli/configure/processing/package.d.ts +71 -0
  103. package/lib/cli/configure/processing/package.js +45 -8
  104. package/lib/cli/configure/processing/package.js.map +3 -3
  105. package/lib/cli/configure/processing/prettier.js +38 -4
  106. package/lib/cli/configure/processing/prettier.js.map +2 -2
  107. package/lib/cli/configure/processing/record.js +41 -5
  108. package/lib/cli/configure/processing/record.js.map +2 -2
  109. package/lib/cli/configure/processing/typescript.js +63 -26
  110. package/lib/cli/configure/processing/typescript.js.map +2 -2
  111. package/lib/{src/cli → cli}/configure/types.d.ts +4 -15
  112. package/lib/cli/configure/types.js +16 -0
  113. package/lib/cli/configure/types.js.map +3 -3
  114. package/lib/cli/format/index.js +44 -20
  115. package/lib/cli/format/index.js.map +2 -2
  116. package/lib/cli/help/index.js +30 -6
  117. package/lib/cli/help/index.js.map +1 -1
  118. package/lib/{src/cli → cli}/init/getConfig.d.ts +2 -2
  119. package/lib/cli/init/getConfig.js +121 -102
  120. package/lib/cli/init/getConfig.js.map +3 -3
  121. package/lib/cli/init/git.js +51 -16
  122. package/lib/cli/init/git.js.map +2 -2
  123. package/lib/cli/init/index.js +98 -67
  124. package/lib/cli/init/index.js.map +2 -2
  125. package/lib/{src/cli → cli}/init/prompts.d.ts +13 -10
  126. package/lib/cli/init/prompts.js +56 -35
  127. package/lib/cli/init/prompts.js.map +2 -2
  128. package/lib/cli/init/types.js +41 -7
  129. package/lib/cli/init/types.js.map +1 -1
  130. package/lib/cli/init/validation.js +30 -2
  131. package/lib/cli/init/validation.js.map +1 -1
  132. package/lib/cli/init/writePackageJson.js +42 -8
  133. package/lib/cli/init/writePackageJson.js.map +2 -2
  134. package/lib/cli/lint/annotate/buildkite/eslint.js +37 -3
  135. package/lib/cli/lint/annotate/buildkite/eslint.js.map +1 -1
  136. package/lib/cli/lint/annotate/buildkite/index.js +45 -11
  137. package/lib/cli/lint/annotate/buildkite/index.js.map +1 -1
  138. package/lib/cli/lint/annotate/buildkite/internal.js +37 -3
  139. package/lib/cli/lint/annotate/buildkite/internal.js.map +1 -1
  140. package/lib/cli/lint/annotate/buildkite/prettier.js +37 -3
  141. package/lib/cli/lint/annotate/buildkite/prettier.js.map +1 -1
  142. package/lib/cli/lint/annotate/buildkite/tsc.js +37 -3
  143. package/lib/cli/lint/annotate/buildkite/tsc.js.map +1 -1
  144. package/lib/cli/lint/annotate/github/eslint.js +26 -2
  145. package/lib/cli/lint/annotate/github/eslint.js.map +1 -1
  146. package/lib/cli/lint/annotate/github/index.js +45 -11
  147. package/lib/cli/lint/annotate/github/index.js.map +1 -1
  148. package/lib/cli/lint/annotate/github/internal.js +26 -2
  149. package/lib/cli/lint/annotate/github/internal.js.map +1 -1
  150. package/lib/cli/lint/annotate/github/prettier.js +26 -2
  151. package/lib/cli/lint/annotate/github/prettier.js.map +1 -1
  152. package/lib/cli/lint/annotate/github/tsc.js +28 -4
  153. package/lib/cli/lint/annotate/github/tsc.js.map +2 -2
  154. package/lib/cli/lint/annotate/index.js +30 -6
  155. package/lib/cli/lint/annotate/index.js.map +1 -1
  156. package/lib/{src/cli → cli}/lint/autofix.d.ts +5 -0
  157. package/lib/cli/lint/autofix.js +80 -40
  158. package/lib/cli/lint/autofix.js.map +2 -2
  159. package/lib/cli/lint/eslint.js +51 -16
  160. package/lib/cli/lint/eslint.js.map +3 -3
  161. package/lib/cli/lint/external.js +51 -19
  162. package/lib/cli/lint/external.js.map +2 -2
  163. package/lib/cli/lint/index.js +50 -28
  164. package/lib/cli/lint/index.js.map +2 -2
  165. package/lib/cli/lint/internal.js +44 -18
  166. package/lib/cli/lint/internal.js.map +2 -2
  167. package/lib/cli/lint/internalLints/detectBadCodeowners.js +33 -8
  168. package/lib/cli/lint/internalLints/detectBadCodeowners.js.map +1 -1
  169. package/lib/cli/lint/internalLints/noSkubaTemplateJs.js +46 -14
  170. package/lib/cli/lint/internalLints/noSkubaTemplateJs.js.map +3 -3
  171. package/lib/cli/lint/internalLints/patchRenovateConfig.js +55 -21
  172. package/lib/cli/lint/internalLints/patchRenovateConfig.js.map +2 -2
  173. package/lib/cli/lint/internalLints/refreshConfigFiles.js +64 -35
  174. package/lib/cli/lint/internalLints/refreshConfigFiles.js.map +3 -3
  175. package/lib/{src/cli → cli}/lint/internalLints/upgrade/index.d.ts +2 -2
  176. package/lib/cli/lint/internalLints/upgrade/index.js +105 -41
  177. package/lib/cli/lint/internalLints/upgrade/index.js.map +3 -3
  178. package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/index.js +28 -4
  179. package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/index.js.map +1 -1
  180. package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/removeYarnIgnoreOptionalFlags.js +45 -11
  181. package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/removeYarnIgnoreOptionalFlags.js.map +2 -2
  182. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/index.js +30 -6
  183. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/index.js.map +1 -1
  184. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/migrateNpmrcToPnpmWorkspace.js +65 -34
  185. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/migrateNpmrcToPnpmWorkspace.js.map +2 -2
  186. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/stopBundlingInCDKTests.js +46 -11
  187. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/stopBundlingInCDKTests.js.map +2 -2
  188. package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/index.js +28 -4
  189. package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/index.js.map +1 -1
  190. package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/unhandledRejections.js +59 -23
  191. package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/unhandledRejections.js.map +2 -2
  192. package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/index.js +28 -4
  193. package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/index.js.map +1 -1
  194. package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/patchJestSnapshots.js +46 -11
  195. package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/patchJestSnapshots.js.map +2 -2
  196. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/index.js +30 -6
  197. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/index.js.map +1 -1
  198. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchApiTokenFromEnvironment.js +46 -11
  199. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchApiTokenFromEnvironment.js.map +2 -2
  200. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchDockerfileSyntaxDirective.js +46 -11
  201. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchDockerfileSyntaxDirective.js.map +2 -2
  202. package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/index.js +28 -4
  203. package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/index.js.map +1 -1
  204. package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/patchDockerfileCIVariable.js +46 -11
  205. package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/patchDockerfileCIVariable.js.map +2 -2
  206. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/configureTsConfigForESM.js +67 -29
  207. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/configureTsConfigForESM.js.map +2 -2
  208. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/index.js +34 -10
  209. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/index.js.map +1 -1
  210. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/patchApiDockerfiles.js +45 -11
  211. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/patchApiDockerfiles.js.map +2 -2
  212. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/rewriteSrcImports.js +63 -17
  213. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/rewriteSrcImports.js.map +2 -2
  214. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/updateLambdaConfigs.js +50 -15
  215. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/updateLambdaConfigs.js.map +2 -2
  216. package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/index.js +40 -0
  217. package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/index.js.map +7 -0
  218. package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/patchRootTsconfig.d.ts +3 -0
  219. package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/patchRootTsconfig.js +149 -0
  220. package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/patchRootTsconfig.js.map +7 -0
  221. package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/upgradeNode.js +55 -0
  222. package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/upgradeNode.js.map +7 -0
  223. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/addEmptyExports.js +51 -17
  224. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/addEmptyExports.js.map +2 -2
  225. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/index.js +34 -10
  226. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/index.js.map +1 -1
  227. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchDockerfile.js +44 -10
  228. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchDockerfile.js.map +2 -2
  229. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchServerListener.js +46 -12
  230. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchServerListener.js.map +2 -2
  231. package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/index.js +28 -4
  232. package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/index.js.map +1 -1
  233. package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/patchPnpmPackageManager.js +49 -15
  234. package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/patchPnpmPackageManager.js.map +2 -2
  235. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/collapseDuplicateMergeKeys.js +45 -11
  236. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/collapseDuplicateMergeKeys.js.map +2 -2
  237. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/index.js +34 -10
  238. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/index.js.map +1 -1
  239. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/moveNpmrcMounts.js +45 -11
  240. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/moveNpmrcMounts.js.map +2 -2
  241. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerCompose.js +45 -11
  242. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerCompose.js.map +2 -2
  243. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerImages.js +47 -13
  244. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerImages.js.map +2 -2
  245. package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/index.js +28 -4
  246. package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/index.js.map +1 -1
  247. package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/patchPnpmDockerImages.js +45 -11
  248. package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/patchPnpmDockerImages.js.map +2 -2
  249. package/lib/cli/lint/prettier.js +50 -15
  250. package/lib/cli/lint/prettier.js.map +3 -3
  251. package/lib/cli/lint/tsc.js +28 -4
  252. package/lib/cli/lint/tsc.js.map +1 -1
  253. package/lib/cli/lint/types.js +16 -0
  254. package/lib/cli/lint/types.js.map +3 -3
  255. package/lib/cli/migrate/index.d.ts +6 -0
  256. package/lib/cli/migrate/index.js +79 -15
  257. package/lib/cli/migrate/index.js.map +2 -2
  258. package/lib/cli/migrate/nodeVersion/checks.d.ts +1 -0
  259. package/lib/cli/migrate/nodeVersion/checks.js +51 -120
  260. package/lib/cli/migrate/nodeVersion/checks.js.map +2 -2
  261. package/lib/cli/migrate/nodeVersion/index.d.ts +10 -0
  262. package/lib/cli/migrate/nodeVersion/index.js +239 -65
  263. package/lib/cli/migrate/nodeVersion/index.js.map +3 -3
  264. package/lib/cli/migrate/nodeVersion/upgrade.d.ts +8 -0
  265. package/lib/cli/migrate/nodeVersion/upgrade.js +179 -0
  266. package/lib/cli/migrate/nodeVersion/upgrade.js.map +7 -0
  267. package/lib/cli/node/index.js +57 -20
  268. package/lib/cli/node/index.js.map +3 -3
  269. package/lib/cli/release/index.js +28 -4
  270. package/lib/cli/release/index.js.map +1 -1
  271. package/lib/cli/start/index.js +50 -16
  272. package/lib/cli/start/index.js.map +3 -3
  273. package/lib/cli/test/index.js +44 -4
  274. package/lib/cli/test/index.js.map +2 -2
  275. package/lib/cli/test/reporters/github/annotations.d.ts +9 -0
  276. package/lib/cli/test/reporters/github/annotations.js +102 -0
  277. package/lib/cli/test/reporters/github/annotations.js.map +7 -0
  278. package/lib/cli/test/reporters/github/index.d.ts +5 -0
  279. package/lib/cli/test/reporters/github/index.js +74 -0
  280. package/lib/cli/test/reporters/github/index.js.map +7 -0
  281. package/lib/cli/version/index.js +30 -6
  282. package/lib/cli/version/index.js.map +1 -1
  283. package/lib/{src/index.d.ts → index.d.ts} +1 -0
  284. package/lib/index.js +46 -6
  285. package/lib/index.js.map +2 -2
  286. package/lib/skuba.js +45 -26
  287. package/lib/skuba.js.map +3 -3
  288. package/lib/utils/args.js +43 -6
  289. package/lib/utils/args.js.map +2 -2
  290. package/lib/utils/command.js +42 -4
  291. package/lib/utils/command.js.map +3 -3
  292. package/lib/utils/copy.js +57 -20
  293. package/lib/utils/copy.js.map +2 -2
  294. package/lib/utils/dir.js +72 -32
  295. package/lib/utils/dir.js.map +2 -2
  296. package/lib/utils/env.js +26 -2
  297. package/lib/utils/env.js.map +1 -1
  298. package/lib/utils/error.js +47 -10
  299. package/lib/utils/error.js.map +1 -1
  300. package/lib/{src/utils → utils}/exec.d.ts +3 -2
  301. package/lib/utils/exec.js +62 -24
  302. package/lib/utils/exec.js.map +3 -3
  303. package/lib/utils/fs.js +40 -6
  304. package/lib/utils/fs.js.map +2 -2
  305. package/lib/utils/help.js +30 -6
  306. package/lib/utils/help.js.map +1 -1
  307. package/lib/{src/utils → utils}/logging.d.ts +9 -10
  308. package/lib/utils/logging.js +38 -11
  309. package/lib/utils/logging.js.map +2 -2
  310. package/lib/utils/logo.js +52 -25
  311. package/lib/utils/logo.js.map +2 -2
  312. package/lib/{src/utils → utils}/manifest.d.ts +2 -3
  313. package/lib/utils/manifest.js +48 -8
  314. package/lib/utils/manifest.js.map +3 -3
  315. package/lib/utils/npmrc.js +26 -2
  316. package/lib/utils/npmrc.js.map +1 -1
  317. package/lib/utils/packageManager.js +49 -12
  318. package/lib/utils/packageManager.js.map +2 -2
  319. package/lib/utils/port.js +39 -4
  320. package/lib/utils/port.js.map +2 -2
  321. package/lib/utils/sleep.js +26 -2
  322. package/lib/utils/sleep.js.map +1 -1
  323. package/lib/utils/template.js +55 -18
  324. package/lib/utils/template.js.map +3 -3
  325. package/lib/utils/validation.js +31 -2
  326. package/lib/utils/validation.js.map +1 -1
  327. package/lib/utils/version.js +46 -9
  328. package/lib/utils/version.js.map +2 -2
  329. package/lib/utils/wait.js +32 -7
  330. package/lib/utils/wait.js.map +1 -1
  331. package/lib/{src/utils → utils}/worker.d.ts +3 -3
  332. package/lib/utils/worker.js +35 -10
  333. package/lib/utils/worker.js.map +1 -1
  334. package/lib/wrapper/function-arguments.d.js +1 -0
  335. package/lib/wrapper/functionHandler.js +49 -18
  336. package/lib/wrapper/functionHandler.js.map +2 -2
  337. package/lib/wrapper/http.js +43 -8
  338. package/lib/wrapper/http.js.map +2 -2
  339. package/lib/wrapper/index.js +7 -6
  340. package/lib/wrapper/index.js.map +1 -1
  341. package/lib/wrapper/main.js +42 -8
  342. package/lib/wrapper/main.js.map +3 -3
  343. package/lib/wrapper/requestListener.js +47 -13
  344. package/lib/wrapper/requestListener.js.map +2 -2
  345. package/lib/wrapper/server.js +28 -4
  346. package/lib/wrapper/server.js.map +2 -2
  347. package/package.json +43 -45
  348. package/template/base/_.prettierrc.js +1 -1
  349. package/template/base/_eslint.config.js +1 -1
  350. package/template/base/_pnpm-workspace.yaml +4 -3
  351. package/template/base/jest.config.ts +19 -0
  352. package/template/base/jest.setup.ts +3 -0
  353. package/template/express-rest-api/.buildkite/pipeline.yml +1 -1
  354. package/template/express-rest-api/.nvmrc +1 -1
  355. package/template/express-rest-api/package.json +8 -9
  356. package/template/express-rest-api/skuba.template.js +1 -1
  357. package/template/express-rest-api/src/app.test.ts +0 -1
  358. package/template/greeter/.buildkite/pipeline.yml +1 -1
  359. package/template/greeter/.nvmrc +1 -1
  360. package/template/greeter/package.json +4 -5
  361. package/template/greeter/skuba.template.js +1 -1
  362. package/template/greeter/src/app.test.ts +1 -3
  363. package/template/koa-rest-api/.buildkite/pipeline.yml +1 -1
  364. package/template/koa-rest-api/.nvmrc +1 -1
  365. package/template/koa-rest-api/package.json +9 -11
  366. package/template/koa-rest-api/skuba.template.js +1 -1
  367. package/template/koa-rest-api/src/api/jobs/getJobs.test.ts +0 -2
  368. package/template/koa-rest-api/src/api/jobs/postJob.test.ts +0 -2
  369. package/template/koa-rest-api/src/app.test.ts +0 -2
  370. package/template/koa-rest-api/src/framework/server.test.ts +2 -2
  371. package/template/koa-rest-api/src/framework/validation.test.ts +0 -2
  372. package/template/koa-rest-api/src/testing/metrics.ts +0 -2
  373. package/template/lambda-sqs-worker-cdk/.buildkite/pipeline.yml +2 -2
  374. package/template/lambda-sqs-worker-cdk/.nvmrc +1 -1
  375. package/template/lambda-sqs-worker-cdk/infra/__snapshots__/appStack.test.ts.snap +7 -21
  376. package/template/lambda-sqs-worker-cdk/infra/appStack.test.ts +9 -11
  377. package/template/lambda-sqs-worker-cdk/infra/appStack.ts +3 -3
  378. package/template/lambda-sqs-worker-cdk/infra/config.ts +2 -4
  379. package/template/lambda-sqs-worker-cdk/package.json +9 -9
  380. package/template/lambda-sqs-worker-cdk/skuba.template.js +13 -1
  381. package/template/lambda-sqs-worker-cdk/src/app.test.ts +13 -22
  382. package/template/lambda-sqs-worker-cdk/src/framework/handler.test.ts +0 -1
  383. package/template/lambda-sqs-worker-cdk/src/framework/validation.test.ts +31 -33
  384. package/template/lambda-sqs-worker-cdk/src/services/jobScorer.test.ts +2 -8
  385. package/template/lambda-sqs-worker-cdk/src/services/pipelineEventSender.test.ts +2 -3
  386. package/template/lambda-sqs-worker-cdk/src/testing/services.ts +3 -4
  387. package/template/oss-npm-package/.github/workflows/release.yml +1 -1
  388. package/template/oss-npm-package/.github/workflows/validate.yml +1 -1
  389. package/template/oss-npm-package/.nvmrc +1 -1
  390. package/template/oss-npm-package/_package.json +0 -1
  391. package/template/oss-npm-package/skuba.template.js +1 -1
  392. package/template/oss-npm-package/src/index.test.ts +0 -2
  393. package/template/private-npm-package/.nvmrc +1 -1
  394. package/template/private-npm-package/_package.json +1 -2
  395. package/template/private-npm-package/skuba.template.js +2 -2
  396. package/template/private-npm-package/src/index.test.ts +0 -2
  397. package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/index.js +0 -11
  398. package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/index.js.map +0 -7
  399. package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/upgradeNode.js +0 -34
  400. package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/upgradeNode.js.map +0 -7
  401. package/lib/config/prettier.d.ts +0 -7
  402. package/lib/enquirer.d.js +0 -1
  403. package/lib/enquirer.d.js.map +0 -7
  404. package/lib/eslint.d.js +0 -1
  405. package/lib/eslint.d.js.map +0 -7
  406. package/lib/src/cli/build/esbuild.d.ts +0 -6
  407. package/lib/src/cli/configure/processing/package.d.ts +0 -5
  408. package/lib/src/cli/migrate/index.d.ts +0 -1
  409. package/lib/src/cli/migrate/nodeVersion/checks.d.ts +0 -14
  410. package/lib/src/cli/migrate/nodeVersion/index.d.ts +0 -4
  411. package/template/base/vitest.config.ts +0 -25
  412. package/lib/{src/cli → cli}/adapter/eslint.d.ts +0 -0
  413. package/lib/{src/cli → cli}/adapter/prettier.d.ts +0 -0
  414. package/lib/{src/cli → cli}/build/args.d.ts +0 -0
  415. package/lib/{src/cli → cli}/build/index.d.ts +0 -0
  416. package/lib/{src/cli → cli}/build/tsc.d.ts +0 -0
  417. package/lib/{src/cli → cli}/buildPackage/index.d.ts +0 -0
  418. package/lib/{src/cli → cli}/configure/analyseConfiguration.d.ts +0 -0
  419. package/lib/{src/cli → cli}/configure/analysis/diff.d.ts +0 -0
  420. package/lib/{src/cli → cli}/configure/analysis/files.d.ts +0 -0
  421. package/lib/{src/cli → cli}/configure/analysis/git.d.ts +0 -0
  422. package/lib/{src/cli → cli}/configure/analysis/project.d.ts +0 -0
  423. package/lib/{src/cli → cli}/configure/dependencies/index.d.ts +0 -0
  424. package/lib/{src/cli → cli}/configure/dependencies/seekDatadogCustomMetrics.d.ts +0 -0
  425. package/lib/{src/cli → cli}/configure/dependencies/seekKoala.d.ts +0 -0
  426. package/lib/{src/cli → cli}/configure/dependencies/skuba.d.ts +0 -0
  427. package/lib/{src/cli → cli}/configure/dependencies/skubaDeps.d.ts +0 -0
  428. package/lib/{src/cli → cli}/configure/dependencies/skubaDive.d.ts +0 -0
  429. package/lib/{src/cli → cli}/configure/index.d.ts +0 -0
  430. package/lib/{src/cli → cli}/configure/modules/eslint.d.ts +0 -0
  431. package/lib/{src/cli → cli}/configure/modules/ignore.d.ts +0 -0
  432. package/lib/{src/cli → cli}/configure/modules/index.d.ts +0 -0
  433. package/lib/{src/cli → cli}/configure/modules/nodemon.d.ts +0 -0
  434. package/lib/{src/cli → cli}/configure/modules/package.d.ts +0 -0
  435. package/lib/{src/cli → cli}/configure/modules/prettier.d.ts +0 -0
  436. package/lib/{src/cli → cli}/configure/modules/renovate.d.ts +0 -0
  437. package/lib/{src/cli → cli}/configure/modules/serverless.d.ts +0 -0
  438. package/lib/{src/cli → cli}/configure/modules/tslint.d.ts +0 -0
  439. package/lib/{src/cli → cli}/configure/processing/configFile.d.ts +0 -0
  440. package/lib/{src/cli → cli}/configure/processing/deleteFiles.d.ts +0 -0
  441. package/lib/{src/cli → cli}/configure/processing/javascript.d.ts +0 -0
  442. package/lib/{src/cli → cli}/configure/processing/json.d.ts +0 -0
  443. package/lib/{src/cli → cli}/configure/processing/loadFiles.d.ts +0 -0
  444. package/lib/{src/cli → cli}/configure/processing/module.d.ts +0 -0
  445. package/lib/{src/cli → cli}/configure/processing/prettier.d.ts +0 -0
  446. package/lib/{src/cli → cli}/configure/processing/record.d.ts +0 -0
  447. package/lib/{src/cli → cli}/configure/processing/typescript.d.ts +0 -0
  448. package/lib/{src/cli → cli}/format/index.d.ts +0 -0
  449. package/lib/{src/cli → cli}/help/index.d.ts +0 -0
  450. package/lib/{src/cli → cli}/init/git.d.ts +0 -0
  451. package/lib/{src/cli → cli}/init/index.d.ts +0 -0
  452. package/lib/{src/cli → cli}/init/types.d.ts +1 -1
  453. /package/lib/{src/cli → cli}/init/validation.d.ts +0 -0
  454. /package/lib/{src/cli → cli}/init/writePackageJson.d.ts +0 -0
  455. /package/lib/{src/cli → cli}/lint/annotate/buildkite/eslint.d.ts +0 -0
  456. /package/lib/{src/cli → cli}/lint/annotate/buildkite/index.d.ts +0 -0
  457. /package/lib/{src/cli → cli}/lint/annotate/buildkite/internal.d.ts +0 -0
  458. /package/lib/{src/cli → cli}/lint/annotate/buildkite/prettier.d.ts +0 -0
  459. /package/lib/{src/cli → cli}/lint/annotate/buildkite/tsc.d.ts +0 -0
  460. /package/lib/{src/cli → cli}/lint/annotate/github/eslint.d.ts +0 -0
  461. /package/lib/{src/cli → cli}/lint/annotate/github/index.d.ts +0 -0
  462. /package/lib/{src/cli → cli}/lint/annotate/github/internal.d.ts +0 -0
  463. /package/lib/{src/cli → cli}/lint/annotate/github/prettier.d.ts +0 -0
  464. /package/lib/{src/cli → cli}/lint/annotate/github/tsc.d.ts +0 -0
  465. /package/lib/{src/cli → cli}/lint/annotate/index.d.ts +0 -0
  466. /package/lib/{src/cli → cli}/lint/eslint.d.ts +0 -0
  467. /package/lib/{src/cli → cli}/lint/external.d.ts +0 -0
  468. /package/lib/{src/cli → cli}/lint/index.d.ts +0 -0
  469. /package/lib/{src/cli → cli}/lint/internal.d.ts +0 -0
  470. /package/lib/{src/cli → cli}/lint/internalLints/detectBadCodeowners.d.ts +0 -0
  471. /package/lib/{src/cli → cli}/lint/internalLints/noSkubaTemplateJs.d.ts +0 -0
  472. /package/lib/{src/cli → cli}/lint/internalLints/patchRenovateConfig.d.ts +0 -0
  473. /package/lib/{src/cli → cli}/lint/internalLints/refreshConfigFiles.d.ts +0 -0
  474. /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/10.0.4/index.d.ts +0 -0
  475. /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/10.0.4/removeYarnIgnoreOptionalFlags.d.ts +0 -0
  476. /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/10.1.0/index.d.ts +0 -0
  477. /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/10.1.0/migrateNpmrcToPnpmWorkspace.d.ts +0 -0
  478. /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/10.1.0/stopBundlingInCDKTests.d.ts +0 -0
  479. /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/12.0.2/index.d.ts +0 -0
  480. /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/12.0.2/unhandledRejections.d.ts +0 -0
  481. /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/12.1.1/index.d.ts +0 -0
  482. /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/12.1.1/patchJestSnapshots.d.ts +0 -0
  483. /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/12.3.0/index.d.ts +0 -0
  484. /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/12.3.0/patchApiTokenFromEnvironment.d.ts +0 -0
  485. /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/12.3.0/patchDockerfileSyntaxDirective.d.ts +0 -0
  486. /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/12.4.0/index.d.ts +0 -0
  487. /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/12.4.0/patchDockerfileCIVariable.d.ts +0 -0
  488. /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/12.4.1/configureTsConfigForESM.d.ts +0 -0
  489. /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/12.4.1/index.d.ts +0 -0
  490. /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/12.4.1/patchApiDockerfiles.d.ts +0 -0
  491. /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/12.4.1/rewriteSrcImports.d.ts +0 -0
  492. /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/12.4.1/updateLambdaConfigs.d.ts +0 -0
  493. /package/lib/{src/cli/lint/internalLints/upgrade/patches/7.3.1 → cli/lint/internalLints/upgrade/patches/13.1.1}/index.d.ts +0 -0
  494. /package/lib/{src/cli/lint/internalLints/upgrade/patches/9.1.0 → cli/lint/internalLints/upgrade/patches/13.1.1}/upgradeNode.d.ts +0 -0
  495. /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/7.3.1/addEmptyExports.d.ts +0 -0
  496. /package/lib/{src/cli/lint/internalLints/upgrade/patches/8.0.0 → cli/lint/internalLints/upgrade/patches/7.3.1}/index.d.ts +0 -0
  497. /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/7.3.1/patchDockerfile.d.ts +0 -0
  498. /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/7.3.1/patchServerListener.d.ts +0 -0
  499. /package/lib/{src/cli/lint/internalLints/upgrade/patches/8.2.1 → cli/lint/internalLints/upgrade/patches/8.0.0}/index.d.ts +0 -0
  500. /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/8.0.0/patchPnpmPackageManager.d.ts +0 -0
  501. /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/8.2.1/collapseDuplicateMergeKeys.d.ts +0 -0
  502. /package/lib/{src/cli/lint/internalLints/upgrade/patches/9.0.1 → cli/lint/internalLints/upgrade/patches/8.2.1}/index.d.ts +0 -0
  503. /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/8.2.1/moveNpmrcMounts.d.ts +0 -0
  504. /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/8.2.1/patchDockerCompose.d.ts +0 -0
  505. /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/8.2.1/patchDockerImages.d.ts +0 -0
  506. /package/lib/{src/cli/lint/internalLints/upgrade/patches/9.1.0 → cli/lint/internalLints/upgrade/patches/9.0.1}/index.d.ts +0 -0
  507. /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/9.0.1/patchPnpmDockerImages.d.ts +0 -0
  508. /package/lib/{src/cli → cli}/lint/prettier.d.ts +0 -0
  509. /package/lib/{src/cli → cli}/lint/tsc.d.ts +0 -0
  510. /package/lib/{src/cli → cli}/lint/types.d.ts +0 -0
  511. /package/lib/{src/cli → cli}/node/index.d.ts +0 -0
  512. /package/lib/{src/cli → cli}/release/index.d.ts +0 -0
  513. /package/lib/{src/cli → cli}/start/index.d.ts +0 -0
  514. /package/lib/{src/cli → cli}/test/index.d.ts +0 -0
  515. /package/lib/{src/cli → cli}/version/index.d.ts +0 -0
  516. /package/lib/{src/skuba.d.ts → skuba.d.ts} +0 -0
  517. /package/lib/{src/utils → utils}/args.d.ts +0 -0
  518. /package/lib/{src/utils → utils}/command.d.ts +0 -0
  519. /package/lib/{src/utils → utils}/copy.d.ts +0 -0
  520. /package/lib/{src/utils → utils}/dir.d.ts +0 -0
  521. /package/lib/{src/utils → utils}/env.d.ts +0 -0
  522. /package/lib/{src/utils → utils}/error.d.ts +0 -0
  523. /package/lib/{src/utils → utils}/fs.d.ts +0 -0
  524. /package/lib/{src/utils → utils}/help.d.ts +0 -0
  525. /package/lib/{src/utils → utils}/logo.d.ts +0 -0
  526. /package/lib/{src/utils → utils}/npmrc.d.ts +0 -0
  527. /package/lib/{src/utils → utils}/packageManager.d.ts +0 -0
  528. /package/lib/{src/utils → utils}/port.d.ts +0 -0
  529. /package/lib/{src/utils → utils}/sleep.d.ts +0 -0
  530. /package/lib/{src/utils → utils}/template.d.ts +0 -0
  531. /package/lib/{src/utils → utils}/validation.d.ts +0 -0
  532. /package/lib/{src/utils → utils}/version.d.ts +0 -0
  533. /package/lib/{src/utils → utils}/wait.d.ts +0 -0
  534. /package/lib/{src/wrapper → wrapper}/functionHandler.d.ts +0 -0
  535. /package/lib/{src/wrapper → wrapper}/http.d.ts +0 -0
  536. /package/lib/{src/wrapper → wrapper}/index.d.ts +0 -0
  537. /package/lib/{src/wrapper → wrapper}/main.d.ts +0 -0
  538. /package/lib/{src/wrapper → wrapper}/requestListener.d.ts +0 -0
  539. /package/lib/{src/wrapper → wrapper}/server.d.ts +0 -0
@@ -1,25 +1,56 @@
1
- import path from "path";
2
- import { pathExists } from "../../../utils/fs.js";
3
- import { getConsumerManifest } from "../../../utils/manifest.js";
4
- import { detectPackageManager } from "../../../utils/packageManager.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 noSkubaTemplateJs_exports = {};
30
+ __export(noSkubaTemplateJs_exports, {
31
+ noSkubaTemplateJs: () => noSkubaTemplateJs
32
+ });
33
+ module.exports = __toCommonJS(noSkubaTemplateJs_exports);
34
+ var import_path = __toESM(require("path"));
35
+ var import_fs = require("../../../utils/fs.js");
36
+ var import_manifest = require("../../../utils/manifest.js");
37
+ var import_packageManager = require("../../../utils/packageManager.js");
5
38
  const noSkubaTemplateJs = async (_mode, logger) => {
6
39
  const [manifest, packageManager] = await Promise.all([
7
- getConsumerManifest(),
8
- detectPackageManager()
40
+ (0, import_manifest.getConsumerManifest)(),
41
+ (0, import_packageManager.detectPackageManager)()
9
42
  ]);
10
43
  if (!manifest) {
11
44
  return { ok: true, fixable: false };
12
45
  }
13
- const templateConfigPath = path.join(
14
- path.dirname(manifest.path),
46
+ const templateConfigPath = import_path.default.join(
47
+ import_path.default.dirname(manifest.path),
15
48
  "skuba.template.js"
16
49
  );
17
- if (await pathExists(templateConfigPath)) {
50
+ if (await (0, import_fs.pathExists)(templateConfigPath)) {
18
51
  logger.err(
19
52
  `Template is incomplete; run ${logger.bold(
20
- packageManager.print.exec,
21
- "skuba",
22
- "configure"
53
+ `${packageManager.print.exec} skuba configure`
23
54
  )}. ${logger.dim("no-skuba-template-js")}`
24
55
  );
25
56
  return {
@@ -35,7 +66,8 @@ const noSkubaTemplateJs = async (_mode, logger) => {
35
66
  }
36
67
  return { ok: true, fixable: false };
37
68
  };
38
- export {
69
+ // Annotate the CommonJS export names for ESM import in node:
70
+ 0 && (module.exports = {
39
71
  noSkubaTemplateJs
40
- };
72
+ });
41
73
  //# sourceMappingURL=noSkubaTemplateJs.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/cli/lint/internalLints/noSkubaTemplateJs.ts"],
4
- "sourcesContent": ["import path from 'path';\n\nimport { pathExists } from '../../../utils/fs.js';\nimport type { Logger } from '../../../utils/logging.js';\nimport { getConsumerManifest } from '../../../utils/manifest.js';\nimport { detectPackageManager } from '../../../utils/packageManager.js';\nimport type { InternalLintResult } from '../internal.js';\n\nexport const noSkubaTemplateJs = async (\n _mode: 'format' | 'lint',\n logger: Logger,\n): Promise<InternalLintResult> => {\n const [manifest, packageManager] = await Promise.all([\n getConsumerManifest(),\n detectPackageManager(),\n ]);\n\n if (!manifest) {\n // This will throw elsewhere\n return { ok: true, fixable: false };\n }\n\n const templateConfigPath = path.join(\n path.dirname(manifest.path),\n 'skuba.template.js',\n );\n\n if (await pathExists(templateConfigPath)) {\n logger.err(\n `Template is incomplete; run ${logger.bold(\n packageManager.print.exec,\n 'skuba',\n 'configure',\n )}. ${logger.dim('no-skuba-template-js')}`,\n );\n\n return {\n ok: false,\n fixable: false,\n annotations: [\n {\n path: 'skuba.template.js',\n message: `Template is incomplete; run ${packageManager.print.exec} skuba configure.`,\n },\n ],\n };\n }\n\n return { ok: true, fixable: false };\n};\n"],
5
- "mappings": "AAAA,OAAO,UAAU;AAEjB,SAAS,kBAAkB;AAE3B,SAAS,2BAA2B;AACpC,SAAS,4BAA4B;AAG9B,MAAM,oBAAoB,OAC/B,OACA,WACgC;AAChC,QAAM,CAAC,UAAU,cAAc,IAAI,MAAM,QAAQ,IAAI;AAAA,IACnD,oBAAoB;AAAA,IACpB,qBAAqB;AAAA,EACvB,CAAC;AAED,MAAI,CAAC,UAAU;AAEb,WAAO,EAAE,IAAI,MAAM,SAAS,MAAM;AAAA,EACpC;AAEA,QAAM,qBAAqB,KAAK;AAAA,IAC9B,KAAK,QAAQ,SAAS,IAAI;AAAA,IAC1B;AAAA,EACF;AAEA,MAAI,MAAM,WAAW,kBAAkB,GAAG;AACxC,WAAO;AAAA,MACL,+BAA+B,OAAO;AAAA,QACpC,eAAe,MAAM;AAAA,QACrB;AAAA,QACA;AAAA,MACF,CAAC,KAAK,OAAO,IAAI,sBAAsB,CAAC;AAAA,IAC1C;AAEA,WAAO;AAAA,MACL,IAAI;AAAA,MACJ,SAAS;AAAA,MACT,aAAa;AAAA,QACX;AAAA,UACE,MAAM;AAAA,UACN,SAAS,+BAA+B,eAAe,MAAM,IAAI;AAAA,QACnE;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,SAAO,EAAE,IAAI,MAAM,SAAS,MAAM;AACpC;",
6
- "names": []
4
+ "sourcesContent": ["import path from 'path';\n\nimport { pathExists } from '../../../utils/fs.js';\nimport type { Logger } from '../../../utils/logging.js';\nimport { getConsumerManifest } from '../../../utils/manifest.js';\nimport { detectPackageManager } from '../../../utils/packageManager.js';\nimport type { InternalLintResult } from '../internal.js';\n\nexport const noSkubaTemplateJs = async (\n _mode: 'format' | 'lint',\n logger: Logger,\n): Promise<InternalLintResult> => {\n const [manifest, packageManager] = await Promise.all([\n getConsumerManifest(),\n detectPackageManager(),\n ]);\n\n if (!manifest) {\n // This will throw elsewhere\n return { ok: true, fixable: false };\n }\n\n const templateConfigPath = path.join(\n path.dirname(manifest.path),\n 'skuba.template.js',\n );\n\n if (await pathExists(templateConfigPath)) {\n logger.err(\n `Template is incomplete; run ${logger.bold(\n `${packageManager.print.exec} skuba configure`,\n )}. ${logger.dim('no-skuba-template-js')}`,\n );\n\n return {\n ok: false,\n fixable: false,\n annotations: [\n {\n path: 'skuba.template.js',\n message: `Template is incomplete; run ${packageManager.print.exec} skuba configure.`,\n },\n ],\n };\n }\n\n return { ok: true, fixable: false };\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,gBAA2B;AAE3B,sBAAoC;AACpC,4BAAqC;AAG9B,MAAM,oBAAoB,OAC/B,OACA,WACgC;AAChC,QAAM,CAAC,UAAU,cAAc,IAAI,MAAM,QAAQ,IAAI;AAAA,QACnD,qCAAoB;AAAA,QACpB,4CAAqB;AAAA,EACvB,CAAC;AAED,MAAI,CAAC,UAAU;AAEb,WAAO,EAAE,IAAI,MAAM,SAAS,MAAM;AAAA,EACpC;AAEA,QAAM,qBAAqB,YAAAA,QAAK;AAAA,IAC9B,YAAAA,QAAK,QAAQ,SAAS,IAAI;AAAA,IAC1B;AAAA,EACF;AAEA,MAAI,UAAM,sBAAW,kBAAkB,GAAG;AACxC,WAAO;AAAA,MACL,+BAA+B,OAAO;AAAA,QACpC,GAAG,eAAe,MAAM,IAAI;AAAA,MAC9B,CAAC,KAAK,OAAO,IAAI,sBAAsB,CAAC;AAAA,IAC1C;AAEA,WAAO;AAAA,MACL,IAAI;AAAA,MACJ,SAAS;AAAA,MACT,aAAa;AAAA,QACX;AAAA,UACE,MAAM;AAAA,UACN,SAAS,+BAA+B,eAAe,MAAM,IAAI;AAAA,QACnE;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,SAAO,EAAE,IAAI,MAAM,SAAS,MAAM;AACpC;",
6
+ "names": ["path"]
7
7
  }
@@ -1,13 +1,46 @@
1
- import path from "path";
2
- import { inspect } from "util";
3
- import fs from "fs-extra";
4
- import * as fleece from "golden-fleece";
5
- import * as z from "zod/v4";
6
- import { log } from "../../../utils/logging.js";
7
- import { createDestinationFileReader } from "../../configure/analysis/project.js";
8
- import { RENOVATE_CONFIG_FILENAMES } from "../../configure/modules/renovate.js";
9
- import { formatPrettier } from "../../configure/processing/prettier.js";
10
- import * as Git from "@skuba-lib/api/git";
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 patchRenovateConfig_exports = {};
30
+ __export(patchRenovateConfig_exports, {
31
+ tryPatchRenovateConfig: () => tryPatchRenovateConfig
32
+ });
33
+ module.exports = __toCommonJS(patchRenovateConfig_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 fleece = __toESM(require("golden-fleece"));
38
+ var z = __toESM(require("zod/v4"));
39
+ var import_logging = require("../../../utils/logging.js");
40
+ var import_project = require("../../configure/analysis/project.js");
41
+ var import_renovate = require("../../configure/modules/renovate.js");
42
+ var import_prettier = require("../../configure/processing/prettier.js");
43
+ var Git = __toESM(require("@skuba-lib/api/git"));
11
44
  const EXISTING_REPO_PRESET_REGEX = /(github|local)>(seek-jobs|seekasia)\//;
12
45
  const renovateConfigSchema = z.object({
13
46
  extends: z.array(z.string())
@@ -30,9 +63,9 @@ const patchJson = async ({ filepath, input, presetToAdd }) => {
30
63
  return;
31
64
  }
32
65
  config.data.extends.unshift(presetToAdd);
33
- await fs.promises.writeFile(
66
+ await import_fs_extra.default.promises.writeFile(
34
67
  filepath,
35
- await formatPrettier(JSON.stringify(config.data), { parser: "json" })
68
+ await (0, import_prettier.formatPrettier)(JSON.stringify(config.data), { parser: "json" })
36
69
  );
37
70
  return;
38
71
  };
@@ -43,9 +76,9 @@ const patchJson5 = async ({ filepath, input, presetToAdd }) => {
43
76
  return;
44
77
  }
45
78
  config.data.extends.unshift(presetToAdd);
46
- await fs.promises.writeFile(
79
+ await import_fs_extra.default.promises.writeFile(
47
80
  filepath,
48
- await formatPrettier(fleece.patch(input, config.data), { parser: "json5" })
81
+ await (0, import_prettier.formatPrettier)(fleece.patch(input, config.data), { parser: "json5" })
49
82
  );
50
83
  return;
51
84
  };
@@ -54,7 +87,7 @@ const patchByFiletype = {
54
87
  json5: patchJson5
55
88
  };
56
89
  const patchRenovateConfig = async (mode, dir) => {
57
- const readFile = createDestinationFileReader(dir);
90
+ const readFile = (0, import_project.createDestinationFileReader)(dir);
58
91
  const { owner } = await Git.getOwnerAndRepo({ dir });
59
92
  const presetToAdd = ownerToRenovatePreset(owner);
60
93
  if (!presetToAdd) {
@@ -64,7 +97,7 @@ const patchRenovateConfig = async (mode, dir) => {
64
97
  };
65
98
  }
66
99
  const maybeConfigs = await Promise.all(
67
- RENOVATE_CONFIG_FILENAMES.map(async (filepath) => ({
100
+ import_renovate.RENOVATE_CONFIG_FILENAMES.map(async (filepath) => ({
68
101
  input: await readFile(filepath),
69
102
  filepath
70
103
  }))
@@ -90,7 +123,7 @@ const patchRenovateConfig = async (mode, dir) => {
90
123
  const filetype = config.filepath.toLowerCase().endsWith(".json5") ? "json5" : "json";
91
124
  const patchFile = patchByFiletype[filetype];
92
125
  await patchFile({
93
- filepath: path.resolve(dir, config.filepath),
126
+ filepath: import_path.default.resolve(dir, config.filepath),
94
127
  input: config.input,
95
128
  presetToAdd
96
129
  });
@@ -107,12 +140,13 @@ const tryPatchRenovateConfig = (async ({
107
140
  }
108
141
  return await patchRenovateConfig(mode, gitRoot);
109
142
  } catch (err) {
110
- log.warn("Failed to patch Renovate config.");
111
- log.subtle(inspect(err));
143
+ import_logging.log.warn("Failed to patch Renovate config.");
144
+ import_logging.log.subtle((0, import_util.inspect)(err));
112
145
  return { result: "skip", reason: "due to an error" };
113
146
  }
114
147
  });
115
- export {
148
+ // Annotate the CommonJS export names for ESM import in node:
149
+ 0 && (module.exports = {
116
150
  tryPatchRenovateConfig
117
- };
151
+ });
118
152
  //# sourceMappingURL=patchRenovateConfig.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/cli/lint/internalLints/patchRenovateConfig.ts"],
4
4
  "sourcesContent": ["import path from 'path';\nimport { inspect } from 'util';\n\nimport fs from 'fs-extra';\nimport * as fleece from 'golden-fleece';\nimport * as z from 'zod/v4';\n\nimport { log } from '../../../utils/logging.js';\nimport { createDestinationFileReader } from '../../configure/analysis/project.js';\nimport { RENOVATE_CONFIG_FILENAMES } from '../../configure/modules/renovate.js';\nimport { formatPrettier } from '../../configure/processing/prettier.js';\n\nimport type { PatchFunction, PatchReturnType } from './upgrade/index.js';\n\nimport * as Git from '@skuba-lib/api/git';\n\nconst EXISTING_REPO_PRESET_REGEX = /(github|local)>(seek-jobs|seekasia)\\//;\n\ntype RenovateFiletype = 'json' | 'json5';\n\ntype RenovatePreset =\n | 'local>seekasia/renovate-config'\n | 'local>seek-jobs/renovate-config';\n\nconst renovateConfigSchema = z.object({\n extends: z.array(z.string()),\n});\n\nconst ownerToRenovatePreset = (owner: string): RenovatePreset | undefined => {\n const lowercaseOwner = owner.toLowerCase();\n\n switch (lowercaseOwner) {\n case 'seekasia':\n return 'local>seekasia/renovate-config';\n\n case 'seek-jobs':\n return 'local>seek-jobs/renovate-config';\n\n default:\n return;\n }\n};\n\ntype PatchFile = (props: {\n filepath: string;\n input: string;\n presetToAdd: RenovatePreset;\n}) => Promise<void>;\n\nconst patchJson: PatchFile = async ({ filepath, input, presetToAdd }) => {\n const json: unknown = JSON.parse(input);\n\n const config = renovateConfigSchema.safeParse(json);\n\n if (!config.success) {\n return;\n }\n\n config.data.extends.unshift(presetToAdd);\n\n await fs.promises.writeFile(\n filepath,\n await formatPrettier(JSON.stringify(config.data), { parser: 'json' }),\n );\n\n return;\n};\n\nconst patchJson5: PatchFile = async ({ filepath, input, presetToAdd }) => {\n const json: unknown = fleece.evaluate(input);\n\n const config = renovateConfigSchema.safeParse(json);\n\n if (!config.success) {\n return;\n }\n\n config.data.extends.unshift(presetToAdd);\n\n await fs.promises.writeFile(\n filepath,\n await formatPrettier(fleece.patch(input, config.data), { parser: 'json5' }),\n );\n\n return;\n};\n\nconst patchByFiletype: Record<RenovateFiletype, PatchFile> = {\n json: patchJson,\n json5: patchJson5,\n};\n\nconst patchRenovateConfig = async (\n mode: 'format' | 'lint',\n dir: string,\n): Promise<PatchReturnType> => {\n const readFile = createDestinationFileReader(dir);\n\n const { owner } = await Git.getOwnerAndRepo({ dir });\n\n const presetToAdd = ownerToRenovatePreset(owner);\n\n if (!presetToAdd) {\n return {\n result: 'skip',\n reason: 'owner does not map to a SEEK preset',\n };\n }\n\n const maybeConfigs = await Promise.all(\n RENOVATE_CONFIG_FILENAMES.map(async (filepath) => ({\n input: await readFile(filepath),\n filepath,\n })),\n );\n\n const config = maybeConfigs.find((maybeConfig) => Boolean(maybeConfig.input));\n if (!config?.input) {\n return { result: 'skip', reason: 'no config found' };\n }\n\n if (\n // The file appears to mention the baseline preset for the configured Git\n // owner. This is a naive check for simplicity.\n config.input.includes(presetToAdd) ||\n // Ignore any renovate configuration which already extends a SEEK-Jobs or seekasia config\n EXISTING_REPO_PRESET_REGEX.exec(config.input)\n ) {\n return {\n result: 'skip',\n reason: 'config already has a SEEK preset',\n };\n }\n\n if (mode === 'lint') {\n return { result: 'apply' };\n }\n\n const filetype: RenovateFiletype = config.filepath\n .toLowerCase()\n .endsWith('.json5')\n ? 'json5'\n : 'json';\n\n const patchFile = patchByFiletype[filetype];\n\n await patchFile({\n filepath: path.resolve(dir, config.filepath),\n input: config.input,\n presetToAdd,\n });\n\n return { result: 'apply' };\n};\n\nexport const tryPatchRenovateConfig = (async ({\n mode,\n dir = process.cwd(),\n}) => {\n try {\n // In a monorepo we may be invoked within a subdirectory, but we are working\n // with Renovate config that should be relative to the repository root.\n const gitRoot = await Git.findRoot({ dir });\n if (!gitRoot) {\n return { result: 'skip', reason: 'no Git root found' };\n }\n\n return await patchRenovateConfig(mode, gitRoot);\n } catch (err) {\n log.warn('Failed to patch Renovate config.');\n log.subtle(inspect(err));\n return { result: 'skip', reason: 'due to an error' };\n }\n}) satisfies PatchFunction;\n"],
5
- "mappings": "AAAA,OAAO,UAAU;AACjB,SAAS,eAAe;AAExB,OAAO,QAAQ;AACf,YAAY,YAAY;AACxB,YAAY,OAAO;AAEnB,SAAS,WAAW;AACpB,SAAS,mCAAmC;AAC5C,SAAS,iCAAiC;AAC1C,SAAS,sBAAsB;AAI/B,YAAY,SAAS;AAErB,MAAM,6BAA6B;AAQnC,MAAM,uBAAuB,EAAE,OAAO;AAAA,EACpC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC;AAC7B,CAAC;AAED,MAAM,wBAAwB,CAAC,UAA8C;AAC3E,QAAM,iBAAiB,MAAM,YAAY;AAEzC,UAAQ,gBAAgB;AAAA,IACtB,KAAK;AACH,aAAO;AAAA,IAET,KAAK;AACH,aAAO;AAAA,IAET;AACE;AAAA,EACJ;AACF;AAQA,MAAM,YAAuB,OAAO,EAAE,UAAU,OAAO,YAAY,MAAM;AACvE,QAAM,OAAgB,KAAK,MAAM,KAAK;AAEtC,QAAM,SAAS,qBAAqB,UAAU,IAAI;AAElD,MAAI,CAAC,OAAO,SAAS;AACnB;AAAA,EACF;AAEA,SAAO,KAAK,QAAQ,QAAQ,WAAW;AAEvC,QAAM,GAAG,SAAS;AAAA,IAChB;AAAA,IACA,MAAM,eAAe,KAAK,UAAU,OAAO,IAAI,GAAG,EAAE,QAAQ,OAAO,CAAC;AAAA,EACtE;AAEA;AACF;AAEA,MAAM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S,aAAa,KAAK,CAAC,gBAAgB,QAAQ,YAAY,KAAK,CAAC;AAC5E,MAAI,CAAC,QAAQ,OAAO;AAClB,WAAO,EAAE,QAAQ,QAAQ,QAAQ,kBAAkB;AAAA,EACrD;AAEA;AAAA;AAAA;AAAA,IAGE,OAAO,MAAM,SAAS,WAAW;AAAA,IAEjC,2BAA2B,KAAK,OAAO,KAAK;AAAA,IAC5C;AACA,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,QAAQ;AAAA,IACV;AAAA,EACF;AAEA,MAAI,SAAS,QAAQ;AACnB,WAAO,EAAE,QAAQ,QAAQ;AAAA,EAC3B;AAEA,QAAM,WAA6B,OAAO,SACvC,YAAY,EACZ,SAAS,QAAQ,IAChB,UACA;AAEJ,QAAM,YAAY,gBAAgB,QAAQ;AAE1C,QAAM,UAAU;AAAA,IACd,UAAU,YAAAC,QAAK,QAAQ,KAAK,OAAO,QAAQ;AAAA,IAC3C,OAAO,OAAO;AAAA,IACd;AAAA,EACF,CAAC;AAED,SAAO,EAAE,QAAQ,QAAQ;AAC3B;AAEO,MAAM,0BAA0B,OAAO;AAAA,EAC5C;AAAA,EACA,MAAM,QAAQ,IAAI;AACpB,MAAM;AACJ,MAAI;AAGF,UAAM,UAAU,MAAM,IAAI,SAAS,EAAE,IAAI,CAAC;AAC1C,QAAI,CAAC,SAAS;AACZ,aAAO,EAAE,QAAQ,QAAQ,QAAQ,oBAAoB;AAAA,IACvD;AAEA,WAAO,MAAM,oBAAoB,MAAM,OAAO;AAAA,EAChD,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", "path"]
7
7
  }
@@ -1,18 +1,48 @@
1
- import path from "path";
2
- import { inspect, stripVTControlCharacters as stripAnsi } from "util";
3
- import fs from "fs-extra";
4
- import { Git } from "../../../index.js";
5
- import {
6
- findCurrentWorkspaceProjectRoot,
7
- findWorkspaceRoot
8
- } from "../../../utils/dir.js";
9
- import {
10
- detectPackageManager
11
- } from "../../../utils/packageManager.js";
12
- import { readBaseTemplateFile } from "../../../utils/template.js";
13
- import { getDestinationManifest } from "../../configure/analysis/package.js";
14
- import { createDestinationFileReader } from "../../configure/analysis/project.js";
15
- import { mergeWithConfigFile } from "../../configure/processing/configFile.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 refreshConfigFiles_exports = {};
30
+ __export(refreshConfigFiles_exports, {
31
+ REFRESHABLE_CONFIG_FILES: () => REFRESHABLE_CONFIG_FILES,
32
+ refreshConfigFiles: () => refreshConfigFiles,
33
+ tryRefreshConfigFiles: () => tryRefreshConfigFiles
34
+ });
35
+ module.exports = __toCommonJS(refreshConfigFiles_exports);
36
+ var import_path = __toESM(require("path"));
37
+ var import_util = require("util");
38
+ var import_fs_extra = __toESM(require("fs-extra"));
39
+ var import__ = require("../../../index.js");
40
+ var import_dir = require("../../../utils/dir.js");
41
+ var import_packageManager = require("../../../utils/packageManager.js");
42
+ var import_template = require("../../../utils/template.js");
43
+ var import_package = require("../../configure/analysis/package.js");
44
+ var import_project = require("../../configure/analysis/project.js");
45
+ var import_configFile = require("../../configure/processing/configFile.js");
16
46
  const OLD_IGNORE_WARNING = `# Ignore .npmrc. This is no longer managed by skuba as pnpm projects use a managed .npmrc.
17
47
  # IMPORTANT: if migrating to pnpm, remove this line and add an .npmrc IN THE SAME COMMIT.
18
48
  # You can use \`skuba format\` to generate the file or otherwise commit an empty file.
@@ -41,13 +71,13 @@ const REFRESHABLE_CONFIG_FILES = [
41
71
  ];
42
72
  const refreshConfigFiles = async (mode, logger) => {
43
73
  const [manifest, gitRoot, workspaceRoot, currentWorkspaceProjectRoot] = await Promise.all([
44
- getDestinationManifest(),
45
- Git.findRoot({ dir: process.cwd() }),
46
- findWorkspaceRoot(),
47
- findCurrentWorkspaceProjectRoot()
74
+ (0, import_package.getDestinationManifest)(),
75
+ import__.Git.findRoot({ dir: process.cwd() }),
76
+ (0, import_dir.findWorkspaceRoot)(),
77
+ (0, import_dir.findCurrentWorkspaceProjectRoot)()
48
78
  ]);
49
- const destinationRoot = path.dirname(manifest.path);
50
- const readDestinationFile = createDestinationFileReader(destinationRoot);
79
+ const destinationRoot = import_path.default.dirname(manifest.path);
80
+ const readDestinationFile = (0, import_project.createDestinationFileReader)(destinationRoot);
51
81
  const refreshConfigFile = async ({
52
82
  name: filename,
53
83
  type: fileType,
@@ -60,10 +90,10 @@ const refreshConfigFiles = async (mode, logger) => {
60
90
  const maybeReadPackageJson = async (type) => type === "pnpm-workspace" ? await readDestinationFile("package.json") : void 0;
61
91
  const [inputFile, templateFile, isGitIgnored, packageJson] = await Promise.all([
62
92
  readDestinationFile(filename),
63
- readBaseTemplateFile(`_${filename}`),
64
- gitRoot ? Git.isFileGitIgnored({
93
+ (0, import_template.readBaseTemplateFile)(`_${filename}`),
94
+ gitRoot ? import__.Git.isFileGitIgnored({
65
95
  gitRoot,
66
- absolutePath: path.join(destinationRoot, filename)
96
+ absolutePath: import_path.default.join(destinationRoot, filename)
67
97
  }) : false,
68
98
  maybeReadPackageJson(fileType)
69
99
  ]);
@@ -71,15 +101,15 @@ const refreshConfigFiles = async (mode, logger) => {
71
101
  return { needsChange: false };
72
102
  }
73
103
  const data = additionalMapping(
74
- inputFile ? mergeWithConfigFile(templateFile, fileType, packageJson)(inputFile) : templateFile,
104
+ inputFile ? (0, import_configFile.mergeWithConfigFile)(templateFile, fileType, packageJson)(inputFile) : templateFile,
75
105
  packageManager
76
106
  );
77
- const filepath = path.join(destinationRoot, filename);
107
+ const filepath = import_path.default.join(destinationRoot, filename);
78
108
  if (mode === "format") {
79
109
  if (data === inputFile) {
80
110
  return { needsChange: false };
81
111
  }
82
- await fs.writeFile(filepath, data);
112
+ await import_fs_extra.default.writeFile(filepath, data);
83
113
  return {
84
114
  needsChange: false,
85
115
  msg: `Refreshed ${logger.bold(filename)}.`,
@@ -92,16 +122,14 @@ const refreshConfigFiles = async (mode, logger) => {
92
122
  msg: `The ${logger.bold(
93
123
  filename
94
124
  )} file is out of date. Run \`${logger.bold(
95
- packageManager.print.exec,
96
- "skuba",
97
- "format"
125
+ `${packageManager.print.exec} skuba format`
98
126
  )}\` to update it.`,
99
127
  filename
100
128
  };
101
129
  }
102
130
  return { needsChange: false };
103
131
  };
104
- const packageManager = await detectPackageManager(destinationRoot);
132
+ const packageManager = await (0, import_packageManager.detectPackageManager)(destinationRoot);
105
133
  const results = await Promise.all(
106
134
  REFRESHABLE_CONFIG_FILES.map(
107
135
  (conf) => refreshConfigFile(conf, {
@@ -123,7 +151,7 @@ const refreshConfigFiles = async (mode, logger) => {
123
151
  ({ needsChange, filename, msg }) => needsChange && msg ? [
124
152
  {
125
153
  path: filename,
126
- message: stripAnsi(msg)
154
+ message: (0, import_util.stripVTControlCharacters)(msg)
127
155
  }
128
156
  ] : []
129
157
  )
@@ -134,7 +162,7 @@ const tryRefreshConfigFiles = async (mode, logger) => {
134
162
  return await refreshConfigFiles(mode, logger);
135
163
  } catch (err) {
136
164
  logger.warn("Failed to refresh config files.");
137
- logger.subtle(inspect(err));
165
+ logger.subtle((0, import_util.inspect)(err));
138
166
  return {
139
167
  ok: false,
140
168
  fixable: false,
@@ -142,9 +170,10 @@ const tryRefreshConfigFiles = async (mode, logger) => {
142
170
  };
143
171
  }
144
172
  };
145
- export {
173
+ // Annotate the CommonJS export names for ESM import in node:
174
+ 0 && (module.exports = {
146
175
  REFRESHABLE_CONFIG_FILES,
147
176
  refreshConfigFiles,
148
177
  tryRefreshConfigFiles
149
- };
178
+ });
150
179
  //# sourceMappingURL=refreshConfigFiles.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/cli/lint/internalLints/refreshConfigFiles.ts"],
4
- "sourcesContent": ["import path from 'path';\nimport { inspect, stripVTControlCharacters as stripAnsi } from 'util';\n\nimport fs from 'fs-extra';\n\nimport { Git } from '../../../index.js';\nimport {\n findCurrentWorkspaceProjectRoot,\n findWorkspaceRoot,\n} from '../../../utils/dir.js';\nimport type { Logger } from '../../../utils/logging.js';\nimport {\n type PackageManagerConfig,\n detectPackageManager,\n} from '../../../utils/packageManager.js';\nimport { readBaseTemplateFile } from '../../../utils/template.js';\nimport { getDestinationManifest } from '../../configure/analysis/package.js';\nimport { createDestinationFileReader } from '../../configure/analysis/project.js';\nimport { mergeWithConfigFile } from '../../configure/processing/configFile.js';\nimport type { InternalLintResult } from '../internal.js';\n\ntype ConditionOptions = {\n packageManager: PackageManagerConfig;\n isInWorkspaceRoot: boolean;\n};\n\ntype RefreshableConfigFile = {\n name: string;\n type: 'ignore' | 'pnpm-workspace';\n additionalMapping?: (\n s: string,\n packageManager: PackageManagerConfig,\n ) => string;\n if?: (options: ConditionOptions) => boolean;\n};\n\nconst OLD_IGNORE_WARNING = `# Ignore .npmrc. This is no longer managed by skuba as pnpm projects use a managed .npmrc.\n# IMPORTANT: if migrating to pnpm, remove this line and add an .npmrc IN THE SAME COMMIT.\n# You can use \\`skuba format\\` to generate the file or otherwise commit an empty file.\n# Doing so will conflict with a local .npmrc and make it more difficult to unintentionally commit auth secrets.\n.npmrc\n`;\n\nconst removeOldWarning = (contents: string) =>\n contents.includes(OLD_IGNORE_WARNING)\n ? `${contents.replace(OLD_IGNORE_WARNING, '').trim()}\\n`\n : contents;\n\nexport const REFRESHABLE_CONFIG_FILES: RefreshableConfigFile[] = [\n {\n name: '.gitignore',\n type: 'ignore',\n additionalMapping: removeOldWarning,\n },\n { name: '.prettierignore', type: 'ignore' },\n {\n name: 'pnpm-workspace.yaml',\n type: 'pnpm-workspace',\n if: ({ packageManager, isInWorkspaceRoot }) =>\n isInWorkspaceRoot && packageManager.command === 'pnpm',\n },\n {\n name: '.dockerignore',\n type: 'ignore',\n additionalMapping: removeOldWarning,\n },\n];\n\nexport const refreshConfigFiles = async (\n mode: 'format' | 'lint',\n logger: Logger,\n) => {\n const [manifest, gitRoot, workspaceRoot, currentWorkspaceProjectRoot] =\n await Promise.all([\n getDestinationManifest(),\n Git.findRoot({ dir: process.cwd() }),\n findWorkspaceRoot(),\n findCurrentWorkspaceProjectRoot(),\n ]);\n\n const destinationRoot = path.dirname(manifest.path);\n\n const readDestinationFile = createDestinationFileReader(destinationRoot);\n\n const refreshConfigFile = async (\n {\n name: filename,\n type: fileType,\n additionalMapping = (s) => s,\n if: condition = () => true,\n }: RefreshableConfigFile,\n conditionOptions: ConditionOptions,\n ) => {\n if (!condition(conditionOptions)) {\n return { needsChange: false };\n }\n\n const maybeReadPackageJson = async (type: RefreshableConfigFile['type']) =>\n type === 'pnpm-workspace'\n ? await readDestinationFile('package.json')\n : undefined;\n\n const [inputFile, templateFile, isGitIgnored, packageJson] =\n await Promise.all([\n readDestinationFile(filename),\n readBaseTemplateFile(`_${filename}`),\n gitRoot\n ? Git.isFileGitIgnored({\n gitRoot,\n absolutePath: path.join(destinationRoot, filename),\n })\n : false,\n maybeReadPackageJson(fileType),\n ]);\n\n // If the file is gitignored and doesn't exist, don't make it\n if (inputFile === undefined && isGitIgnored) {\n return { needsChange: false };\n }\n\n const data = additionalMapping(\n inputFile\n ? mergeWithConfigFile(templateFile, fileType, packageJson)(inputFile)\n : templateFile,\n packageManager,\n );\n\n const filepath = path.join(destinationRoot, filename);\n\n if (mode === 'format') {\n if (data === inputFile) {\n return { needsChange: false };\n }\n\n await fs.writeFile(filepath, data);\n return {\n needsChange: false,\n msg: `Refreshed ${logger.bold(filename)}.`,\n filename,\n };\n }\n\n if (data !== inputFile) {\n return {\n needsChange: true,\n msg: `The ${logger.bold(\n filename,\n )} file is out of date. Run \\`${logger.bold(\n packageManager.print.exec,\n 'skuba',\n 'format',\n )}\\` to update it.`,\n filename,\n };\n }\n\n return { needsChange: false };\n };\n\n const packageManager = await detectPackageManager(destinationRoot);\n\n const results = await Promise.all(\n REFRESHABLE_CONFIG_FILES.map((conf) =>\n refreshConfigFile(conf, {\n packageManager,\n isInWorkspaceRoot: workspaceRoot === currentWorkspaceProjectRoot,\n }),\n ),\n );\n\n // Log after for reproducible test output ordering\n results.forEach((result) => {\n if (result.msg) {\n logger.warn(result.msg);\n }\n });\n\n const anyNeedChanging = results.some(({ needsChange }) => needsChange);\n\n return {\n ok: !anyNeedChanging,\n fixable: anyNeedChanging,\n annotations: results.flatMap(({ needsChange, filename, msg }) =>\n needsChange && msg\n ? [\n {\n path: filename,\n message: stripAnsi(msg),\n },\n ]\n : [],\n ),\n };\n};\n\nexport const tryRefreshConfigFiles = async (\n mode: 'format' | 'lint',\n logger: Logger,\n): Promise<InternalLintResult> => {\n try {\n return await refreshConfigFiles(mode, logger);\n } catch (err) {\n logger.warn('Failed to refresh config files.');\n logger.subtle(inspect(err));\n\n return {\n ok: false,\n fixable: false,\n annotations: [],\n };\n }\n};\n"],
5
- "mappings": "AAAA,OAAO,UAAU;AACjB,SAAS,SAAS,4BAA4B,iBAAiB;AAE/D,OAAO,QAAQ;AAEf,SAAS,WAAW;AACpB;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAEP;AAAA,EAEE;AAAA,OACK;AACP,SAAS,4BAA4B;AACrC,SAAS,8BAA8B;AACvC,SAAS,mCAAmC;AAC5C,SAAS,2BAA2B;AAkBpC,MAAM,qBAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAO3B,MAAM,mBAAmB,CAAC,aACxB,SAAS,SAAS,kBAAkB,IAChC,GAAG,SAAS,QAAQ,oBAAoB,EAAE,EAAE,KAAK,CAAC;AAAA,IAClD;AAEC,MAAM,2BAAoD;AAAA,EAC/D;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,mBAAmB;AAAA,EACrB;AAAA,EACA,EAAE,MAAM,mBAAmB,MAAM,SAAS;AAAA,EAC1C;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,IAAI,CAAC,EAAE,gBAAgB,kBAAkB,MACvC,qBAAqB,eAAe,YAAY;AAAA,EACpD;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,mBAAmB;AAAA,EACrB;AACF;AAEO,MAAM,qBAAqB,OAChC,MACA,WACG;AACH,QAAM,CAAC,UAAU,SAAS,eAAe,2BAA2B,IAClE,MAAM,QAAQ,IAAI;AAAA,IAChB,uBAAuB;AAAA,IACvB,IAAI,SAAS,EAAE,KAAK,QAAQ,IAAI,EAAE,CAAC;AAAA,IACnC,kBAAkB;AAAA,IAClB,gCAAgC;AAAA,EAClC,CAAC;AAEH,QAAM,kBAAkB,KAAK,QAAQ,SAAS,IAAI;AAElD,QAAM,sBAAsB,4BAA4B,eAAe;AAEvE,QAAM,oBAAoB,OACx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,MACF;AAAA,IACF;AAEA,WAAO,EAAE,aAAa,MAAM;AAAA,EAC9B;AAEA,QAAM,iBAAiB,MAAM,qBAAqB,eAAe;AAEjE,QAAM,UAAU,MAAM,QAAQ;AAAA,IAC5B,yBAAyB;AAAA,MAAI,CAAC,SAC5B,kBAAkB,MAAM;AAAA,QACtB;AAAA,QACA,mBAAmB,kBAAkB;AAAA,MACvC,CAAC;AAAA,IACH;AAAA,EACF;AAGA,UAAQ,QAAQ,CAAC,WAAW;AAC1B,QAAI,OAAO,KAAK;AACd,aAAO,KAAK,OAAO,GAAG;AAAA,IACxB;AAAA,EACF,CAAC;AAED,QAAM,kBAAkB,QAAQ,KAAK,CAAC,EAAE,YAAY,MAAM,WAAW;AAErE,SAAO;AAAA,IACL,IAAI,CAAC;AAAA,IACL,SAAS;AAAA,IACT,aAAa,QAAQ;AAAA,MAAQ,CAAC,EAAE,aAAa,UAAU,IAAI,MACzD,eAAe,MACX;AAAA,QACE;AAAA,UACE,MAAM;AAAA,UACN,SAAS,UAAU,GAAG;AAAA,QACxB;AAAA,MACF,IACA,CAAC;AAAA,IACP;AAAA,EACF;AACF;AAEO,MAAM,wBAAwB,OACnC,MACA,WACgC;AAChC,MAAI;AACF,WAAO,MAAM,mBAAmB,MAAM,MAAM;AAAA,EAC9C,SAAS,KAAK;AACZ,WAAO,KAAK,iCAAiC;AAC7C,WAAO,OAAO,QAAQ,GAAG,CAAC;AAE1B,WAAO;AAAA,MACL,IAAI;AAAA,MACJ,SAAS;AAAA,MACT,aAAa,CAAC;AAAA,IAChB;AAAA,EACF;AACF;",
6
- "names": []
4
+ "sourcesContent": ["import path from 'path';\nimport { inspect, stripVTControlCharacters as stripAnsi } from 'util';\n\nimport fs from 'fs-extra';\n\nimport { Git } from '../../../index.js';\nimport {\n findCurrentWorkspaceProjectRoot,\n findWorkspaceRoot,\n} from '../../../utils/dir.js';\nimport type { Logger } from '../../../utils/logging.js';\nimport {\n type PackageManagerConfig,\n detectPackageManager,\n} from '../../../utils/packageManager.js';\nimport { readBaseTemplateFile } from '../../../utils/template.js';\nimport { getDestinationManifest } from '../../configure/analysis/package.js';\nimport { createDestinationFileReader } from '../../configure/analysis/project.js';\nimport { mergeWithConfigFile } from '../../configure/processing/configFile.js';\nimport type { InternalLintResult } from '../internal.js';\n\ntype ConditionOptions = {\n packageManager: PackageManagerConfig;\n isInWorkspaceRoot: boolean;\n};\n\ntype RefreshableConfigFile = {\n name: string;\n type: 'ignore' | 'pnpm-workspace';\n additionalMapping?: (\n s: string,\n packageManager: PackageManagerConfig,\n ) => string;\n if?: (options: ConditionOptions) => boolean;\n};\n\nconst OLD_IGNORE_WARNING = `# Ignore .npmrc. This is no longer managed by skuba as pnpm projects use a managed .npmrc.\n# IMPORTANT: if migrating to pnpm, remove this line and add an .npmrc IN THE SAME COMMIT.\n# You can use \\`skuba format\\` to generate the file or otherwise commit an empty file.\n# Doing so will conflict with a local .npmrc and make it more difficult to unintentionally commit auth secrets.\n.npmrc\n`;\n\nconst removeOldWarning = (contents: string) =>\n contents.includes(OLD_IGNORE_WARNING)\n ? `${contents.replace(OLD_IGNORE_WARNING, '').trim()}\\n`\n : contents;\n\nexport const REFRESHABLE_CONFIG_FILES: RefreshableConfigFile[] = [\n {\n name: '.gitignore',\n type: 'ignore',\n additionalMapping: removeOldWarning,\n },\n { name: '.prettierignore', type: 'ignore' },\n {\n name: 'pnpm-workspace.yaml',\n type: 'pnpm-workspace',\n if: ({ packageManager, isInWorkspaceRoot }) =>\n isInWorkspaceRoot && packageManager.command === 'pnpm',\n },\n {\n name: '.dockerignore',\n type: 'ignore',\n additionalMapping: removeOldWarning,\n },\n];\n\nexport const refreshConfigFiles = async (\n mode: 'format' | 'lint',\n logger: Logger,\n) => {\n const [manifest, gitRoot, workspaceRoot, currentWorkspaceProjectRoot] =\n await Promise.all([\n getDestinationManifest(),\n Git.findRoot({ dir: process.cwd() }),\n findWorkspaceRoot(),\n findCurrentWorkspaceProjectRoot(),\n ]);\n\n const destinationRoot = path.dirname(manifest.path);\n\n const readDestinationFile = createDestinationFileReader(destinationRoot);\n\n const refreshConfigFile = async (\n {\n name: filename,\n type: fileType,\n additionalMapping = (s) => s,\n if: condition = () => true,\n }: RefreshableConfigFile,\n conditionOptions: ConditionOptions,\n ) => {\n if (!condition(conditionOptions)) {\n return { needsChange: false };\n }\n\n const maybeReadPackageJson = async (type: RefreshableConfigFile['type']) =>\n type === 'pnpm-workspace'\n ? await readDestinationFile('package.json')\n : undefined;\n\n const [inputFile, templateFile, isGitIgnored, packageJson] =\n await Promise.all([\n readDestinationFile(filename),\n readBaseTemplateFile(`_${filename}`),\n gitRoot\n ? Git.isFileGitIgnored({\n gitRoot,\n absolutePath: path.join(destinationRoot, filename),\n })\n : false,\n maybeReadPackageJson(fileType),\n ]);\n\n // If the file is gitignored and doesn't exist, don't make it\n if (inputFile === undefined && isGitIgnored) {\n return { needsChange: false };\n }\n\n const data = additionalMapping(\n inputFile\n ? mergeWithConfigFile(templateFile, fileType, packageJson)(inputFile)\n : templateFile,\n packageManager,\n );\n\n const filepath = path.join(destinationRoot, filename);\n\n if (mode === 'format') {\n if (data === inputFile) {\n return { needsChange: false };\n }\n\n await fs.writeFile(filepath, data);\n return {\n needsChange: false,\n msg: `Refreshed ${logger.bold(filename)}.`,\n filename,\n };\n }\n\n if (data !== inputFile) {\n return {\n needsChange: true,\n msg: `The ${logger.bold(\n filename,\n )} file is out of date. Run \\`${logger.bold(\n `${packageManager.print.exec} skuba format`,\n )}\\` to update it.`,\n filename,\n };\n }\n\n return { needsChange: false };\n };\n\n const packageManager = await detectPackageManager(destinationRoot);\n\n const results = await Promise.all(\n REFRESHABLE_CONFIG_FILES.map((conf) =>\n refreshConfigFile(conf, {\n packageManager,\n isInWorkspaceRoot: workspaceRoot === currentWorkspaceProjectRoot,\n }),\n ),\n );\n\n // Log after for reproducible test output ordering\n results.forEach((result) => {\n if (result.msg) {\n logger.warn(result.msg);\n }\n });\n\n const anyNeedChanging = results.some(({ needsChange }) => needsChange);\n\n return {\n ok: !anyNeedChanging,\n fixable: anyNeedChanging,\n annotations: results.flatMap(({ needsChange, filename, msg }) =>\n needsChange && msg\n ? [\n {\n path: filename,\n message: stripAnsi(msg),\n },\n ]\n : [],\n ),\n };\n};\n\nexport const tryRefreshConfigFiles = async (\n mode: 'format' | 'lint',\n logger: Logger,\n): Promise<InternalLintResult> => {\n try {\n return await refreshConfigFiles(mode, logger);\n } catch (err) {\n logger.warn('Failed to refresh config files.');\n logger.subtle(inspect(err));\n\n return {\n ok: false,\n fixable: false,\n annotations: [],\n };\n }\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,kBAA+D;AAE/D,sBAAe;AAEf,eAAoB;AACpB,iBAGO;AAEP,4BAGO;AACP,sBAAqC;AACrC,qBAAuC;AACvC,qBAA4C;AAC5C,wBAAoC;AAkBpC,MAAM,qBAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAO3B,MAAM,mBAAmB,CAAC,aACxB,SAAS,SAAS,kBAAkB,IAChC,GAAG,SAAS,QAAQ,oBAAoB,EAAE,EAAE,KAAK,CAAC;AAAA,IAClD;AAEC,MAAM,2BAAoD;AAAA,EAC/D;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,mBAAmB;AAAA,EACrB;AAAA,EACA,EAAE,MAAM,mBAAmB,MAAM,SAAS;AAAA,EAC1C;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,IAAI,CAAC,EAAE,gBAAgB,kBAAkB,MACvC,qBAAqB,eAAe,YAAY;AAAA,EACpD;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,mBAAmB;AAAA,EACrB;AACF;AAEO,MAAM,qBAAqB,OAChC,MACA,WACG;AACH,QAAM,CAAC,UAAU,SAAS,eAAe,2BAA2B,IAClE,MAAM,QAAQ,IAAI;A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AAA,IAChB;AAAA,EACF;AACF;",
6
+ "names": ["path", "fs", "stripAnsi"]
7
7
  }
@@ -1,6 +1,6 @@
1
- import type { Logger } from '../../../../utils/logging.js';
1
+ import type { ReadResult } from 'read-pkg-up';
2
+ import { type Logger } from '../../../../utils/logging.js';
2
3
  import { type PackageManagerConfig } from '../../../../utils/packageManager.js';
3
- import type { ReadResult } from '../../../configure/types.js';
4
4
  import type { InternalLintResult } from '../../internal.js';
5
5
  export type Patches = Patch[];
6
6
  export type Patch = {