skuba 14.0.0-migrate-to-inquirer-20251031060542 → 14.0.0-replace-global-vars-20251121010036

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 (387) hide show
  1. package/config/eslint.js +1 -1
  2. package/config/prettier.d.ts +8 -4
  3. package/config/prettier.js +10 -2
  4. package/lib/cli/adapter/eslint.js +11 -45
  5. package/lib/cli/adapter/eslint.js.map +3 -3
  6. package/lib/cli/adapter/prettier.js +39 -67
  7. package/lib/cli/adapter/prettier.js.map +2 -2
  8. package/lib/cli/build/args.js +8 -42
  9. package/lib/cli/build/args.js.map +2 -2
  10. package/lib/cli/build/assets.d.ts +3 -2
  11. package/lib/cli/build/assets.js +28 -60
  12. package/lib/cli/build/assets.js.map +3 -3
  13. package/lib/cli/build/esbuild.js +21 -45
  14. package/lib/cli/build/esbuild.js.map +2 -2
  15. package/lib/cli/build/index.js +21 -55
  16. package/lib/cli/build/index.js.map +3 -3
  17. package/lib/cli/build/tsc.js +23 -61
  18. package/lib/cli/build/tsc.js.map +3 -3
  19. package/lib/cli/buildPackage/index.js +8 -32
  20. package/lib/cli/buildPackage/index.js.map +1 -1
  21. package/lib/cli/configure/analyseConfiguration.js +16 -50
  22. package/lib/cli/configure/analyseConfiguration.js.map +2 -2
  23. package/lib/cli/configure/analyseDependencies.d.ts +1 -1
  24. package/lib/cli/configure/analyseDependencies.js +25 -59
  25. package/lib/cli/configure/analyseDependencies.js.map +3 -3
  26. package/lib/cli/configure/analysis/diff.js +5 -39
  27. package/lib/cli/configure/analysis/diff.js.map +3 -3
  28. package/lib/cli/configure/analysis/files.js +8 -42
  29. package/lib/cli/configure/analysis/files.js.map +2 -2
  30. package/lib/cli/configure/analysis/git.js +12 -46
  31. package/lib/cli/configure/analysis/git.js.map +2 -2
  32. package/lib/cli/configure/analysis/package.d.ts +2 -3
  33. package/lib/cli/configure/analysis/package.js +10 -45
  34. package/lib/cli/configure/analysis/package.js.map +3 -3
  35. package/lib/cli/configure/analysis/project.js +18 -50
  36. package/lib/cli/configure/analysis/project.js.map +2 -2
  37. package/lib/cli/configure/dependencies/index.js +7 -35
  38. package/lib/cli/configure/dependencies/index.js.map +1 -1
  39. package/lib/cli/configure/dependencies/seekDatadogCustomMetrics.js +4 -28
  40. package/lib/cli/configure/dependencies/seekDatadogCustomMetrics.js.map +1 -1
  41. package/lib/cli/configure/dependencies/seekKoala.js +4 -28
  42. package/lib/cli/configure/dependencies/seekKoala.js.map +1 -1
  43. package/lib/cli/configure/dependencies/skuba.js +4 -28
  44. package/lib/cli/configure/dependencies/skuba.js.map +1 -1
  45. package/lib/cli/configure/dependencies/skubaDeps.js +2 -26
  46. package/lib/cli/configure/dependencies/skubaDeps.js.map +1 -1
  47. package/lib/cli/configure/dependencies/skubaDive.js +4 -29
  48. package/lib/cli/configure/dependencies/skubaDive.js.map +1 -1
  49. package/lib/cli/configure/ensureTemplateCompletion.d.ts +1 -1
  50. package/lib/cli/configure/ensureTemplateCompletion.js +35 -60
  51. package/lib/cli/configure/ensureTemplateCompletion.js.map +3 -3
  52. package/lib/cli/configure/getEntryPoint.d.ts +1 -1
  53. package/lib/cli/configure/getEntryPoint.js +14 -48
  54. package/lib/cli/configure/getEntryPoint.js.map +3 -3
  55. package/lib/cli/configure/getProjectType.d.ts +1 -1
  56. package/lib/cli/configure/getProjectType.js +14 -35
  57. package/lib/cli/configure/getProjectType.js.map +2 -2
  58. package/lib/cli/configure/index.js +50 -84
  59. package/lib/cli/configure/index.js.map +3 -3
  60. package/lib/cli/configure/modules/eslint.js +10 -34
  61. package/lib/cli/configure/modules/eslint.js.map +1 -1
  62. package/lib/cli/configure/modules/ignore.js +8 -32
  63. package/lib/cli/configure/modules/ignore.js.map +1 -1
  64. package/lib/cli/configure/modules/index.js +18 -44
  65. package/lib/cli/configure/modules/index.js.map +2 -2
  66. package/lib/cli/configure/modules/nodemon.js +4 -28
  67. package/lib/cli/configure/modules/nodemon.js.map +1 -1
  68. package/lib/cli/configure/modules/package.js +10 -34
  69. package/lib/cli/configure/modules/package.js.map +1 -1
  70. package/lib/cli/configure/modules/prettier.js +11 -35
  71. package/lib/cli/configure/modules/prettier.js.map +1 -1
  72. package/lib/cli/configure/modules/renovate.js +17 -40
  73. package/lib/cli/configure/modules/renovate.js.map +2 -2
  74. package/lib/cli/configure/modules/serverless.js +2 -26
  75. package/lib/cli/configure/modules/serverless.js.map +1 -1
  76. package/lib/cli/configure/modules/tslint.js +4 -28
  77. package/lib/cli/configure/modules/tslint.js.map +1 -1
  78. package/lib/cli/configure/processing/configFile.js +3 -39
  79. package/lib/cli/configure/processing/configFile.js.map +1 -1
  80. package/lib/cli/configure/processing/deleteFiles.js +2 -26
  81. package/lib/cli/configure/processing/deleteFiles.js.map +1 -1
  82. package/lib/cli/configure/processing/javascript.js +2 -27
  83. package/lib/cli/configure/processing/javascript.js.map +1 -1
  84. package/lib/cli/configure/processing/json.js +6 -31
  85. package/lib/cli/configure/processing/json.js.map +1 -1
  86. package/lib/cli/configure/processing/loadFiles.js +2 -26
  87. package/lib/cli/configure/processing/loadFiles.js.map +1 -1
  88. package/lib/cli/configure/processing/module.js +4 -28
  89. package/lib/cli/configure/processing/module.js.map +1 -1
  90. package/lib/cli/configure/processing/package.d.ts +1 -67
  91. package/lib/cli/configure/processing/package.js +8 -45
  92. package/lib/cli/configure/processing/package.js.map +3 -3
  93. package/lib/cli/configure/processing/prettier.js +4 -38
  94. package/lib/cli/configure/processing/prettier.js.map +2 -2
  95. package/lib/cli/configure/processing/record.js +5 -41
  96. package/lib/cli/configure/processing/record.js.map +2 -2
  97. package/lib/cli/configure/processing/typescript.js +26 -63
  98. package/lib/cli/configure/processing/typescript.js.map +2 -2
  99. package/lib/cli/configure/types.d.ts +15 -4
  100. package/lib/cli/configure/types.js +0 -16
  101. package/lib/cli/configure/types.js.map +3 -3
  102. package/lib/cli/format/index.js +20 -54
  103. package/lib/cli/format/index.js.map +3 -3
  104. package/lib/cli/help/index.js +6 -30
  105. package/lib/cli/help/index.js.map +1 -1
  106. package/lib/cli/init/getConfig.d.ts +1 -1
  107. package/lib/cli/init/getConfig.js +76 -104
  108. package/lib/cli/init/getConfig.js.map +3 -3
  109. package/lib/cli/init/git.js +16 -51
  110. package/lib/cli/init/git.js.map +2 -2
  111. package/lib/cli/init/index.js +67 -98
  112. package/lib/cli/init/index.js.map +2 -2
  113. package/lib/cli/init/prompts.js +21 -42
  114. package/lib/cli/init/prompts.js.map +1 -1
  115. package/lib/cli/init/types.js +7 -41
  116. package/lib/cli/init/types.js.map +1 -1
  117. package/lib/cli/init/validation.js +2 -30
  118. package/lib/cli/init/validation.js.map +1 -1
  119. package/lib/cli/init/writePackageJson.js +8 -42
  120. package/lib/cli/init/writePackageJson.js.map +2 -2
  121. package/lib/cli/lint/annotate/buildkite/eslint.js +3 -37
  122. package/lib/cli/lint/annotate/buildkite/eslint.js.map +1 -1
  123. package/lib/cli/lint/annotate/buildkite/index.js +11 -45
  124. package/lib/cli/lint/annotate/buildkite/index.js.map +1 -1
  125. package/lib/cli/lint/annotate/buildkite/internal.js +3 -37
  126. package/lib/cli/lint/annotate/buildkite/internal.js.map +1 -1
  127. package/lib/cli/lint/annotate/buildkite/prettier.js +3 -37
  128. package/lib/cli/lint/annotate/buildkite/prettier.js.map +1 -1
  129. package/lib/cli/lint/annotate/buildkite/tsc.js +3 -37
  130. package/lib/cli/lint/annotate/buildkite/tsc.js.map +1 -1
  131. package/lib/cli/lint/annotate/github/eslint.js +2 -26
  132. package/lib/cli/lint/annotate/github/eslint.js.map +1 -1
  133. package/lib/cli/lint/annotate/github/index.js +11 -45
  134. package/lib/cli/lint/annotate/github/index.js.map +1 -1
  135. package/lib/cli/lint/annotate/github/internal.js +2 -26
  136. package/lib/cli/lint/annotate/github/internal.js.map +1 -1
  137. package/lib/cli/lint/annotate/github/prettier.js +2 -26
  138. package/lib/cli/lint/annotate/github/prettier.js.map +1 -1
  139. package/lib/cli/lint/annotate/github/tsc.js +4 -28
  140. package/lib/cli/lint/annotate/github/tsc.js.map +2 -2
  141. package/lib/cli/lint/annotate/index.js +6 -30
  142. package/lib/cli/lint/annotate/index.js.map +1 -1
  143. package/lib/cli/lint/autofix.js +37 -73
  144. package/lib/cli/lint/autofix.js.map +1 -1
  145. package/lib/cli/lint/eslint.js +16 -51
  146. package/lib/cli/lint/eslint.js.map +3 -3
  147. package/lib/cli/lint/external.js +19 -51
  148. package/lib/cli/lint/external.js.map +2 -2
  149. package/lib/cli/lint/index.js +26 -52
  150. package/lib/cli/lint/index.js.map +2 -2
  151. package/lib/cli/lint/internal.js +20 -52
  152. package/lib/cli/lint/internal.js.map +3 -3
  153. package/lib/cli/lint/internalLints/detectBadCodeowners.js +8 -33
  154. package/lib/cli/lint/internalLints/detectBadCodeowners.js.map +1 -1
  155. package/lib/cli/lint/internalLints/noSkubaTemplateJs.js +12 -48
  156. package/lib/cli/lint/internalLints/noSkubaTemplateJs.js.map +3 -3
  157. package/lib/cli/lint/internalLints/patchRenovateConfig.js +21 -55
  158. package/lib/cli/lint/internalLints/patchRenovateConfig.js.map +2 -2
  159. package/lib/cli/lint/internalLints/refreshConfigFiles.js +33 -66
  160. package/lib/cli/lint/internalLints/refreshConfigFiles.js.map +3 -3
  161. package/lib/cli/lint/internalLints/upgrade/index.d.ts +1 -1
  162. package/lib/cli/lint/internalLints/upgrade/index.js +23 -56
  163. package/lib/cli/lint/internalLints/upgrade/index.js.map +3 -3
  164. package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/index.js +4 -28
  165. package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/index.js.map +1 -1
  166. package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/removeYarnIgnoreOptionalFlags.js +11 -45
  167. package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/removeYarnIgnoreOptionalFlags.js.map +2 -2
  168. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/index.js +6 -30
  169. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/index.js.map +1 -1
  170. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/migrateNpmrcToPnpmWorkspace.js +37 -65
  171. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/migrateNpmrcToPnpmWorkspace.js.map +3 -3
  172. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/stopBundlingInCDKTests.js +11 -46
  173. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/stopBundlingInCDKTests.js.map +2 -2
  174. package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/index.js +4 -28
  175. package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/index.js.map +1 -1
  176. package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/unhandledRejections.js +23 -59
  177. package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/unhandledRejections.js.map +2 -2
  178. package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/index.js +4 -28
  179. package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/index.js.map +1 -1
  180. package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/patchJestSnapshots.js +11 -46
  181. package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/patchJestSnapshots.js.map +2 -2
  182. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/index.js +6 -30
  183. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/index.js.map +1 -1
  184. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchApiTokenFromEnvironment.js +11 -46
  185. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchApiTokenFromEnvironment.js.map +2 -2
  186. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchDockerfileSyntaxDirective.js +11 -46
  187. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchDockerfileSyntaxDirective.js.map +2 -2
  188. package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/index.js +4 -28
  189. package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/index.js.map +1 -1
  190. package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/patchDockerfileCIVariable.js +11 -46
  191. package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/patchDockerfileCIVariable.js.map +2 -2
  192. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/configureTsConfigForESM.js +29 -67
  193. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/configureTsConfigForESM.js.map +2 -2
  194. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/index.js +10 -34
  195. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/index.js.map +1 -1
  196. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/patchApiDockerfiles.js +11 -45
  197. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/patchApiDockerfiles.js.map +2 -2
  198. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/rewriteSrcImports.d.ts +4 -0
  199. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/rewriteSrcImports.js +18 -63
  200. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/rewriteSrcImports.js.map +3 -3
  201. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/updateLambdaConfigs.js +15 -50
  202. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/updateLambdaConfigs.js.map +2 -2
  203. package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/addTypeModuleToPackageJson.d.ts +6 -0
  204. package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/addTypeModuleToPackageJson.js +86 -0
  205. package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/addTypeModuleToPackageJson.js.map +7 -0
  206. package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/index.d.ts +2 -0
  207. package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/index.js +16 -0
  208. package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/index.js.map +7 -0
  209. package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/rewriteGlobalVars.d.ts +7 -0
  210. package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/rewriteGlobalVars.js +76 -0
  211. package/lib/cli/lint/internalLints/upgrade/patches/12.5.0/rewriteGlobalVars.js.map +7 -0
  212. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/addEmptyExports.js +17 -51
  213. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/addEmptyExports.js.map +2 -2
  214. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/index.js +10 -34
  215. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/index.js.map +1 -1
  216. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchDockerfile.js +10 -44
  217. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchDockerfile.js.map +2 -2
  218. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchServerListener.js +12 -46
  219. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchServerListener.js.map +2 -2
  220. package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/index.js +4 -28
  221. package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/index.js.map +1 -1
  222. package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/patchPnpmPackageManager.js +15 -49
  223. package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/patchPnpmPackageManager.js.map +2 -2
  224. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/collapseDuplicateMergeKeys.js +11 -45
  225. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/collapseDuplicateMergeKeys.js.map +2 -2
  226. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/index.js +10 -39
  227. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/index.js.map +2 -2
  228. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/moveNpmrcMounts.js +11 -45
  229. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/moveNpmrcMounts.js.map +2 -2
  230. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerCompose.js +11 -45
  231. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerCompose.js.map +2 -2
  232. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerImages.js +13 -47
  233. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerImages.js.map +2 -2
  234. package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/index.js +4 -28
  235. package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/index.js.map +1 -1
  236. package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/patchPnpmDockerImages.js +11 -45
  237. package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/patchPnpmDockerImages.js.map +2 -2
  238. package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/index.js +4 -28
  239. package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/index.js.map +1 -1
  240. package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/upgradeNode.js +8 -32
  241. package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/upgradeNode.js.map +1 -1
  242. package/lib/cli/lint/prettier.js +15 -50
  243. package/lib/cli/lint/prettier.js.map +3 -3
  244. package/lib/cli/lint/tsc.js +4 -28
  245. package/lib/cli/lint/tsc.js.map +1 -1
  246. package/lib/cli/lint/types.js +0 -16
  247. package/lib/cli/lint/types.js.map +3 -3
  248. package/lib/cli/migrate/index.js +10 -34
  249. package/lib/cli/migrate/index.js.map +1 -1
  250. package/lib/cli/migrate/nodeVersion/checks.js +24 -61
  251. package/lib/cli/migrate/nodeVersion/checks.js.map +2 -2
  252. package/lib/cli/migrate/nodeVersion/index.js +25 -55
  253. package/lib/cli/migrate/nodeVersion/index.js.map +2 -2
  254. package/lib/cli/node/index.js +20 -57
  255. package/lib/cli/node/index.js.map +3 -3
  256. package/lib/cli/release/index.js +4 -28
  257. package/lib/cli/release/index.js.map +1 -1
  258. package/lib/cli/start/index.js +16 -50
  259. package/lib/cli/start/index.js.map +3 -3
  260. package/lib/cli/test/index.js +4 -44
  261. package/lib/cli/test/index.js.map +2 -2
  262. package/lib/cli/version/index.js +6 -30
  263. package/lib/cli/version/index.js.map +1 -1
  264. package/lib/eslint.d.js +0 -1
  265. package/lib/index.d.ts +0 -1
  266. package/lib/index.js +6 -46
  267. package/lib/index.js.map +2 -2
  268. package/lib/skuba.js +26 -45
  269. package/lib/skuba.js.map +3 -3
  270. package/lib/utils/args.js +6 -43
  271. package/lib/utils/args.js.map +2 -2
  272. package/lib/utils/command.js +4 -42
  273. package/lib/utils/command.js.map +3 -3
  274. package/lib/utils/copy.js +20 -57
  275. package/lib/utils/copy.js.map +2 -2
  276. package/lib/utils/dir.js +32 -72
  277. package/lib/utils/dir.js.map +2 -2
  278. package/lib/utils/env.js +2 -26
  279. package/lib/utils/env.js.map +1 -1
  280. package/lib/utils/error.js +10 -47
  281. package/lib/utils/error.js.map +1 -1
  282. package/lib/utils/exec.d.ts +3 -2
  283. package/lib/utils/exec.js +24 -62
  284. package/lib/utils/exec.js.map +3 -3
  285. package/lib/utils/fs.js +6 -40
  286. package/lib/utils/fs.js.map +3 -3
  287. package/lib/utils/help.js +6 -30
  288. package/lib/utils/help.js.map +1 -1
  289. package/lib/utils/logging.d.ts +9 -10
  290. package/lib/utils/logging.js +11 -48
  291. package/lib/utils/logging.js.map +3 -3
  292. package/lib/utils/logo.js +28 -59
  293. package/lib/utils/logo.js.map +3 -3
  294. package/lib/utils/manifest.d.ts +3 -2
  295. package/lib/utils/manifest.js +8 -48
  296. package/lib/utils/manifest.js.map +3 -3
  297. package/lib/utils/npmrc.js +2 -26
  298. package/lib/utils/npmrc.js.map +1 -1
  299. package/lib/utils/packageManager.js +12 -49
  300. package/lib/utils/packageManager.js.map +2 -2
  301. package/lib/utils/port.js +4 -39
  302. package/lib/utils/port.js.map +2 -2
  303. package/lib/utils/sleep.js +2 -26
  304. package/lib/utils/sleep.js.map +1 -1
  305. package/lib/utils/template.js +18 -55
  306. package/lib/utils/template.js.map +3 -3
  307. package/lib/utils/validation.js +2 -31
  308. package/lib/utils/validation.js.map +1 -1
  309. package/lib/utils/version.js +9 -46
  310. package/lib/utils/version.js.map +2 -2
  311. package/lib/utils/wait.js +7 -32
  312. package/lib/utils/wait.js.map +1 -1
  313. package/lib/utils/worker.d.ts +3 -3
  314. package/lib/utils/worker.js +10 -35
  315. package/lib/utils/worker.js.map +1 -1
  316. package/lib/wrapper/function-arguments.d.js +0 -1
  317. package/lib/wrapper/functionHandler.js +18 -49
  318. package/lib/wrapper/functionHandler.js.map +2 -2
  319. package/lib/wrapper/http.d.ts +0 -6
  320. package/lib/wrapper/http.js +8 -51
  321. package/lib/wrapper/http.js.map +3 -3
  322. package/lib/wrapper/index.js +6 -7
  323. package/lib/wrapper/index.js.map +1 -1
  324. package/lib/wrapper/main.js +8 -42
  325. package/lib/wrapper/main.js.map +3 -3
  326. package/lib/wrapper/requestListener.js +13 -46
  327. package/lib/wrapper/requestListener.js.map +3 -3
  328. package/lib/wrapper/server.d.ts +7 -0
  329. package/lib/wrapper/server.js +11 -0
  330. package/lib/wrapper/server.js.map +7 -0
  331. package/package.json +17 -24
  332. package/template/base/_.prettierrc.js +1 -1
  333. package/template/base/_eslint.config.js +1 -1
  334. package/template/base/_pnpm-workspace.yaml +3 -2
  335. package/template/base/vitest.config.ts +25 -0
  336. package/template/express-rest-api/package.json +2 -1
  337. package/template/express-rest-api/skuba.template.js +1 -1
  338. package/template/express-rest-api/src/app.test.ts +1 -0
  339. package/template/greeter/package.json +4 -3
  340. package/template/greeter/skuba.template.js +1 -1
  341. package/template/greeter/src/app.test.ts +3 -1
  342. package/template/koa-rest-api/package.json +2 -1
  343. package/template/koa-rest-api/skuba.template.js +1 -1
  344. package/template/koa-rest-api/src/api/jobs/getJobs.test.ts +2 -0
  345. package/template/koa-rest-api/src/api/jobs/postJob.test.ts +2 -0
  346. package/template/koa-rest-api/src/app.test.ts +2 -0
  347. package/template/koa-rest-api/src/framework/server.test.ts +2 -2
  348. package/template/koa-rest-api/src/framework/validation.test.ts +2 -0
  349. package/template/koa-rest-api/src/testing/metrics.ts +2 -0
  350. package/template/lambda-sqs-worker-cdk/infra/__snapshots__/appStack.test.ts.snap +15 -5
  351. package/template/lambda-sqs-worker-cdk/infra/appStack.test.ts +11 -9
  352. package/template/lambda-sqs-worker-cdk/package.json +6 -5
  353. package/template/lambda-sqs-worker-cdk/skuba.template.js +1 -1
  354. package/template/lambda-sqs-worker-cdk/src/app.test.ts +22 -13
  355. package/template/lambda-sqs-worker-cdk/src/framework/handler.test.ts +1 -0
  356. package/template/lambda-sqs-worker-cdk/src/framework/validation.test.ts +33 -31
  357. package/template/lambda-sqs-worker-cdk/src/services/jobScorer.test.ts +8 -2
  358. package/template/lambda-sqs-worker-cdk/src/services/pipelineEventSender.test.ts +3 -2
  359. package/template/lambda-sqs-worker-cdk/src/testing/services.ts +4 -3
  360. package/template/oss-npm-package/_package.json +1 -0
  361. package/template/oss-npm-package/skuba.template.js +1 -1
  362. package/template/oss-npm-package/src/index.test.ts +2 -0
  363. package/template/private-npm-package/_package.json +1 -0
  364. package/template/private-npm-package/skuba.template.js +1 -1
  365. package/template/private-npm-package/src/index.test.ts +2 -0
  366. package/config/jest.js +0 -1
  367. package/jest/moduleNameMapper.js +0 -64
  368. package/jest/transform.js +0 -62
  369. package/jest/tsConfig.js +0 -26
  370. package/jest-preset.js +0 -37
  371. package/lib/api/jest/index.d.ts +0 -15
  372. package/lib/api/jest/index.js +0 -59
  373. package/lib/api/jest/index.js.map +0 -7
  374. package/lib/cli/configure/modules/jest.d.ts +0 -2
  375. package/lib/cli/configure/modules/jest.js +0 -86
  376. package/lib/cli/configure/modules/jest.js.map +0 -7
  377. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/upgradeESLint.d.ts +0 -2
  378. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/upgradeESLint.js +0 -144
  379. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/upgradeESLint.js.map +0 -7
  380. package/lib/cli/test/reporters/github/annotations.d.ts +0 -9
  381. package/lib/cli/test/reporters/github/annotations.js +0 -102
  382. package/lib/cli/test/reporters/github/annotations.js.map +0 -7
  383. package/lib/cli/test/reporters/github/index.d.ts +0 -5
  384. package/lib/cli/test/reporters/github/index.js +0 -74
  385. package/lib/cli/test/reporters/github/index.js.map +0 -7
  386. package/template/base/jest.config.ts +0 -19
  387. package/template/base/jest.setup.ts +0 -3
package/config/eslint.js CHANGED
@@ -1 +1 @@
1
- module.exports = require('eslint-config-skuba');
1
+ export { default } from 'eslint-config-skuba';
@@ -1,4 +1,8 @@
1
- export const singleQuote: boolean;
2
- export const tabWidth: number;
3
- export const trailingComma: 'all';
4
- export const plugins: ['prettier-plugin-packagejson'];
1
+ declare const config: {
2
+ singleQuote: boolean;
3
+ tabWidth: number;
4
+ trailingComma: 'all';
5
+ plugins: ['prettier-plugin-packagejson'];
6
+ };
7
+
8
+ export default config;
@@ -1,6 +1,14 @@
1
- module.exports = {
1
+ /**
2
+ * @see https://prettier.io/docs/configuration
3
+ * @satisfies {import('prettier').Config}
4
+ */
5
+ const config = {
2
6
  singleQuote: true,
3
7
  tabWidth: 2,
4
8
  trailingComma: 'all',
5
- plugins: [require.resolve('prettier-plugin-packagejson')],
9
+ plugins: [
10
+ new URL(import.meta.resolve('prettier-plugin-packagejson')).pathname,
11
+ ],
6
12
  };
13
+
14
+ export default config;
@@ -1,50 +1,17 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var eslint_exports = {};
30
- __export(eslint_exports, {
31
- runESLint: () => runESLint
32
- });
33
- module.exports = __toCommonJS(eslint_exports);
34
- var import_path = __toESM(require("path"));
35
- var import_chalk = __toESM(require("chalk"));
36
- var import_eslint = require("eslint");
37
- var import_logging = require("../../utils/logging.js");
1
+ import { styleText } from "node:util";
2
+ import path from "path";
3
+ import { loadESLint } from "eslint";
4
+ import { pluralise } from "../../utils/logging.js";
38
5
  const symbolForResult = (result) => {
39
6
  if (result.errorCount) {
40
- return import_chalk.default.red("\u25CB");
7
+ return styleText("red", "\u25CB");
41
8
  }
42
- return result.warningCount ? import_chalk.default.yellow("\u25CD") : import_chalk.default.green("\u25CB");
9
+ return result.warningCount ? styleText("yellow", "\u25CD") : styleText("green", "\u25CB");
43
10
  };
44
11
  const runESLint = async (mode, logger, overrideConfigFile) => {
45
12
  logger.debug("Initialising ESLint...");
46
13
  const cwd = process.cwd();
47
- const ESLint = await (0, import_eslint.loadESLint)({ useFlatConfig: true });
14
+ const ESLint = await loadESLint({ useFlatConfig: true });
48
15
  const engine = new ESLint({
49
16
  cache: true,
50
17
  fix: mode === "format",
@@ -69,7 +36,7 @@ const runESLint = async (mode, logger, overrideConfigFile) => {
69
36
  }
70
37
  const end = process.hrtime.bigint();
71
38
  logger.plain(
72
- `Processed ${(0, import_logging.pluralise)(results.length, "file")} in ${logger.timing(
39
+ `Processed ${pluralise(results.length, "file")} in ${logger.timing(
73
40
  start,
74
41
  end
75
42
  )}.`
@@ -78,7 +45,7 @@ const runESLint = async (mode, logger, overrideConfigFile) => {
78
45
  const warnings = [];
79
46
  let fixable = false;
80
47
  for (const result of results) {
81
- const relativePath = import_path.default.relative(cwd, result.filePath);
48
+ const relativePath = path.relative(cwd, result.filePath);
82
49
  if (result.fixableErrorCount + result.fixableWarningCount) {
83
50
  fixable = true;
84
51
  }
@@ -118,8 +85,7 @@ const lintFiles = async (engine) => {
118
85
  throw error;
119
86
  }
120
87
  };
121
- // Annotate the CommonJS export names for ESM import in node:
122
- 0 && (module.exports = {
88
+ export {
123
89
  runESLint
124
- });
90
+ };
125
91
  //# sourceMappingURL=eslint.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/cli/adapter/eslint.ts"],
4
- "sourcesContent": ["import path from 'path';\n\nimport chalk from 'chalk';\nimport { type ESLint, type Linter, loadESLint } from 'eslint';\n\nimport { type Logger, pluralise } from '../../utils/logging.js';\n\nconst symbolForResult = (result: ESLint.LintResult) => {\n if (result.errorCount) {\n return chalk.red('\u25CB');\n }\n\n return result.warningCount ? chalk.yellow('\u25CD') : chalk.green('\u25CB');\n};\n\nexport interface ESLintResult {\n messages: Linter.LintMessage[];\n filePath: string;\n}\n\nexport interface ESLintOutput {\n errors: ESLintResult[];\n fixable: boolean;\n ok: boolean;\n output: string;\n warnings: ESLintResult[];\n}\n\nexport const runESLint = async (\n mode: 'format' | 'lint',\n logger: Logger,\n overrideConfigFile?: string,\n): Promise<ESLintOutput> => {\n logger.debug('Initialising ESLint...');\n\n const cwd = process.cwd();\n\n const ESLint = await loadESLint({ useFlatConfig: true });\n const engine = new ESLint({\n cache: true,\n fix: mode === 'format',\n overrideConfigFile,\n overrideConfig: {\n linterOptions: {\n reportUnusedDisableDirectives: true,\n },\n },\n });\n\n logger.debug('Processing files...');\n\n const start = process.hrtime.bigint();\n\n const [formatter, { type, results }] = await Promise.all([\n engine.loadFormatter(),\n lintFiles(engine),\n ]);\n\n if (type === 'no-config') {\n logger.plain(\n 'skuba could not find an eslint config file. Do you need to run format or configure?',\n );\n return { ok: false, fixable: false, errors: [], warnings: [], output: '' };\n }\n\n const end = process.hrtime.bigint();\n\n logger.plain(\n `Processed ${pluralise(results.length, 'file')} in ${logger.timing(\n start,\n end,\n )}.`,\n );\n\n const errors: ESLintResult[] = [];\n const warnings: ESLintResult[] = [];\n let fixable = false;\n\n for (const result of results) {\n const relativePath = path.relative(cwd, result.filePath);\n if (result.fixableErrorCount + result.fixableWarningCount) {\n fixable = true;\n }\n\n if (result.errorCount) {\n errors.push({\n filePath: relativePath,\n messages: result.messages,\n });\n }\n\n if (result.warningCount) {\n warnings.push({\n filePath: relativePath,\n messages: result.messages,\n });\n }\n\n logger.debug(symbolForResult(result), relativePath);\n }\n\n const ok = errors.length === 0;\n\n await ESLint.outputFixes(results);\n\n const output = await formatter.format(\n results,\n engine.getRulesMetaForResults(results),\n );\n\n if (output) {\n logger.plain(output);\n }\n\n return { errors, fixable, ok, output, warnings };\n};\n\nconst lintFiles = async (engine: ESLint) => {\n try {\n const result = await engine.lintFiles([]);\n return { type: 'results', results: result } as const;\n } catch (error) {\n if (\n error instanceof Error &&\n error.message === 'Could not find config file.'\n ) {\n return { type: 'no-config', results: undefined } as const;\n }\n throw error;\n }\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,mBAAkB;AAClB,oBAAqD;AAErD,qBAAuC;AAEvC,MAAM,kBAAkB,CAAC,WAA8B;AACrD,MAAI,OAAO,YAAY;AACrB,WAAO,aAAAA,QAAM,IAAI,QAAG;AAAA,EACtB;AAEA,SAAO,OAAO,eAAe,aAAAA,QAAM,OAAO,QAAG,IAAI,aAAAA,QAAM,MAAM,QAAG;AAClE;AAeO,MAAM,YAAY,OACvB,MACA,QACA,uBA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OAAO;AAAA,MACnB,CAAC;AAAA,IACH;AAEA,WAAO,MAAM,gBAAgB,MAAM,GAAG,YAAY;AAAA,EACpD;AAEA,QAAM,KAAK,OAAO,WAAW;AAE7B,QAAM,OAAO,YAAY,OAAO;AAEhC,QAAM,SAAS,MAAM,UAAU;AAAA,IAC7B;AAAA,IACA,OAAO,uBAAuB,OAAO;AAAA,EACvC;AAEA,MAAI,QAAQ;AACV,WAAO,MAAM,MAAM;AAAA,EACrB;AAEA,SAAO,EAAE,QAAQ,SAAS,IAAI,QAAQ,SAAS;AACjD;AAEA,MAAM,YAAY,OAAO,WAAmB;AAC1C,MAAI;AACF,UAAM,SAAS,MAAM,OAAO,UAAU,CAAC,CAAC;AACxC,WAAO,EAAE,MAAM,WAAW,SAAS,OAAO;AAAA,EAC5C,SAAS,OAAO;AACd,QACE,iBAAiB,SACjB,MAAM,YAAY,+BAClB;AACA,aAAO,EAAE,MAAM,aAAa,SAAS,OAAU;AAAA,IACjD;AACA,UAAM;AAAA,EACR;AACF;",
6
- "names": ["chalk", "path"]
4
+ "sourcesContent": ["import { styleText } from 'node:util';\nimport path from 'path';\n\nimport { type ESLint, type Linter, loadESLint } from 'eslint';\n\nimport { type Logger, pluralise } from '../../utils/logging.js';\n\nconst symbolForResult = (result: ESLint.LintResult) => {\n if (result.errorCount) {\n return styleText('red', '\u25CB');\n }\n\n return result.warningCount\n ? styleText('yellow', '\u25CD')\n : styleText('green', '\u25CB');\n};\n\nexport interface ESLintResult {\n messages: Linter.LintMessage[];\n filePath: string;\n}\n\nexport interface ESLintOutput {\n errors: ESLintResult[];\n fixable: boolean;\n ok: boolean;\n output: string;\n warnings: ESLintResult[];\n}\n\nexport const runESLint = async (\n mode: 'format' | 'lint',\n logger: Logger,\n overrideConfigFile?: string,\n): Promise<ESLintOutput> => {\n logger.debug('Initialising ESLint...');\n\n const cwd = process.cwd();\n\n const ESLint = await loadESLint({ useFlatConfig: true });\n const engine = new ESLint({\n cache: true,\n fix: mode === 'format',\n overrideConfigFile,\n overrideConfig: {\n linterOptions: {\n reportUnusedDisableDirectives: true,\n },\n },\n });\n\n logger.debug('Processing files...');\n\n const start = process.hrtime.bigint();\n\n const [formatter, { type, results }] = await Promise.all([\n engine.loadFormatter(),\n lintFiles(engine),\n ]);\n\n if (type === 'no-config') {\n logger.plain(\n 'skuba could not find an eslint config file. Do you need to run format or configure?',\n );\n return { ok: false, fixable: false, errors: [], warnings: [], output: '' };\n }\n\n const end = process.hrtime.bigint();\n\n logger.plain(\n `Processed ${pluralise(results.length, 'file')} in ${logger.timing(\n start,\n end,\n )}.`,\n );\n\n const errors: ESLintResult[] = [];\n const warnings: ESLintResult[] = [];\n let fixable = false;\n\n for (const result of results) {\n const relativePath = path.relative(cwd, result.filePath);\n if (result.fixableErrorCount + result.fixableWarningCount) {\n fixable = true;\n }\n\n if (result.errorCount) {\n errors.push({\n filePath: relativePath,\n messages: result.messages,\n });\n }\n\n if (result.warningCount) {\n warnings.push({\n filePath: relativePath,\n messages: result.messages,\n });\n }\n\n logger.debug(symbolForResult(result), relativePath);\n }\n\n const ok = errors.length === 0;\n\n await ESLint.outputFixes(results);\n\n const output = await formatter.format(\n results,\n engine.getRulesMetaForResults(results),\n );\n\n if (output) {\n logger.plain(output);\n }\n\n return { errors, fixable, ok, output, warnings };\n};\n\nconst lintFiles = async (engine: ESLint) => {\n try {\n const result = await engine.lintFiles([]);\n return { type: 'results', results: result } as const;\n } catch (error) {\n if (\n error instanceof Error &&\n error.message === 'Could not find config file.'\n ) {\n return { type: 'no-config', results: undefined } as const;\n }\n throw error;\n }\n};\n"],
5
+ "mappings": "AAAA,SAAS,iBAAiB;AAC1B,OAAO,UAAU;AAEjB,SAAmC,kBAAkB;AAErD,SAAsB,iBAAiB;AAEvC,MAAM,kBAAkB,CAAC,WAA8B;AACrD,MAAI,OAAO,YAAY;AACrB,WAAO,UAAU,OAAO,QAAG;AAAA,EAC7B;AAEA,SAAO,OAAO,eACV,UAAU,UAAU,QAAG,IACvB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AACvB,eAAS,KAAK;AAAA,QACZ,UAAU;AAAA,QACV,UAAU,OAAO;AAAA,MACnB,CAAC;AAAA,IACH;AAEA,WAAO,MAAM,gBAAgB,MAAM,GAAG,YAAY;AAAA,EACpD;AAEA,QAAM,KAAK,OAAO,WAAW;AAE7B,QAAM,OAAO,YAAY,OAAO;AAEhC,QAAM,SAAS,MAAM,UAAU;AAAA,IAC7B;AAAA,IACA,OAAO,uBAAuB,OAAO;AAAA,EACvC;AAEA,MAAI,QAAQ;AACV,WAAO,MAAM,MAAM;AAAA,EACrB;AAEA,SAAO,EAAE,QAAQ,SAAS,IAAI,QAAQ,SAAS;AACjD;AAEA,MAAM,YAAY,OAAO,WAAmB;AAC1C,MAAI;AACF,UAAM,SAAS,MAAM,OAAO,UAAU,CAAC,CAAC;AACxC,WAAO,EAAE,MAAM,WAAW,SAAS,OAAO;AAAA,EAC5C,SAAS,OAAO;AACd,QACE,iBAAiB,SACjB,MAAM,YAAY,+BAClB;AACA,aAAO,EAAE,MAAM,aAAa,SAAS,OAAU;AAAA,IACjD;AACA,UAAM;AAAA,EACR;AACF;",
6
+ "names": []
7
7
  }
@@ -1,49 +1,22 @@
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 prettier_exports = {};
30
- __export(prettier_exports, {
31
- formatOrLintFile: () => formatOrLintFile,
32
- inferParser: () => inferParser,
33
- runPrettier: () => runPrettier
34
- });
35
- module.exports = __toCommonJS(prettier_exports);
36
- var import_path = __toESM(require("path"));
37
- var import_fs_extra = __toESM(require("fs-extra"));
38
- var import_prettier = require("prettier");
39
- var import_dir = require("../../utils/dir.js");
40
- var import_logging = require("../../utils/logging.js");
41
- var import_manifest = require("../../utils/manifest.js");
42
- var import_package = require("../configure/processing/package.js");
1
+ import path from "path";
2
+ import fs from "fs-extra";
3
+ import {
4
+ check,
5
+ format,
6
+ getSupportInfo,
7
+ resolveConfig
8
+ } from "prettier";
9
+ import { crawlDirectory } from "../../utils/dir.js";
10
+ import { pluralise } from "../../utils/logging.js";
11
+ import { getConsumerManifest } from "../../utils/manifest.js";
12
+ import {
13
+ formatPackage,
14
+ parsePackage
15
+ } from "../configure/processing/package.js";
43
16
  let languages;
44
17
  const inferParser = async (filepath) => {
45
- const filename = import_path.default.basename(filepath).toLowerCase();
46
- languages ??= (await (0, import_prettier.getSupportInfo)()).languages;
18
+ const filename = path.basename(filepath).toLowerCase();
19
+ languages ??= (await getSupportInfo()).languages;
47
20
  const firstLanguage = languages.find(
48
21
  (language) => language.extensions?.some((extension) => filename.endsWith(extension)) || language.filenames?.some((name) => name.toLowerCase() === filename)
49
22
  );
@@ -53,12 +26,12 @@ const isPackageJsonOk = async ({
53
26
  data,
54
27
  filepath
55
28
  }) => {
56
- if (import_path.default.basename(filepath) !== "package.json") {
29
+ if (path.basename(filepath) !== "package.json") {
57
30
  return true;
58
31
  }
59
32
  try {
60
- const packageJson = (0, import_package.parsePackage)(data);
61
- return !packageJson || await (0, import_package.formatPackage)(packageJson) === data;
33
+ const packageJson = parsePackage(data);
34
+ return !packageJson || await formatPackage(packageJson) === data;
62
35
  } catch {
63
36
  }
64
37
  return true;
@@ -67,7 +40,7 @@ const formatOrLintFile = async ({ data, filepath, options }, mode, result) => {
67
40
  if (mode === "lint") {
68
41
  let ok;
69
42
  try {
70
- ok = await (0, import_prettier.check)(data, options) && await isPackageJsonOk({ data, filepath });
43
+ ok = await check(data, options) && await isPackageJsonOk({ data, filepath });
71
44
  } catch (err) {
72
45
  result?.errored.push({ err, filepath });
73
46
  return;
@@ -79,16 +52,16 @@ const formatOrLintFile = async ({ data, filepath, options }, mode, result) => {
79
52
  }
80
53
  let formatted;
81
54
  try {
82
- formatted = await (0, import_prettier.format)(data, options);
55
+ formatted = await format(data, options);
83
56
  } catch (err) {
84
57
  result?.errored.push({ err, filepath });
85
58
  return;
86
59
  }
87
60
  try {
88
- if (import_path.default.basename(filepath) === "package.json") {
89
- const packageJson = (0, import_package.parsePackage)(formatted);
61
+ if (path.basename(filepath) === "package.json") {
62
+ const packageJson = parsePackage(formatted);
90
63
  if (packageJson) {
91
- formatted = await (0, import_package.formatPackage)(packageJson);
64
+ formatted = await formatPackage(packageJson);
92
65
  }
93
66
  }
94
67
  } catch {
@@ -102,18 +75,18 @@ const formatOrLintFile = async ({ data, filepath, options }, mode, result) => {
102
75
  const runPrettier = async (mode, logger, cwd = process.cwd()) => {
103
76
  logger.debug("Initialising Prettier...");
104
77
  const start = process.hrtime.bigint();
105
- const manifest = await (0, import_manifest.getConsumerManifest)(cwd);
106
- const directory = manifest ? import_path.default.dirname(manifest.path) : cwd;
78
+ const manifest = await getConsumerManifest(cwd);
79
+ const directory = manifest ? path.dirname(manifest.path) : cwd;
107
80
  logger.debug(
108
81
  manifest ? "Detected project root:" : "Detected working directory:",
109
82
  directory
110
83
  );
111
84
  logger.debug("Discovering files...");
112
- const relativeFilepaths = await (0, import_dir.crawlDirectory)(directory, [
85
+ const relativeFilepaths = await crawlDirectory(directory, [
113
86
  ".gitignore",
114
87
  ".prettierignore"
115
88
  ]);
116
- logger.debug(`Discovered ${(0, import_logging.pluralise)(relativeFilepaths.length, "file")}.`);
89
+ logger.debug(`Discovered ${pluralise(relativeFilepaths.length, "file")}.`);
117
90
  const result = {
118
91
  count: relativeFilepaths.length,
119
92
  errored: [],
@@ -122,9 +95,9 @@ const runPrettier = async (mode, logger, cwd = process.cwd()) => {
122
95
  };
123
96
  logger.debug(mode === "format" ? "Formatting" : "Linting", "files...");
124
97
  for (const relativeFilepath of relativeFilepaths) {
125
- const filepath = import_path.default.relative(
98
+ const filepath = path.relative(
126
99
  process.cwd(),
127
- import_path.default.join(directory, relativeFilepath)
100
+ path.join(directory, relativeFilepath)
128
101
  );
129
102
  const parser = await inferParser(filepath);
130
103
  logger.debug(filepath);
@@ -134,8 +107,8 @@ const runPrettier = async (mode, logger, cwd = process.cwd()) => {
134
107
  continue;
135
108
  }
136
109
  const [config, data] = await Promise.all([
137
- (0, import_prettier.resolveConfig)(filepath),
138
- import_fs_extra.default.promises.readFile(filepath, "utf-8")
110
+ resolveConfig(filepath),
111
+ fs.promises.readFile(filepath, "utf-8")
139
112
  ]);
140
113
  const file = {
141
114
  data,
@@ -144,24 +117,24 @@ const runPrettier = async (mode, logger, cwd = process.cwd()) => {
144
117
  };
145
118
  const formatted = await formatOrLintFile(file, mode, result);
146
119
  if (typeof formatted === "string") {
147
- await import_fs_extra.default.promises.writeFile(filepath, formatted);
120
+ await fs.promises.writeFile(filepath, formatted);
148
121
  }
149
122
  }
150
123
  const end = process.hrtime.bigint();
151
124
  logger.plain(
152
- `Processed ${(0, import_logging.pluralise)(
125
+ `Processed ${pluralise(
153
126
  result.count - result.unparsed.length,
154
127
  "file"
155
128
  )} in ${logger.timing(start, end)}.`
156
129
  );
157
130
  if (result.touched.length) {
158
- logger.plain(`Formatted ${(0, import_logging.pluralise)(result.touched.length, "file")}:`);
131
+ logger.plain(`Formatted ${pluralise(result.touched.length, "file")}:`);
159
132
  for (const filepath of result.touched) {
160
133
  logger.warn(filepath);
161
134
  }
162
135
  }
163
136
  if (result.errored.length) {
164
- logger.plain(`Flagged ${(0, import_logging.pluralise)(result.errored.length, "file")}:`);
137
+ logger.plain(`Flagged ${pluralise(result.errored.length, "file")}:`);
165
138
  for (const { err, filepath } of result.errored) {
166
139
  logger.warn(
167
140
  filepath,
@@ -171,10 +144,9 @@ const runPrettier = async (mode, logger, cwd = process.cwd()) => {
171
144
  }
172
145
  return { ok: result.errored.length === 0, result };
173
146
  };
174
- // Annotate the CommonJS export names for ESM import in node:
175
- 0 && (module.exports = {
147
+ export {
176
148
  formatOrLintFile,
177
149
  inferParser,
178
150
  runPrettier
179
- });
151
+ };
180
152
  //# sourceMappingURL=prettier.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../src/cli/adapter/prettier.ts"],
4
4
  "sourcesContent": ["import path from 'path';\n\nimport fs from 'fs-extra';\nimport {\n type Options,\n type SupportLanguage,\n check,\n format,\n getSupportInfo,\n resolveConfig,\n} from 'prettier';\n\nimport { crawlDirectory } from '../../utils/dir.js';\nimport { type Logger, pluralise } from '../../utils/logging.js';\nimport { getConsumerManifest } from '../../utils/manifest.js';\nimport {\n formatPackage,\n parsePackage,\n} from '../configure/processing/package.js';\n\nlet languages: SupportLanguage[] | undefined;\n\n/**\n * Infers a parser for the specified filepath.\n *\n * This is a cut-down version of Prettier's built-in function of the same name;\n * ours operates purely on the `filepath` string and does not perform file I/O.\n * Prettier's internal `getInterpreter` function can open a file to read the\n * shebang, and its file descriptor usage can throw warnings on worker threads:\n *\n * ```console\n * Warning: File descriptor 123 closed but not opened in unmanaged mode\n * at Object.closeSync (node:fs:530:11)\n * at Object.closeSync (node_modules/graceful-fs/graceful-fs.js:74:20)\n * ...\n * ```\n *\n * References:\n *\n * - https://github.com/prettier/prettier/blob/2.4.1/src/main/options.js#L167\n * - seek-oss/skuba#659\n */\nexport const inferParser = async (\n filepath: string,\n): Promise<string | undefined> => {\n const filename = path.basename(filepath).toLowerCase();\n\n languages ??= (await getSupportInfo()).languages;\n\n const firstLanguage = languages.find(\n (language) =>\n language.extensions?.some((extension) => filename.endsWith(extension)) ||\n language.filenames?.some((name) => name.toLowerCase() === filename),\n );\n\n return firstLanguage?.parsers[0];\n};\n\nconst isPackageJsonOk = async ({\n data,\n filepath,\n}: {\n data: string;\n filepath: string;\n}): Promise<boolean> => {\n if (path.basename(filepath) !== 'package.json') {\n return true;\n }\n\n try {\n const packageJson = parsePackage(data);\n\n return !packageJson || (await formatPackage(packageJson)) === data;\n } catch {\n // Be more lenient about our custom formatting and don't throw if it errors.\n }\n\n return true;\n};\n\ninterface File {\n data: string;\n options: Options;\n filepath: string;\n}\n\ninterface Result {\n count: number;\n errored: Array<{ err?: unknown; filepath: string }>;\n touched: string[];\n unparsed: string[];\n}\n\nexport const formatOrLintFile = async (\n { data, filepath, options }: File,\n mode: 'format' | 'lint',\n result: Result | null,\n): Promise<string | undefined> => {\n if (mode === 'lint') {\n let ok: boolean;\n try {\n ok =\n (await check(data, options)) &&\n (await isPackageJsonOk({ data, filepath }));\n } catch (err) {\n result?.errored.push({ err, filepath });\n return;\n }\n\n if (!ok) {\n result?.errored.push({ filepath });\n }\n\n return;\n }\n\n let formatted: string;\n try {\n formatted = await format(data, options);\n } catch (err) {\n result?.errored.push({ err, filepath });\n return;\n }\n\n // Perform additional formatting (i.e. sorting) on a `package.json` manifest.\n try {\n if (path.basename(filepath) === 'package.json') {\n const packageJson = parsePackage(formatted);\n if (packageJson) {\n formatted = await formatPackage(packageJson);\n }\n }\n } catch {\n // Be more lenient about our custom formatting and don't throw if it errors.\n }\n\n if (formatted === data) {\n return;\n }\n\n result?.touched.push(filepath);\n return formatted;\n};\n\nexport interface PrettierOutput {\n ok: boolean;\n result: Result;\n}\n\n/**\n * Formats/lints files with Prettier.\n *\n * Prettier doesn't provide a higher-level Node.js API that replicates the\n * behaviour of its CLI, so we have to plumb together its lower-level functions.\n * On the other hand, this affords more flexibility in how we track and report\n * on progress and results.\n */\nexport const runPrettier = async (\n mode: 'format' | 'lint',\n logger: Logger,\n cwd = process.cwd(),\n): Promise<PrettierOutput> => {\n logger.debug('Initialising Prettier...');\n\n const start = process.hrtime.bigint();\n\n const manifest = await getConsumerManifest(cwd);\n\n const directory = manifest ? path.dirname(manifest.path) : cwd;\n\n logger.debug(\n manifest ? 'Detected project root:' : 'Detected working directory:',\n directory,\n );\n\n logger.debug('Discovering files...');\n\n // Match Prettier's opinion of respecting `.gitignore`.\n // This avoids exhibiting different behaviour than a Prettier IDE integration,\n // though it may present headaches if `.gitignore` and `.prettierignore` rules\n // conflict.\n const relativeFilepaths = await crawlDirectory(directory, [\n '.gitignore',\n '.prettierignore',\n ]);\n\n logger.debug(`Discovered ${pluralise(relativeFilepaths.length, 'file')}.`);\n\n const result: Result = {\n count: relativeFilepaths.length,\n errored: [],\n touched: [],\n unparsed: [],\n };\n\n logger.debug(mode === 'format' ? 'Formatting' : 'Linting', 'files...');\n\n for (const relativeFilepath of relativeFilepaths) {\n // Use relative paths to keep log output cleaner, particularly in the common\n // case where we are executing against the current working directory.\n const filepath = path.relative(\n process.cwd(),\n path.join(directory, relativeFilepath),\n );\n\n // Infer parser upfront so we can skip unsupported files.\n const parser = await inferParser(filepath);\n\n logger.debug(filepath);\n logger.debug(' parser:', parser ?? '-');\n\n if (!parser) {\n result.unparsed.push(filepath);\n continue;\n }\n\n const [config, data] = await Promise.all([\n resolveConfig(filepath),\n fs.promises.readFile(filepath, 'utf-8'),\n ]);\n\n const file: File = {\n data,\n filepath,\n options: { ...config, filepath },\n };\n\n const formatted = await formatOrLintFile(file, mode, result);\n\n if (typeof formatted === 'string') {\n await fs.promises.writeFile(filepath, formatted);\n }\n }\n\n const end = process.hrtime.bigint();\n\n logger.plain(\n `Processed ${pluralise(\n result.count - result.unparsed.length,\n 'file',\n )} in ${logger.timing(start, end)}.`,\n );\n\n if (result.touched.length) {\n logger.plain(`Formatted ${pluralise(result.touched.length, 'file')}:`);\n for (const filepath of result.touched) {\n logger.warn(filepath);\n }\n }\n\n if (result.errored.length) {\n logger.plain(`Flagged ${pluralise(result.errored.length, 'file')}:`);\n for (const { err, filepath } of result.errored) {\n logger.warn(\n filepath,\n ...(typeof err === 'string' || err instanceof Error\n ? [String(err)]\n : []),\n );\n }\n }\n\n return { ok: result.errored.length === 0, result };\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,sBAAe;AACf,sBAOO;AAEP,iBAA+B;AAC/B,qBAAuC;AACvC,sBAAoC;AACpC,qBAGO;AAEP,IAAI;AAsBG,MAAM,cAAc,OACzB,aACgC;AAChC,QAAM,WAAW,YAAAA,QAAK,SAAS,QAAQ,EAAE,YAAY;AAErD,iBAAe,UAAM,gCAAe,GAAG;AAEvC,QAAM,gBAAgB,UAAU;AAAA,IAC9B,CAAC,aACC,SAAS,YAAY,KAAK,CAAC,cAAc,SAAS,SAAS,SAAS,CAAC,KACrE,SAAS,WAAW,KAAK,CAAC,SAAS,KAAK,YAAY,MAAM,QAAQ;AAAA,EACtE;AAEA,SAAO,eAAe,QAAQ,CAAC;AACjC;AAEA,MAAM,kBAAkB,OAAO;AAAA,EAC7B;AAAA,EACA;AACF,MAGwB;AACtB,MAAI,YAAAA,QAAK,SAAS,QAAQ,MAAM,gBAAgB;AAC9C,WAAO;AAAA,EACT;AAEA,MAAI;AACF,UAAM,kBAAc,6BAAa,IAAI;AAErC,WAAO,CAAC,eAAgB,UAAM,8BAAc,WAAW,MAAO;AAAA,EAChE,QAAQ;AAAA,EAER;AAEA,SAAO;AACT;AAeO,MAAM,mBAAmB,OAC9B,EAAE,MAAM,UAAU,QAAQ,G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AAK,QAAQ;AAAA,IACtB;AAAA,EACF;AAEA,MAAI,OAAO,QAAQ,QAAQ;AACzB,WAAO,MAAM,WAAW,UAAU,OAAO,QAAQ,QAAQ,MAAM,CAAC,GAAG;AACnE,eAAW,EAAE,KAAK,SAAS,KAAK,OAAO,SAAS;AAC9C,aAAO;AAAA,QACL;AAAA,QACA,GAAI,OAAO,QAAQ,YAAY,eAAe,QAC1C,CAAC,OAAO,GAAG,CAAC,IACZ,CAAC;AAAA,MACP;AAAA,IACF;AAAA,EACF;AAEA,SAAO,EAAE,IAAI,OAAO,QAAQ,WAAW,GAAG,OAAO;AACnD;",
6
+ "names": []
7
7
  }
@@ -1,40 +1,7 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var args_exports = {};
30
- __export(args_exports, {
31
- parseTscArgs: () => parseTscArgs
32
- });
33
- module.exports = __toCommonJS(args_exports);
34
- var import_path = __toESM(require("path"));
35
- var import_minimist = __toESM(require("minimist"));
1
+ import path from "path";
2
+ import minimist from "minimist";
36
3
  const parseTscArgs = (args) => {
37
- const argv = (0, import_minimist.default)(args, {
4
+ const argv = minimist(args, {
38
5
  alias: { b: "build", p: "project" },
39
6
  boolean: "build",
40
7
  string: "project"
@@ -43,7 +10,7 @@ const parseTscArgs = (args) => {
43
10
  return {
44
11
  basename,
45
12
  dirname,
46
- pathname: import_path.default.join(dirname, basename),
13
+ pathname: path.join(dirname, basename),
47
14
  build: Boolean(argv.build),
48
15
  project: argv.project
49
16
  };
@@ -57,8 +24,8 @@ const parseTscProject = (project) => {
57
24
  }
58
25
  if (project.toLocaleLowerCase().endsWith(".json")) {
59
26
  return {
60
- basename: import_path.default.basename(project),
61
- dirname: import_path.default.dirname(project)
27
+ basename: path.basename(project),
28
+ dirname: path.dirname(project)
62
29
  };
63
30
  }
64
31
  return {
@@ -66,8 +33,7 @@ const parseTscProject = (project) => {
66
33
  dirname: project
67
34
  };
68
35
  };
69
- // Annotate the CommonJS export names for ESM import in node:
70
- 0 && (module.exports = {
36
+ export {
71
37
  parseTscArgs
72
- });
38
+ };
73
39
  //# sourceMappingURL=args.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../src/cli/build/args.ts"],
4
4
  "sourcesContent": ["import path from 'path';\n\nimport minimist from 'minimist';\n\nexport const parseTscArgs = (args: string[]) => {\n const argv = minimist<{\n build: boolean | undefined;\n project: string | undefined;\n }>(args, {\n alias: { b: 'build', p: 'project' },\n boolean: 'build',\n string: 'project',\n });\n\n const { basename, dirname } = parseTscProject(argv.project);\n\n return {\n basename,\n dirname,\n pathname: path.join(dirname, basename),\n\n build: Boolean(argv.build),\n project: argv.project,\n };\n};\n\nconst parseTscProject = (project: string | undefined) => {\n if (!project) {\n return {\n basename: 'tsconfig.build.json',\n dirname: process.cwd(),\n };\n }\n\n if (project.toLocaleLowerCase().endsWith('.json')) {\n return {\n basename: path.basename(project),\n dirname: path.dirname(project),\n };\n }\n\n return {\n basename: 'tsconfig.json',\n dirname: project,\n };\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,sBAAqB;AAEd,MAAM,eAAe,CAAC,SAAmB;AAC9C,QAAM,WAAO,gBAAAA,SAGV,MAAM;AAAA,IACP,OAAO,EAAE,GAAG,SAAS,GAAG,UAAU;AAAA,IAClC,SAAS;AAAA,IACT,QAAQ;AAAA,EACV,CAAC;AAED,QAAM,EAAE,UAAU,QAAQ,IAAI,gBAAgB,KAAK,OAAO;AAE1D,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,UAAU,YAAAC,QAAK,KAAK,SAAS,QAAQ;AAAA,IAErC,OAAO,QAAQ,KAAK,KAAK;AAAA,IACzB,SAAS,KAAK;AAAA,EAChB;AACF;AAEA,MAAM,kBAAkB,CAAC,YAAgC;AACvD,MAAI,CAAC,SAAS;AACZ,WAAO;AAAA,MACL,UAAU;AAAA,MACV,SAAS,QAAQ,IAAI;AAAA,IACvB;AAAA,EACF;AAEA,MAAI,QAAQ,kBAAkB,EAAE,SAAS,OAAO,GAAG;AACjD,WAAO;AAAA,MACL,UAAU,YAAAA,QAAK,SAAS,OAAO;AAAA,MAC/B,SAAS,YAAAA,QAAK,QAAQ,OAAO;AAAA,IAC/B;AAAA,EACF;AAEA,SAAO;AAAA,IACL,UAAU;AAAA,IACV,SAAS;AAAA,EACX;AACF;",
6
- "names": ["minimist", "path"]
5
+ "mappings": "AAAA,OAAO,UAAU;AAEjB,OAAO,cAAc;AAEd,MAAM,eAAe,CAAC,SAAmB;AAC9C,QAAM,OAAO,SAGV,MAAM;AAAA,IACP,OAAO,EAAE,GAAG,SAAS,GAAG,UAAU;AAAA,IAClC,SAAS;AAAA,IACT,QAAQ;AAAA,EACV,CAAC;AAED,QAAM,EAAE,UAAU,QAAQ,IAAI,gBAAgB,KAAK,OAAO;AAE1D,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,UAAU,KAAK,KAAK,SAAS,QAAQ;AAAA,IAErC,OAAO,QAAQ,KAAK,KAAK;AAAA,IACzB,SAAS,KAAK;AAAA,EAChB;AACF;AAEA,MAAM,kBAAkB,CAAC,YAAgC;AACvD,MAAI,CAAC,SAAS;AACZ,WAAO;AAAA,MACL,UAAU;AAAA,MACV,SAAS,QAAQ,IAAI;AAAA,IACvB;AAAA,EACF;AAEA,MAAI,QAAQ,kBAAkB,EAAE,SAAS,OAAO,GAAG;AACjD,WAAO;AAAA,MACL,UAAU,KAAK,SAAS,OAAO;AAAA,MAC/B,SAAS,KAAK,QAAQ,OAAO;AAAA,IAC/B;AAAA,EACF;AAEA,SAAO;AAAA,IACL,UAAU;AAAA,IACV,SAAS;AAAA,EACX;AACF;",
6
+ "names": []
7
7
  }
@@ -1,10 +1,11 @@
1
- import { type Color } from 'chalk';
1
+ import { styleText } from 'node:util';
2
2
  import { type Logger } from '../../utils/logging.js';
3
+ type StyleColor = Parameters<typeof styleText>[0];
3
4
  export declare const copyAssets: (destinationDir: string, logger?: Logger) => Promise<void>;
4
5
  interface CopyAssetsConfig {
5
6
  outDir: string;
6
7
  name: string;
7
- prefixColor: typeof Color;
8
+ prefixColor: StyleColor;
8
9
  }
9
10
  export declare const copyAssetsConcurrently: (configs: CopyAssetsConfig[]) => Promise<void>;
10
11
  export {};
@@ -1,62 +1,31 @@
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 assets_exports = {};
30
- __export(assets_exports, {
31
- copyAssets: () => copyAssets,
32
- copyAssetsConcurrently: () => copyAssetsConcurrently
33
- });
34
- module.exports = __toCommonJS(assets_exports);
35
- var import_path = __toESM(require("path"));
36
- var import_chalk = __toESM(require("chalk"));
37
- var import_fs_extra = __toESM(require("fs-extra"));
38
- var import_copy = require("../../utils/copy.js");
39
- var import_dir = require("../../utils/dir.js");
40
- var import_logging = require("../../utils/logging.js");
41
- var import_manifest = require("../../utils/manifest.js");
42
- const copyAssets = async (destinationDir, logger = import_logging.log) => {
43
- const manifest = await (0, import_manifest.getManifestProperties)("assets");
1
+ import { styleText } from "node:util";
2
+ import path from "path";
3
+ import fs from "fs-extra";
4
+ import { copyFile } from "../../utils/copy.js";
5
+ import { buildPatternToFilepathMap, crawlDirectory } from "../../utils/dir.js";
6
+ import { createLogger, log } from "../../utils/logging.js";
7
+ import {
8
+ getEntryPointFromManifest,
9
+ getManifestProperties
10
+ } from "../../utils/manifest.js";
11
+ const copyAssets = async (destinationDir, logger = log) => {
12
+ const manifest = await getManifestProperties("assets");
44
13
  if (!manifest?.value) {
45
14
  return;
46
15
  }
47
- const entryPoint = await (0, import_manifest.getEntryPointFromManifest)();
16
+ const entryPoint = await getEntryPointFromManifest();
48
17
  if (!entryPoint) {
49
18
  return;
50
19
  }
51
- const pathSegments = entryPoint.split(import_path.default.sep);
20
+ const pathSegments = entryPoint.split(path.sep);
52
21
  const srcDir = pathSegments.length > 1 && pathSegments[0] || "";
53
- const resolvedSrcDir = import_path.default.resolve(import_path.default.dirname(manifest.path), srcDir);
54
- const resolvedDestinationDir = import_path.default.resolve(
55
- import_path.default.dirname(manifest.path),
22
+ const resolvedSrcDir = path.resolve(path.dirname(manifest.path), srcDir);
23
+ const resolvedDestinationDir = path.resolve(
24
+ path.dirname(manifest.path),
56
25
  destinationDir
57
26
  );
58
- const allFiles = await (0, import_dir.crawlDirectory)(resolvedSrcDir);
59
- const filesByPattern = (0, import_dir.buildPatternToFilepathMap)(manifest.value, allFiles, {
27
+ const allFiles = await crawlDirectory(resolvedSrcDir);
28
+ const filesByPattern = buildPatternToFilepathMap(manifest.value, allFiles, {
60
29
  cwd: resolvedSrcDir,
61
30
  dot: true
62
31
  });
@@ -66,13 +35,13 @@ const copyAssets = async (destinationDir, logger = import_logging.log) => {
66
35
  await Promise.all(
67
36
  matchedFiles.map(async (filename) => {
68
37
  logger.subtle(`Copying ${filename}`);
69
- await import_fs_extra.default.promises.mkdir(
70
- import_path.default.dirname(import_path.default.join(resolvedDestinationDir, filename)),
38
+ await fs.promises.mkdir(
39
+ path.dirname(path.join(resolvedDestinationDir, filename)),
71
40
  { recursive: true }
72
41
  );
73
- await (0, import_copy.copyFile)(
74
- import_path.default.join(resolvedSrcDir, filename),
75
- import_path.default.join(resolvedDestinationDir, filename),
42
+ await copyFile(
43
+ path.join(resolvedSrcDir, filename),
44
+ path.join(resolvedDestinationDir, filename),
76
45
  { processors: [] }
77
46
  );
78
47
  })
@@ -87,17 +56,16 @@ const copyAssetsConcurrently = async (configs) => {
87
56
  configs.map(
88
57
  async ({ outDir, name, prefixColor }) => copyAssets(
89
58
  outDir,
90
- (0, import_logging.createLogger)({
59
+ createLogger({
91
60
  debug: false,
92
- prefixes: [import_chalk.default[prefixColor](`${name.padEnd(maxNameLength)} \u2502`)]
61
+ prefixes: [styleText(prefixColor, `${name.padEnd(maxNameLength)} \u2502`)]
93
62
  })
94
63
  )
95
64
  )
96
65
  );
97
66
  };
98
- // Annotate the CommonJS export names for ESM import in node:
99
- 0 && (module.exports = {
67
+ export {
100
68
  copyAssets,
101
69
  copyAssetsConcurrently
102
- });
70
+ };
103
71
  //# sourceMappingURL=assets.js.map