skuba 0.0.0-beta-20231002015947

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 (579) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +67 -0
  3. package/config/eslint.js +3 -0
  4. package/config/jest.js +1 -0
  5. package/config/prettier.d.ts +4 -0
  6. package/config/prettier.js +6 -0
  7. package/config/tsconfig.json +11 -0
  8. package/jest/moduleNameMapper.js +58 -0
  9. package/jest/moduleNameMapper.test.ts +64 -0
  10. package/jest/transform.js +50 -0
  11. package/jest/transform.test.ts +11 -0
  12. package/jest/tsConfig.js +26 -0
  13. package/jest-preset.js +40 -0
  14. package/lib/api/buildkite/annotate.d.ts +26 -0
  15. package/lib/api/buildkite/annotate.js +49 -0
  16. package/lib/api/buildkite/annotate.js.map +7 -0
  17. package/lib/api/buildkite/index.d.ts +3 -0
  18. package/lib/api/buildkite/index.js +32 -0
  19. package/lib/api/buildkite/index.js.map +7 -0
  20. package/lib/api/buildkite/md.d.ts +6 -0
  21. package/lib/api/buildkite/md.js +33 -0
  22. package/lib/api/buildkite/md.js.map +7 -0
  23. package/lib/api/git/commit.d.ts +15 -0
  24. package/lib/api/git/commit.js +52 -0
  25. package/lib/api/git/commit.js.map +7 -0
  26. package/lib/api/git/commitAllChanges.d.ts +19 -0
  27. package/lib/api/git/commitAllChanges.js +79 -0
  28. package/lib/api/git/commitAllChanges.js.map +7 -0
  29. package/lib/api/git/currentBranch.d.ts +10 -0
  30. package/lib/api/git/currentBranch.js +59 -0
  31. package/lib/api/git/currentBranch.js.map +7 -0
  32. package/lib/api/git/findRoot.d.ts +9 -0
  33. package/lib/api/git/findRoot.js +52 -0
  34. package/lib/api/git/findRoot.js.map +7 -0
  35. package/lib/api/git/getChangedFiles.d.ts +20 -0
  36. package/lib/api/git/getChangedFiles.js +63 -0
  37. package/lib/api/git/getChangedFiles.js.map +7 -0
  38. package/lib/api/git/index.d.ts +11 -0
  39. package/lib/api/git/index.js +58 -0
  40. package/lib/api/git/index.js.map +7 -0
  41. package/lib/api/git/log.d.ts +19 -0
  42. package/lib/api/git/log.js +71 -0
  43. package/lib/api/git/log.js.map +7 -0
  44. package/lib/api/git/pull.d.ts +35 -0
  45. package/lib/api/git/pull.js +69 -0
  46. package/lib/api/git/pull.js.map +7 -0
  47. package/lib/api/git/push.d.ts +43 -0
  48. package/lib/api/git/push.js +70 -0
  49. package/lib/api/git/push.js.map +7 -0
  50. package/lib/api/git/remote.d.ts +20 -0
  51. package/lib/api/git/remote.js +73 -0
  52. package/lib/api/git/remote.js.map +7 -0
  53. package/lib/api/git/reset.d.ts +12 -0
  54. package/lib/api/git/reset.js +62 -0
  55. package/lib/api/git/reset.js.map +7 -0
  56. package/lib/api/git/statusMatrix.d.ts +7 -0
  57. package/lib/api/git/statusMatrix.js +47 -0
  58. package/lib/api/git/statusMatrix.js.map +7 -0
  59. package/lib/api/github/checkRun.d.ts +44 -0
  60. package/lib/api/github/checkRun.js +81 -0
  61. package/lib/api/github/checkRun.js.map +7 -0
  62. package/lib/api/github/environment.d.ts +18 -0
  63. package/lib/api/github/environment.js +48 -0
  64. package/lib/api/github/environment.js.map +7 -0
  65. package/lib/api/github/index.d.ts +7 -0
  66. package/lib/api/github/index.js +48 -0
  67. package/lib/api/github/index.js.map +7 -0
  68. package/lib/api/github/issueComment.d.ts +59 -0
  69. package/lib/api/github/issueComment.js +83 -0
  70. package/lib/api/github/issueComment.js.map +7 -0
  71. package/lib/api/github/pullRequest.d.ts +21 -0
  72. package/lib/api/github/pullRequest.js +69 -0
  73. package/lib/api/github/pullRequest.js.map +7 -0
  74. package/lib/api/github/push.d.ts +79 -0
  75. package/lib/api/github/push.js +167 -0
  76. package/lib/api/github/push.js.map +7 -0
  77. package/lib/api/jest/index.d.ts +147 -0
  78. package/lib/api/jest/index.js +41 -0
  79. package/lib/api/jest/index.js.map +7 -0
  80. package/lib/api/net/compose.d.ts +4 -0
  81. package/lib/api/net/compose.js +50 -0
  82. package/lib/api/net/compose.js.map +7 -0
  83. package/lib/api/net/index.d.ts +1 -0
  84. package/lib/api/net/index.js +29 -0
  85. package/lib/api/net/index.js.map +7 -0
  86. package/lib/api/net/socket.d.ts +5 -0
  87. package/lib/api/net/socket.js +68 -0
  88. package/lib/api/net/socket.js.map +7 -0
  89. package/lib/api/net/waitFor.d.ts +22 -0
  90. package/lib/api/net/waitFor.js +40 -0
  91. package/lib/api/net/waitFor.js.map +7 -0
  92. package/lib/cli/adapter/eslint.d.ts +14 -0
  93. package/lib/cli/adapter/eslint.js +99 -0
  94. package/lib/cli/adapter/eslint.js.map +7 -0
  95. package/lib/cli/adapter/prettier.d.ts +52 -0
  96. package/lib/cli/adapter/prettier.js +176 -0
  97. package/lib/cli/adapter/prettier.js.map +7 -0
  98. package/lib/cli/build/args.d.ts +7 -0
  99. package/lib/cli/build/args.js +73 -0
  100. package/lib/cli/build/args.js.map +7 -0
  101. package/lib/cli/build/assets.d.ts +10 -0
  102. package/lib/cli/build/assets.js +107 -0
  103. package/lib/cli/build/assets.js.map +7 -0
  104. package/lib/cli/build/esbuild.d.ts +5 -0
  105. package/lib/cli/build/esbuild.js +98 -0
  106. package/lib/cli/build/esbuild.js.map +7 -0
  107. package/lib/cli/build/index.d.ts +1 -0
  108. package/lib/cli/build/index.js +83 -0
  109. package/lib/cli/build/index.js.map +7 -0
  110. package/lib/cli/build/tsc.d.ts +4 -0
  111. package/lib/cli/build/tsc.js +102 -0
  112. package/lib/cli/build/tsc.js.map +7 -0
  113. package/lib/cli/buildPackage.d.ts +1 -0
  114. package/lib/cli/buildPackage.js +69 -0
  115. package/lib/cli/buildPackage.js.map +7 -0
  116. package/lib/cli/configure/addEmptyExports.d.ts +6 -0
  117. package/lib/cli/configure/addEmptyExports.js +76 -0
  118. package/lib/cli/configure/addEmptyExports.js.map +7 -0
  119. package/lib/cli/configure/analyseConfiguration.d.ts +9 -0
  120. package/lib/cli/configure/analyseConfiguration.js +69 -0
  121. package/lib/cli/configure/analyseConfiguration.js.map +7 -0
  122. package/lib/cli/configure/analyseDependencies.d.ts +10 -0
  123. package/lib/cli/configure/analyseDependencies.js +136 -0
  124. package/lib/cli/configure/analyseDependencies.js.map +7 -0
  125. package/lib/cli/configure/analysis/diff.d.ts +1 -0
  126. package/lib/cli/configure/analysis/diff.js +45 -0
  127. package/lib/cli/configure/analysis/diff.js.map +7 -0
  128. package/lib/cli/configure/analysis/files.d.ts +1 -0
  129. package/lib/cli/configure/analysis/files.js +58 -0
  130. package/lib/cli/configure/analysis/files.js.map +7 -0
  131. package/lib/cli/configure/analysis/git.d.ts +1 -0
  132. package/lib/cli/configure/analysis/git.js +54 -0
  133. package/lib/cli/configure/analysis/git.js.map +7 -0
  134. package/lib/cli/configure/analysis/package.d.ts +13 -0
  135. package/lib/cli/configure/analysis/package.js +110 -0
  136. package/lib/cli/configure/analysis/package.js.map +7 -0
  137. package/lib/cli/configure/analysis/project.d.ts +3 -0
  138. package/lib/cli/configure/analysis/project.js +109 -0
  139. package/lib/cli/configure/analysis/project.js.map +7 -0
  140. package/lib/cli/configure/dependencies/index.d.ts +5 -0
  141. package/lib/cli/configure/dependencies/index.js +41 -0
  142. package/lib/cli/configure/dependencies/index.js.map +7 -0
  143. package/lib/cli/configure/dependencies/seekDatadogCustomMetrics.d.ts +2 -0
  144. package/lib/cli/configure/dependencies/seekDatadogCustomMetrics.js +59 -0
  145. package/lib/cli/configure/dependencies/seekDatadogCustomMetrics.js.map +7 -0
  146. package/lib/cli/configure/dependencies/seekKoala.d.ts +2 -0
  147. package/lib/cli/configure/dependencies/seekKoala.js +56 -0
  148. package/lib/cli/configure/dependencies/seekKoala.js.map +7 -0
  149. package/lib/cli/configure/dependencies/skuba.d.ts +2 -0
  150. package/lib/cli/configure/dependencies/skuba.js +52 -0
  151. package/lib/cli/configure/dependencies/skuba.js.map +7 -0
  152. package/lib/cli/configure/dependencies/skubaDeps.d.ts +2 -0
  153. package/lib/cli/configure/dependencies/skubaDeps.js +56 -0
  154. package/lib/cli/configure/dependencies/skubaDeps.js.map +7 -0
  155. package/lib/cli/configure/dependencies/skubaDive.d.ts +3 -0
  156. package/lib/cli/configure/dependencies/skubaDive.js +70 -0
  157. package/lib/cli/configure/dependencies/skubaDive.js.map +7 -0
  158. package/lib/cli/configure/ensureTemplateCompletion.d.ts +9 -0
  159. package/lib/cli/configure/ensureTemplateCompletion.js +77 -0
  160. package/lib/cli/configure/ensureTemplateCompletion.js.map +7 -0
  161. package/lib/cli/configure/getEntryPoint.d.ts +11 -0
  162. package/lib/cli/configure/getEntryPoint.js +73 -0
  163. package/lib/cli/configure/getEntryPoint.js.map +7 -0
  164. package/lib/cli/configure/getProjectType.d.ts +9 -0
  165. package/lib/cli/configure/getProjectType.js +52 -0
  166. package/lib/cli/configure/getProjectType.js.map +7 -0
  167. package/lib/cli/configure/index.d.ts +1 -0
  168. package/lib/cli/configure/index.js +148 -0
  169. package/lib/cli/configure/index.js.map +7 -0
  170. package/lib/cli/configure/modules/eslint.d.ts +2 -0
  171. package/lib/cli/configure/modules/eslint.js +61 -0
  172. package/lib/cli/configure/modules/eslint.js.map +7 -0
  173. package/lib/cli/configure/modules/ignore.d.ts +2 -0
  174. package/lib/cli/configure/modules/ignore.js +40 -0
  175. package/lib/cli/configure/modules/ignore.js.map +7 -0
  176. package/lib/cli/configure/modules/index.d.ts +2 -0
  177. package/lib/cli/configure/modules/index.js +54 -0
  178. package/lib/cli/configure/modules/index.js.map +7 -0
  179. package/lib/cli/configure/modules/jest.d.ts +2 -0
  180. package/lib/cli/configure/modules/jest.js +86 -0
  181. package/lib/cli/configure/modules/jest.js.map +7 -0
  182. package/lib/cli/configure/modules/nodemon.d.ts +2 -0
  183. package/lib/cli/configure/modules/nodemon.js +30 -0
  184. package/lib/cli/configure/modules/nodemon.js.map +7 -0
  185. package/lib/cli/configure/modules/package.d.ts +2 -0
  186. package/lib/cli/configure/modules/package.js +117 -0
  187. package/lib/cli/configure/modules/package.js.map +7 -0
  188. package/lib/cli/configure/modules/prettier.d.ts +2 -0
  189. package/lib/cli/configure/modules/prettier.js +52 -0
  190. package/lib/cli/configure/modules/prettier.js.map +7 -0
  191. package/lib/cli/configure/modules/renovate.d.ts +3 -0
  192. package/lib/cli/configure/modules/renovate.js +69 -0
  193. package/lib/cli/configure/modules/renovate.js.map +7 -0
  194. package/lib/cli/configure/modules/serverless.d.ts +2 -0
  195. package/lib/cli/configure/modules/serverless.js +36 -0
  196. package/lib/cli/configure/modules/serverless.js.map +7 -0
  197. package/lib/cli/configure/modules/skubaDive.d.ts +2 -0
  198. package/lib/cli/configure/modules/skubaDive.js +72 -0
  199. package/lib/cli/configure/modules/skubaDive.js.map +7 -0
  200. package/lib/cli/configure/modules/tsconfig.d.ts +2 -0
  201. package/lib/cli/configure/modules/tsconfig.js +87 -0
  202. package/lib/cli/configure/modules/tsconfig.js.map +7 -0
  203. package/lib/cli/configure/modules/tslint.d.ts +2 -0
  204. package/lib/cli/configure/modules/tslint.js +30 -0
  205. package/lib/cli/configure/modules/tslint.js.map +7 -0
  206. package/lib/cli/configure/patchDockerfile.d.ts +1 -0
  207. package/lib/cli/configure/patchDockerfile.js +65 -0
  208. package/lib/cli/configure/patchDockerfile.js.map +7 -0
  209. package/lib/cli/configure/patchRenovateConfig.d.ts +1 -0
  210. package/lib/cli/configure/patchRenovateConfig.js +138 -0
  211. package/lib/cli/configure/patchRenovateConfig.js.map +7 -0
  212. package/lib/cli/configure/patchServerListener.d.ts +3 -0
  213. package/lib/cli/configure/patchServerListener.js +87 -0
  214. package/lib/cli/configure/patchServerListener.js.map +7 -0
  215. package/lib/cli/configure/processing/deleteFiles.d.ts +5 -0
  216. package/lib/cli/configure/processing/deleteFiles.js +31 -0
  217. package/lib/cli/configure/processing/deleteFiles.js.map +7 -0
  218. package/lib/cli/configure/processing/ignoreFile.d.ts +8 -0
  219. package/lib/cli/configure/processing/ignoreFile.js +74 -0
  220. package/lib/cli/configure/processing/ignoreFile.js.map +7 -0
  221. package/lib/cli/configure/processing/javascript.d.ts +2 -0
  222. package/lib/cli/configure/processing/javascript.js +38 -0
  223. package/lib/cli/configure/processing/javascript.js.map +7 -0
  224. package/lib/cli/configure/processing/json.d.ts +2 -0
  225. package/lib/cli/configure/processing/json.js +57 -0
  226. package/lib/cli/configure/processing/json.js.map +7 -0
  227. package/lib/cli/configure/processing/loadFiles.d.ts +5 -0
  228. package/lib/cli/configure/processing/loadFiles.js +31 -0
  229. package/lib/cli/configure/processing/loadFiles.js.map +7 -0
  230. package/lib/cli/configure/processing/module.d.ts +10 -0
  231. package/lib/cli/configure/processing/module.js +39 -0
  232. package/lib/cli/configure/processing/module.js.map +7 -0
  233. package/lib/cli/configure/processing/package.d.ts +73 -0
  234. package/lib/cli/configure/processing/package.js +85 -0
  235. package/lib/cli/configure/processing/package.js.map +7 -0
  236. package/lib/cli/configure/processing/prettier.d.ts +4 -0
  237. package/lib/cli/configure/processing/prettier.js +44 -0
  238. package/lib/cli/configure/processing/prettier.js.map +7 -0
  239. package/lib/cli/configure/processing/record.d.ts +11 -0
  240. package/lib/cli/configure/processing/record.js +65 -0
  241. package/lib/cli/configure/processing/record.js.map +7 -0
  242. package/lib/cli/configure/processing/typescript.d.ts +23 -0
  243. package/lib/cli/configure/processing/typescript.js +205 -0
  244. package/lib/cli/configure/processing/typescript.js.map +7 -0
  245. package/lib/cli/configure/refreshIgnoreFiles.d.ts +3 -0
  246. package/lib/cli/configure/refreshIgnoreFiles.js +78 -0
  247. package/lib/cli/configure/refreshIgnoreFiles.js.map +7 -0
  248. package/lib/cli/configure/types.d.ts +26 -0
  249. package/lib/cli/configure/types.js +17 -0
  250. package/lib/cli/configure/types.js.map +7 -0
  251. package/lib/cli/format.d.ts +1 -0
  252. package/lib/cli/format.js +74 -0
  253. package/lib/cli/format.js.map +7 -0
  254. package/lib/cli/help.d.ts +1 -0
  255. package/lib/cli/help.js +34 -0
  256. package/lib/cli/help.js.map +7 -0
  257. package/lib/cli/init/getConfig.d.ts +26 -0
  258. package/lib/cli/init/getConfig.js +286 -0
  259. package/lib/cli/init/getConfig.js.map +7 -0
  260. package/lib/cli/init/git.d.ts +7 -0
  261. package/lib/cli/init/git.js +82 -0
  262. package/lib/cli/init/git.js.map +7 -0
  263. package/lib/cli/init/index.d.ts +1 -0
  264. package/lib/cli/init/index.js +146 -0
  265. package/lib/cli/init/index.js.map +7 -0
  266. package/lib/cli/init/prompts.d.ts +45 -0
  267. package/lib/cli/init/prompts.js +97 -0
  268. package/lib/cli/init/prompts.js.map +7 -0
  269. package/lib/cli/init/types.d.ts +28 -0
  270. package/lib/cli/init/types.js +65 -0
  271. package/lib/cli/init/types.js.map +7 -0
  272. package/lib/cli/init/validation.d.ts +8 -0
  273. package/lib/cli/init/validation.js +43 -0
  274. package/lib/cli/init/validation.js.map +7 -0
  275. package/lib/cli/init/writePackageJson.d.ts +13 -0
  276. package/lib/cli/init/writePackageJson.js +58 -0
  277. package/lib/cli/init/writePackageJson.js.map +7 -0
  278. package/lib/cli/lint/annotate/buildkite/eslint.d.ts +2 -0
  279. package/lib/cli/lint/annotate/buildkite/eslint.js +40 -0
  280. package/lib/cli/lint/annotate/buildkite/eslint.js.map +7 -0
  281. package/lib/cli/lint/annotate/buildkite/index.d.ts +4 -0
  282. package/lib/cli/lint/annotate/buildkite/index.js +58 -0
  283. package/lib/cli/lint/annotate/buildkite/index.js.map +7 -0
  284. package/lib/cli/lint/annotate/buildkite/prettier.d.ts +2 -0
  285. package/lib/cli/lint/annotate/buildkite/prettier.js +47 -0
  286. package/lib/cli/lint/annotate/buildkite/prettier.js.map +7 -0
  287. package/lib/cli/lint/annotate/buildkite/tsc.d.ts +2 -0
  288. package/lib/cli/lint/annotate/buildkite/tsc.js +45 -0
  289. package/lib/cli/lint/annotate/buildkite/tsc.js.map +7 -0
  290. package/lib/cli/lint/annotate/github/eslint.d.ts +3 -0
  291. package/lib/cli/lint/annotate/github/eslint.js +45 -0
  292. package/lib/cli/lint/annotate/github/eslint.js.map +7 -0
  293. package/lib/cli/lint/annotate/github/index.d.ts +4 -0
  294. package/lib/cli/lint/annotate/github/index.js +63 -0
  295. package/lib/cli/lint/annotate/github/index.js.map +7 -0
  296. package/lib/cli/lint/annotate/github/prettier.d.ts +3 -0
  297. package/lib/cli/lint/annotate/github/prettier.js +39 -0
  298. package/lib/cli/lint/annotate/github/prettier.js.map +7 -0
  299. package/lib/cli/lint/annotate/github/tsc.d.ts +3 -0
  300. package/lib/cli/lint/annotate/github/tsc.js +63 -0
  301. package/lib/cli/lint/annotate/github/tsc.js.map +7 -0
  302. package/lib/cli/lint/annotate/index.d.ts +4 -0
  303. package/lib/cli/lint/annotate/index.js +36 -0
  304. package/lib/cli/lint/annotate/index.js.map +7 -0
  305. package/lib/cli/lint/autofix.d.ts +10 -0
  306. package/lib/cli/lint/autofix.js +214 -0
  307. package/lib/cli/lint/autofix.js.map +7 -0
  308. package/lib/cli/lint/eslint.d.ts +4 -0
  309. package/lib/cli/lint/eslint.js +55 -0
  310. package/lib/cli/lint/eslint.js.map +7 -0
  311. package/lib/cli/lint/external.d.ts +10 -0
  312. package/lib/cli/lint/external.js +117 -0
  313. package/lib/cli/lint/external.js.map +7 -0
  314. package/lib/cli/lint/index.d.ts +2 -0
  315. package/lib/cli/lint/index.js +51 -0
  316. package/lib/cli/lint/index.js.map +7 -0
  317. package/lib/cli/lint/internal.d.ts +1 -0
  318. package/lib/cli/lint/internal.js +64 -0
  319. package/lib/cli/lint/internal.js.map +7 -0
  320. package/lib/cli/lint/prettier.d.ts +4 -0
  321. package/lib/cli/lint/prettier.js +55 -0
  322. package/lib/cli/lint/prettier.js.map +7 -0
  323. package/lib/cli/lint/tsc.d.ts +2 -0
  324. package/lib/cli/lint/tsc.js +58 -0
  325. package/lib/cli/lint/tsc.js.map +7 -0
  326. package/lib/cli/lint/types.d.ts +34 -0
  327. package/lib/cli/lint/types.js +17 -0
  328. package/lib/cli/lint/types.js.map +7 -0
  329. package/lib/cli/node.d.ts +1 -0
  330. package/lib/cli/node.js +77 -0
  331. package/lib/cli/node.js.map +7 -0
  332. package/lib/cli/release.d.ts +1 -0
  333. package/lib/cli/release.js +32 -0
  334. package/lib/cli/release.js.map +7 -0
  335. package/lib/cli/start.d.ts +1 -0
  336. package/lib/cli/start.js +69 -0
  337. package/lib/cli/start.js.map +7 -0
  338. package/lib/cli/test/index.d.ts +1 -0
  339. package/lib/cli/test/index.js +36 -0
  340. package/lib/cli/test/index.js.map +7 -0
  341. package/lib/cli/test/reporters/github/annotations.d.ts +9 -0
  342. package/lib/cli/test/reporters/github/annotations.js +102 -0
  343. package/lib/cli/test/reporters/github/annotations.js.map +7 -0
  344. package/lib/cli/test/reporters/github/index.d.ts +5 -0
  345. package/lib/cli/test/reporters/github/index.js +75 -0
  346. package/lib/cli/test/reporters/github/index.js.map +7 -0
  347. package/lib/cli/test/reporters/prettier/index.d.ts +4 -0
  348. package/lib/cli/test/reporters/prettier/index.js +67 -0
  349. package/lib/cli/test/reporters/prettier/index.js.map +7 -0
  350. package/lib/cli/version.d.ts +1 -0
  351. package/lib/cli/version.js +34 -0
  352. package/lib/cli/version.js.map +7 -0
  353. package/lib/enquirer.d.js +2 -0
  354. package/lib/enquirer.d.js.map +7 -0
  355. package/lib/index.d.ts +22 -0
  356. package/lib/index.js +51 -0
  357. package/lib/index.js.map +7 -0
  358. package/lib/skuba.d.ts +11 -0
  359. package/lib/skuba.js +53 -0
  360. package/lib/skuba.js.map +7 -0
  361. package/lib/utils/args.d.ts +43 -0
  362. package/lib/utils/args.js +114 -0
  363. package/lib/utils/args.js.map +7 -0
  364. package/lib/utils/command.d.ts +6 -0
  365. package/lib/utils/command.js +72 -0
  366. package/lib/utils/command.js.map +7 -0
  367. package/lib/utils/copy.d.ts +17 -0
  368. package/lib/utils/copy.js +105 -0
  369. package/lib/utils/copy.js.map +7 -0
  370. package/lib/utils/dir.d.ts +22 -0
  371. package/lib/utils/dir.js +91 -0
  372. package/lib/utils/dir.js.map +7 -0
  373. package/lib/utils/env.d.ts +5 -0
  374. package/lib/utils/env.js +29 -0
  375. package/lib/utils/env.js.map +7 -0
  376. package/lib/utils/error.d.ts +28 -0
  377. package/lib/utils/error.js +72 -0
  378. package/lib/utils/error.js.map +7 -0
  379. package/lib/utils/exec.d.ts +39 -0
  380. package/lib/utils/exec.js +163 -0
  381. package/lib/utils/exec.js.map +7 -0
  382. package/lib/utils/help.d.ts +1 -0
  383. package/lib/utils/help.js +34 -0
  384. package/lib/utils/help.js.map +7 -0
  385. package/lib/utils/logging.d.ts +27 -0
  386. package/lib/utils/logging.js +60 -0
  387. package/lib/utils/logging.js.map +7 -0
  388. package/lib/utils/logo.d.ts +9 -0
  389. package/lib/utils/logo.js +74 -0
  390. package/lib/utils/logo.js.map +7 -0
  391. package/lib/utils/manifest.d.ts +10 -0
  392. package/lib/utils/manifest.js +83 -0
  393. package/lib/utils/manifest.js.map +7 -0
  394. package/lib/utils/port.d.ts +2 -0
  395. package/lib/utils/port.js +48 -0
  396. package/lib/utils/port.js.map +7 -0
  397. package/lib/utils/template.d.ts +37 -0
  398. package/lib/utils/template.js +116 -0
  399. package/lib/utils/template.js.map +7 -0
  400. package/lib/utils/validation.d.ts +6 -0
  401. package/lib/utils/validation.js +44 -0
  402. package/lib/utils/validation.js.map +7 -0
  403. package/lib/utils/version.d.ts +13 -0
  404. package/lib/utils/version.js +89 -0
  405. package/lib/utils/version.js.map +7 -0
  406. package/lib/utils/wait.d.ts +17 -0
  407. package/lib/utils/wait.js +59 -0
  408. package/lib/utils/wait.js.map +7 -0
  409. package/lib/utils/worker.d.ts +20 -0
  410. package/lib/utils/worker.js +63 -0
  411. package/lib/utils/worker.js.map +7 -0
  412. package/lib/wrapper/function-arguments.d.js +2 -0
  413. package/lib/wrapper/function-arguments.d.js.map +7 -0
  414. package/lib/wrapper/functionHandler.d.ts +10 -0
  415. package/lib/wrapper/functionHandler.js +63 -0
  416. package/lib/wrapper/functionHandler.js.map +7 -0
  417. package/lib/wrapper/http.d.ts +20 -0
  418. package/lib/wrapper/http.js +79 -0
  419. package/lib/wrapper/http.js.map +7 -0
  420. package/lib/wrapper/index.d.ts +12 -0
  421. package/lib/wrapper/index.js +16 -0
  422. package/lib/wrapper/index.js.map +7 -0
  423. package/lib/wrapper/main.d.ts +1 -0
  424. package/lib/wrapper/main.js +47 -0
  425. package/lib/wrapper/main.js.map +7 -0
  426. package/lib/wrapper/requestListener.d.ts +11 -0
  427. package/lib/wrapper/requestListener.js +69 -0
  428. package/lib/wrapper/requestListener.js.map +7 -0
  429. package/package.json +170 -0
  430. package/template/base/.github/CODEOWNERS +1 -0
  431. package/template/base/.github/renovate.json5 +3 -0
  432. package/template/base/_.dockerignore +18 -0
  433. package/template/base/_.eslintignore +14 -0
  434. package/template/base/_.eslintrc.js +3 -0
  435. package/template/base/_.gitignore +23 -0
  436. package/template/base/_.prettierignore +8 -0
  437. package/template/base/_.prettierrc.js +1 -0
  438. package/template/base/jest.config.ts +15 -0
  439. package/template/base/jest.setup.ts +3 -0
  440. package/template/base/tsconfig.build.json +5 -0
  441. package/template/base/tsconfig.json +13 -0
  442. package/template/express-rest-api/.buildkite/pipeline.yml +105 -0
  443. package/template/express-rest-api/.env +1 -0
  444. package/template/express-rest-api/.gantry/common.yml +20 -0
  445. package/template/express-rest-api/.gantry/dev.yml +8 -0
  446. package/template/express-rest-api/.gantry/prod.yml +8 -0
  447. package/template/express-rest-api/.nvmrc +1 -0
  448. package/template/express-rest-api/Dockerfile +37 -0
  449. package/template/express-rest-api/Dockerfile.dev-deps +11 -0
  450. package/template/express-rest-api/README.md +106 -0
  451. package/template/express-rest-api/docker-compose.yml +22 -0
  452. package/template/express-rest-api/gantry.apply.yml +120 -0
  453. package/template/express-rest-api/gantry.build.yml +15 -0
  454. package/template/express-rest-api/package.json +30 -0
  455. package/template/express-rest-api/skuba.template.js +49 -0
  456. package/template/express-rest-api/src/api/healthCheck.ts +11 -0
  457. package/template/express-rest-api/src/api/smokeTest.ts +8 -0
  458. package/template/express-rest-api/src/app.test.ts +9 -0
  459. package/template/express-rest-api/src/app.ts +14 -0
  460. package/template/express-rest-api/src/config.ts +57 -0
  461. package/template/express-rest-api/src/framework/logging.ts +17 -0
  462. package/template/express-rest-api/src/listen.ts +23 -0
  463. package/template/express-rest-api/src/register.ts +1 -0
  464. package/template/greeter/.buildkite/pipeline.yml +37 -0
  465. package/template/greeter/.nvmrc +1 -0
  466. package/template/greeter/Dockerfile +11 -0
  467. package/template/greeter/README.md +96 -0
  468. package/template/greeter/docker-compose.yml +22 -0
  469. package/template/greeter/package.json +24 -0
  470. package/template/greeter/skuba.template.js +16 -0
  471. package/template/greeter/src/app.test.ts +5 -0
  472. package/template/greeter/src/app.ts +4 -0
  473. package/template/koa-rest-api/.buildkite/pipeline.yml +105 -0
  474. package/template/koa-rest-api/.env +1 -0
  475. package/template/koa-rest-api/.gantry/common.yml +20 -0
  476. package/template/koa-rest-api/.gantry/dev.yml +11 -0
  477. package/template/koa-rest-api/.gantry/prod.yml +11 -0
  478. package/template/koa-rest-api/.nvmrc +1 -0
  479. package/template/koa-rest-api/Dockerfile +37 -0
  480. package/template/koa-rest-api/Dockerfile.dev-deps +11 -0
  481. package/template/koa-rest-api/README.md +111 -0
  482. package/template/koa-rest-api/docker-compose.yml +22 -0
  483. package/template/koa-rest-api/gantry.apply.yml +127 -0
  484. package/template/koa-rest-api/gantry.build.yml +15 -0
  485. package/template/koa-rest-api/package.json +47 -0
  486. package/template/koa-rest-api/skuba.template.js +49 -0
  487. package/template/koa-rest-api/src/api/healthCheck.ts +13 -0
  488. package/template/koa-rest-api/src/api/index.ts +10 -0
  489. package/template/koa-rest-api/src/api/jobs/getJobs.test.ts +9 -0
  490. package/template/koa-rest-api/src/api/jobs/getJobs.ts +15 -0
  491. package/template/koa-rest-api/src/api/jobs/index.ts +10 -0
  492. package/template/koa-rest-api/src/api/jobs/postJob.test.ts +34 -0
  493. package/template/koa-rest-api/src/api/jobs/postJob.ts +19 -0
  494. package/template/koa-rest-api/src/api/smokeTest.ts +11 -0
  495. package/template/koa-rest-api/src/app.test.ts +21 -0
  496. package/template/koa-rest-api/src/app.ts +8 -0
  497. package/template/koa-rest-api/src/config.ts +57 -0
  498. package/template/koa-rest-api/src/framework/logging.ts +25 -0
  499. package/template/koa-rest-api/src/framework/metrics.ts +11 -0
  500. package/template/koa-rest-api/src/framework/middleware.ts +3 -0
  501. package/template/koa-rest-api/src/framework/server.test.ts +260 -0
  502. package/template/koa-rest-api/src/framework/server.ts +51 -0
  503. package/template/koa-rest-api/src/framework/validation.test.ts +72 -0
  504. package/template/koa-rest-api/src/framework/validation.ts +77 -0
  505. package/template/koa-rest-api/src/listen.ts +24 -0
  506. package/template/koa-rest-api/src/register.ts +1 -0
  507. package/template/koa-rest-api/src/storage/jobs.ts +28 -0
  508. package/template/koa-rest-api/src/testing/logging.ts +16 -0
  509. package/template/koa-rest-api/src/testing/metrics.ts +29 -0
  510. package/template/koa-rest-api/src/testing/server.ts +31 -0
  511. package/template/koa-rest-api/src/testing/types.ts +24 -0
  512. package/template/koa-rest-api/src/tracing.ts +56 -0
  513. package/template/koa-rest-api/src/types/jobs.ts +17 -0
  514. package/template/koa-rest-api/src/types/koa.ts +8 -0
  515. package/template/koa-rest-api/tsconfig.json +18 -0
  516. package/template/lambda-sqs-worker/.buildkite/pipeline.yml +98 -0
  517. package/template/lambda-sqs-worker/.env +1 -0
  518. package/template/lambda-sqs-worker/.nvmrc +1 -0
  519. package/template/lambda-sqs-worker/Dockerfile +12 -0
  520. package/template/lambda-sqs-worker/README.md +132 -0
  521. package/template/lambda-sqs-worker/docker-compose.yml +27 -0
  522. package/template/lambda-sqs-worker/package.json +44 -0
  523. package/template/lambda-sqs-worker/serverless.yml +202 -0
  524. package/template/lambda-sqs-worker/skuba.template.js +32 -0
  525. package/template/lambda-sqs-worker/src/app.test.ts +116 -0
  526. package/template/lambda-sqs-worker/src/app.ts +57 -0
  527. package/template/lambda-sqs-worker/src/config.ts +57 -0
  528. package/template/lambda-sqs-worker/src/framework/handler.test.ts +61 -0
  529. package/template/lambda-sqs-worker/src/framework/handler.ts +43 -0
  530. package/template/lambda-sqs-worker/src/framework/logging.ts +27 -0
  531. package/template/lambda-sqs-worker/src/framework/metrics.ts +14 -0
  532. package/template/lambda-sqs-worker/src/framework/validation.test.ts +84 -0
  533. package/template/lambda-sqs-worker/src/framework/validation.ts +10 -0
  534. package/template/lambda-sqs-worker/src/hooks.ts +96 -0
  535. package/template/lambda-sqs-worker/src/mapping/jobScorer.ts +22 -0
  536. package/template/lambda-sqs-worker/src/services/aws.ts +5 -0
  537. package/template/lambda-sqs-worker/src/services/jobScorer.test.ts +44 -0
  538. package/template/lambda-sqs-worker/src/services/jobScorer.ts +59 -0
  539. package/template/lambda-sqs-worker/src/services/pipelineEventSender.test.ts +40 -0
  540. package/template/lambda-sqs-worker/src/services/pipelineEventSender.ts +33 -0
  541. package/template/lambda-sqs-worker/src/testing/handler.ts +13 -0
  542. package/template/lambda-sqs-worker/src/testing/logging.ts +19 -0
  543. package/template/lambda-sqs-worker/src/testing/services.ts +28 -0
  544. package/template/lambda-sqs-worker/src/testing/types.ts +33 -0
  545. package/template/lambda-sqs-worker/src/types/jobScorer.ts +15 -0
  546. package/template/lambda-sqs-worker/src/types/pipelineEvents.ts +21 -0
  547. package/template/lambda-sqs-worker/tsconfig.json +13 -0
  548. package/template/lambda-sqs-worker-cdk/.buildkite/pipeline.yml +95 -0
  549. package/template/lambda-sqs-worker-cdk/.nvmrc +1 -0
  550. package/template/lambda-sqs-worker-cdk/Dockerfile +13 -0
  551. package/template/lambda-sqs-worker-cdk/cdk.json +25 -0
  552. package/template/lambda-sqs-worker-cdk/docker-compose.yml +28 -0
  553. package/template/lambda-sqs-worker-cdk/infra/__snapshots__/appStack.test.ts.snap +723 -0
  554. package/template/lambda-sqs-worker-cdk/infra/appStack.test.ts +34 -0
  555. package/template/lambda-sqs-worker-cdk/infra/appStack.ts +74 -0
  556. package/template/lambda-sqs-worker-cdk/infra/index.ts +14 -0
  557. package/template/lambda-sqs-worker-cdk/package.json +30 -0
  558. package/template/lambda-sqs-worker-cdk/shared/context-types.ts +21 -0
  559. package/template/lambda-sqs-worker-cdk/skuba.template.js +27 -0
  560. package/template/lambda-sqs-worker-cdk/src/app.ts +10 -0
  561. package/template/lambda-sqs-worker-cdk/tsconfig.json +13 -0
  562. package/template/oss-npm-package/.github/workflows/release.yml +36 -0
  563. package/template/oss-npm-package/.github/workflows/validate.yml +31 -0
  564. package/template/oss-npm-package/.nvmrc +1 -0
  565. package/template/oss-npm-package/LICENSE +21 -0
  566. package/template/oss-npm-package/README.md +128 -0
  567. package/template/oss-npm-package/_package.json +47 -0
  568. package/template/oss-npm-package/skuba.template.js +22 -0
  569. package/template/oss-npm-package/src/index.test.ts +5 -0
  570. package/template/oss-npm-package/src/index.ts +7 -0
  571. package/template/oss-npm-package/tsconfig.json +10 -0
  572. package/template/private-npm-package/.buildkite/pipeline.yml +5 -0
  573. package/template/private-npm-package/.nvmrc +1 -0
  574. package/template/private-npm-package/README.md +109 -0
  575. package/template/private-npm-package/_package.json +44 -0
  576. package/template/private-npm-package/skuba.template.js +24 -0
  577. package/template/private-npm-package/src/index.test.ts +5 -0
  578. package/template/private-npm-package/src/index.ts +7 -0
  579. package/template/private-npm-package/tsconfig.json +10 -0
@@ -0,0 +1,147 @@
1
+ import type { Config } from '@jest/types';
2
+ /**
3
+ * Set of Jest options that are recommended and supported for customisation.
4
+ *
5
+ * While we technically accept anything compatible with `Config.InitialOptions`,
6
+ * these are tacitly endorsed for our use cases and receive IntelliSense.
7
+ */
8
+ type DefaultOptions = 'collectCoverage' | 'collectCoverageFrom' | 'coveragePathIgnorePatterns' | 'coverageThreshold' | 'displayName' | 'globals' | 'globalSetup' | 'globalTeardown' | 'projects' | 'setupFiles' | 'setupFilesAfterEnv' | 'snapshotSerializers' | 'testEnvironment' | 'testPathIgnorePatterns' | 'testTimeout' | 'watchPathIgnorePatterns';
9
+ /**
10
+ * Merge additional Jest options into the **skuba** preset.
11
+ *
12
+ * This concatenates array options like `testPathIgnorePatterns`.
13
+ */
14
+ export declare const mergePreset: <AdditionalOptions extends "filter" | "json" | "silent" | "cache" | "runtime" | "watch" | "runner" | "projects" | "id" | "automock" | "cacheDirectory" | "clearMocks" | "collectCoverageFrom" | "coverageDirectory" | "coveragePathIgnorePatterns" | "dependencyExtractor" | "detectLeaks" | "detectOpenHandles" | "displayName" | "errorOnDeprecated" | "extensionsToTreatAsEsm" | "fakeTimers" | "forceCoverageMatch" | "globalSetup" | "globalTeardown" | "globals" | "haste" | "injectGlobals" | "moduleDirectories" | "moduleFileExtensions" | "moduleNameMapper" | "modulePathIgnorePatterns" | "modulePaths" | "openHandlesTimeout" | "preset" | "prettierPath" | "resetMocks" | "resetModules" | "resolver" | "restoreMocks" | "rootDir" | "roots" | "sandboxInjectedGlobals" | "setupFiles" | "setupFilesAfterEnv" | "skipFilter" | "skipNodeResolution" | "slowTestThreshold" | "snapshotResolver" | "snapshotSerializers" | "snapshotFormat" | "testEnvironment" | "testEnvironmentOptions" | "testMatch" | "testLocationInResults" | "testPathIgnorePatterns" | "testRegex" | "testRunner" | "transform" | "transformIgnorePatterns" | "watchPathIgnorePatterns" | "unmockedModulePathPatterns" | "workerIdleMemoryLimit" | "bail" | "ci" | "changedFilesWithAncestor" | "changedSince" | "collectCoverage" | "coverageProvider" | "coverageReporters" | "coverageThreshold" | "expand" | "findRelatedTests" | "forceExit" | "reporters" | "logHeapUsage" | "lastCommit" | "listTests" | "maxConcurrency" | "maxWorkers" | "noStackTrace" | "notify" | "notifyMode" | "onlyChanged" | "onlyFailures" | "outputFile" | "passWithNoTests" | "randomize" | "replname" | "runTestsByPath" | "showSeed" | "testFailureExitCode" | "testNamePattern" | "testResultsProcessor" | "testSequencer" | "testTimeout" | "updateSnapshot" | "useStderr" | "verbose" | "watchAll" | "watchman" | "watchPlugins" | "workerThreads">(options: Pick<Partial<{
15
+ automock: boolean;
16
+ bail: number | boolean;
17
+ cache: boolean;
18
+ cacheDirectory: string;
19
+ ci: boolean;
20
+ clearMocks: boolean;
21
+ changedFilesWithAncestor: boolean;
22
+ changedSince: string;
23
+ collectCoverage: boolean;
24
+ collectCoverageFrom: string[];
25
+ coverageDirectory: string;
26
+ coveragePathIgnorePatterns: string[];
27
+ coverageProvider: "v8" | "babel";
28
+ coverageReporters: Config.CoverageReporters;
29
+ coverageThreshold: {
30
+ [path: string]: Config.CoverageThresholdValue;
31
+ global: Config.CoverageThresholdValue;
32
+ };
33
+ dependencyExtractor: string;
34
+ detectLeaks: boolean;
35
+ detectOpenHandles: boolean;
36
+ displayName: string | Config.DisplayName;
37
+ expand: boolean;
38
+ extensionsToTreatAsEsm: string[];
39
+ fakeTimers: Config.GlobalFakeTimersConfig & ((Config.FakeTimersConfig & {
40
+ now?: number | undefined;
41
+ }) | Config.LegacyFakeTimersConfig);
42
+ filter: string;
43
+ findRelatedTests: boolean;
44
+ forceCoverageMatch: string[];
45
+ forceExit: boolean;
46
+ json: boolean;
47
+ globals: Config.ConfigGlobals;
48
+ globalSetup: string | null | undefined;
49
+ globalTeardown: string | null | undefined;
50
+ haste: Config.HasteConfig;
51
+ id: string;
52
+ injectGlobals: boolean;
53
+ reporters: (string | Config.ReporterConfig)[];
54
+ logHeapUsage: boolean;
55
+ lastCommit: boolean;
56
+ listTests: boolean;
57
+ maxConcurrency: number;
58
+ maxWorkers: string | number;
59
+ moduleDirectories: string[];
60
+ moduleFileExtensions: string[];
61
+ moduleNameMapper: {
62
+ [key: string]: string | string[];
63
+ };
64
+ modulePathIgnorePatterns: string[];
65
+ modulePaths: string[];
66
+ noStackTrace: boolean;
67
+ notify: boolean;
68
+ notifyMode: string;
69
+ onlyChanged: boolean;
70
+ onlyFailures: boolean;
71
+ openHandlesTimeout: number;
72
+ outputFile: string;
73
+ passWithNoTests: boolean;
74
+ preset: string | null | undefined;
75
+ prettierPath: string | null | undefined;
76
+ projects: (string | Config.InitialProjectOptions)[];
77
+ randomize: boolean;
78
+ replname: string | null | undefined;
79
+ resetMocks: boolean;
80
+ resetModules: boolean;
81
+ resolver: string | null | undefined;
82
+ restoreMocks: boolean;
83
+ rootDir: string;
84
+ roots: string[];
85
+ runner: string;
86
+ runTestsByPath: boolean;
87
+ runtime: string;
88
+ sandboxInjectedGlobals: string[];
89
+ setupFiles: string[];
90
+ setupFilesAfterEnv: string[];
91
+ showSeed: boolean;
92
+ silent: boolean;
93
+ skipFilter: boolean;
94
+ skipNodeResolution: boolean;
95
+ slowTestThreshold: number;
96
+ snapshotResolver: string;
97
+ snapshotSerializers: string[];
98
+ snapshotFormat: {
99
+ readonly callToJSON?: boolean | undefined;
100
+ readonly compareKeys?: null | undefined;
101
+ readonly escapeRegex?: boolean | undefined;
102
+ readonly escapeString?: boolean | undefined;
103
+ readonly highlight?: boolean | undefined;
104
+ readonly indent?: number | undefined;
105
+ readonly maxDepth?: number | undefined;
106
+ readonly maxWidth?: number | undefined;
107
+ readonly min?: boolean | undefined;
108
+ readonly printBasicPrototype?: boolean | undefined;
109
+ readonly printFunctionName?: boolean | undefined;
110
+ readonly theme?: {
111
+ readonly value?: string | undefined;
112
+ readonly tag?: string | undefined;
113
+ readonly content?: string | undefined;
114
+ readonly comment?: string | undefined;
115
+ readonly prop?: string | undefined;
116
+ } | undefined;
117
+ };
118
+ errorOnDeprecated: boolean;
119
+ testEnvironment: string;
120
+ testEnvironmentOptions: Record<string, unknown>;
121
+ testFailureExitCode: string | number;
122
+ testLocationInResults: boolean;
123
+ testMatch: string[];
124
+ testNamePattern: string;
125
+ testPathIgnorePatterns: string[];
126
+ testRegex: string | string[];
127
+ testResultsProcessor: string;
128
+ testRunner: string;
129
+ testSequencer: string;
130
+ testTimeout: number;
131
+ transform: {
132
+ [regex: string]: string | Config.TransformerConfig;
133
+ };
134
+ transformIgnorePatterns: string[];
135
+ watchPathIgnorePatterns: string[];
136
+ unmockedModulePathPatterns: string[];
137
+ updateSnapshot: boolean;
138
+ useStderr: boolean;
139
+ verbose?: boolean | undefined;
140
+ watch: boolean;
141
+ watchAll: boolean;
142
+ watchman: boolean;
143
+ watchPlugins: (string | [string, Record<string, unknown>])[];
144
+ workerIdleMemoryLimit: string | number;
145
+ workerThreads: boolean;
146
+ }>, DefaultOptions | AdditionalOptions>) => Config.InitialOptions;
147
+ export {};
@@ -0,0 +1,41 @@
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 jest_exports = {};
30
+ __export(jest_exports, {
31
+ mergePreset: () => mergePreset
32
+ });
33
+ module.exports = __toCommonJS(jest_exports);
34
+ var import_jest_preset = __toESM(require("../../../jest-preset"));
35
+ var import_record = require("../../cli/configure/processing/record");
36
+ const mergePreset = (options) => (0, import_record.mergeRaw)(import_jest_preset.default, options);
37
+ // Annotate the CommonJS export names for ESM import in node:
38
+ 0 && (module.exports = {
39
+ mergePreset
40
+ });
41
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/api/jest/index.ts"],
4
+ "sourcesContent": ["import type { Config } from '@jest/types';\n\nimport jestPreset from '../../../jest-preset';\nimport { mergeRaw } from '../../cli/configure/processing/record';\n\n/**\n * Set of Jest options that are recommended and supported for customisation.\n *\n * While we technically accept anything compatible with `Config.InitialOptions`,\n * these are tacitly endorsed for our use cases and receive IntelliSense.\n */\ntype DefaultOptions =\n | 'collectCoverage'\n | 'collectCoverageFrom'\n | 'coveragePathIgnorePatterns'\n | 'coverageThreshold'\n | 'displayName'\n | 'globals'\n | 'globalSetup'\n | 'globalTeardown'\n | 'projects'\n | 'setupFiles'\n | 'setupFilesAfterEnv'\n | 'snapshotSerializers'\n | 'testEnvironment'\n | 'testPathIgnorePatterns'\n | 'testTimeout'\n | 'watchPathIgnorePatterns';\n\n/**\n * Merge additional Jest options into the **skuba** preset.\n *\n * This concatenates array options like `testPathIgnorePatterns`.\n */\nexport const mergePreset = <\n AdditionalOptions extends keyof Config.InitialOptions,\n>(\n options: Pick<Config.InitialOptions, AdditionalOptions | DefaultOptions>,\n): Config.InitialOptions => mergeRaw(jestPreset, options);\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,yBAAuB;AACvB,oBAAyB;AA+BlB,MAAM,cAAc,CAGzB,gBAC0B,wBAAS,mBAAAA,SAAY,OAAO;",
6
+ "names": ["jestPreset"]
7
+ }
@@ -0,0 +1,4 @@
1
+ export declare const resolveComposeAddress: (privateHost: string, privatePort: number) => Promise<{
2
+ host: string;
3
+ port: number;
4
+ }>;
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var compose_exports = {};
20
+ __export(compose_exports, {
21
+ resolveComposeAddress: () => resolveComposeAddress
22
+ });
23
+ module.exports = __toCommonJS(compose_exports);
24
+ var import_exec = require("../../utils/exec");
25
+ const portStringToNumber = (portString) => {
26
+ const port = Number(portString);
27
+ if (!Number.isSafeInteger(port)) {
28
+ throw Error(`received non-integer port: '${portString}'`);
29
+ }
30
+ return port;
31
+ };
32
+ const resolveComposeAddress = async (privateHost, privatePort) => {
33
+ const exec = (0, import_exec.createExec)({ stdio: "pipe" });
34
+ const { stdout } = await exec(
35
+ "docker-compose",
36
+ "port",
37
+ privateHost,
38
+ String(privatePort)
39
+ );
40
+ const [host, portString] = stdout.trim().split(":");
41
+ if (!host || !portString) {
42
+ throw Error(`Docker Compose returned unrecognised address: '${stdout}'`);
43
+ }
44
+ return { host, port: portStringToNumber(portString) };
45
+ };
46
+ // Annotate the CommonJS export names for ESM import in node:
47
+ 0 && (module.exports = {
48
+ resolveComposeAddress
49
+ });
50
+ //# sourceMappingURL=compose.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/api/net/compose.ts"],
4
+ "sourcesContent": ["import { createExec } from '../../utils/exec';\n\nconst portStringToNumber = (portString: string) => {\n const port = Number(portString);\n\n if (!Number.isSafeInteger(port)) {\n throw Error(`received non-integer port: '${portString}'`);\n }\n\n return port;\n};\n\nexport const resolveComposeAddress = async (\n privateHost: string,\n privatePort: number,\n) => {\n const exec = createExec({ stdio: 'pipe' });\n\n const { stdout } = await exec(\n 'docker-compose',\n 'port',\n privateHost,\n String(privatePort),\n );\n\n const [host, portString] = stdout.trim().split(':');\n\n if (!host || !portString) {\n throw Error(`Docker Compose returned unrecognised address: '${stdout}'`);\n }\n\n return { host, port: portStringToNumber(portString) };\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA2B;AAE3B,MAAM,qBAAqB,CAAC,eAAuB;AACjD,QAAM,OAAO,OAAO,UAAU;AAE9B,MAAI,CAAC,OAAO,cAAc,IAAI,GAAG;AAC/B,UAAM,MAAM,+BAA+B,UAAU,GAAG;AAAA,EAC1D;AAEA,SAAO;AACT;AAEO,MAAM,wBAAwB,OACnC,aACA,gBACG;AACH,QAAM,WAAO,wBAAW,EAAE,OAAO,OAAO,CAAC;AAEzC,QAAM,EAAE,OAAO,IAAI,MAAM;AAAA,IACvB;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,WAAW;AAAA,EACpB;AAEA,QAAM,CAAC,MAAM,UAAU,IAAI,OAAO,KAAK,EAAE,MAAM,GAAG;AAElD,MAAI,CAAC,QAAQ,CAAC,YAAY;AACxB,UAAM,MAAM,kDAAkD,MAAM,GAAG;AAAA,EACzE;AAEA,SAAO,EAAE,MAAM,MAAM,mBAAmB,UAAU,EAAE;AACtD;",
6
+ "names": []
7
+ }
@@ -0,0 +1 @@
1
+ export { waitFor } from './waitFor';
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var net_exports = {};
20
+ __export(net_exports, {
21
+ waitFor: () => import_waitFor.waitFor
22
+ });
23
+ module.exports = __toCommonJS(net_exports);
24
+ var import_waitFor = require("./waitFor");
25
+ // Annotate the CommonJS export names for ESM import in node:
26
+ 0 && (module.exports = {
27
+ waitFor
28
+ });
29
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/api/net/index.ts"],
4
+ "sourcesContent": ["export { waitFor } from './waitFor';\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAwB;",
6
+ "names": []
7
+ }
@@ -0,0 +1,5 @@
1
+ export interface SocketAddress {
2
+ host: string;
3
+ port: number;
4
+ }
5
+ export declare const pollSocket: (host: string, port: number, timeout: number) => Promise<void>;
@@ -0,0 +1,68 @@
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 socket_exports = {};
30
+ __export(socket_exports, {
31
+ pollSocket: () => pollSocket
32
+ });
33
+ module.exports = __toCommonJS(socket_exports);
34
+ var import_net = __toESM(require("net"));
35
+ const trySocket = async (host, port) => new Promise((resolve) => {
36
+ const socket = new import_net.default.Socket();
37
+ const onFailure = () => {
38
+ socket.destroy();
39
+ resolve(false);
40
+ };
41
+ const onSuccess = () => socket.end(() => resolve(true));
42
+ socket.connect(port, host, onSuccess).once("error", onFailure).once("timeout", onFailure).setTimeout(1e3);
43
+ });
44
+ const pollSocket = async (host, port, timeout) => new Promise((resolve, reject) => {
45
+ const callPort = async () => {
46
+ const success = await trySocket(host, port);
47
+ if (!success) {
48
+ return;
49
+ }
50
+ clearTimeout(intervalId);
51
+ clearTimeout(timeoutId);
52
+ resolve();
53
+ };
54
+ const intervalId = setInterval(() => {
55
+ callPort().catch(() => void 0);
56
+ }, 250);
57
+ const timeoutId = setTimeout(() => {
58
+ clearTimeout(intervalId);
59
+ clearTimeout(timeoutId);
60
+ reject(Error(`could not reach ${host}:${port} within ${timeout}ms`));
61
+ }, timeout);
62
+ callPort().catch(() => void 0);
63
+ });
64
+ // Annotate the CommonJS export names for ESM import in node:
65
+ 0 && (module.exports = {
66
+ pollSocket
67
+ });
68
+ //# sourceMappingURL=socket.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/api/net/socket.ts"],
4
+ "sourcesContent": ["import net from 'net';\n\nexport interface SocketAddress {\n host: string;\n port: number;\n}\n\nconst trySocket = async (host: string, port: number) =>\n new Promise((resolve) => {\n const socket = new net.Socket();\n\n const onFailure = () => {\n socket.destroy();\n resolve(false);\n };\n\n const onSuccess = () => socket.end(() => resolve(true));\n\n socket\n .connect(port, host, onSuccess)\n .once('error', onFailure)\n .once('timeout', onFailure)\n .setTimeout(1_000);\n });\n\nexport const pollSocket = async (host: string, port: number, timeout: number) =>\n new Promise<void>((resolve, reject) => {\n const callPort = async () => {\n const success = await trySocket(host, port);\n\n if (!success) {\n return;\n }\n\n clearTimeout(intervalId);\n clearTimeout(timeoutId);\n\n resolve();\n };\n\n const intervalId = setInterval(() => {\n callPort().catch(() => undefined);\n }, 250);\n\n const timeoutId = setTimeout(() => {\n clearTimeout(intervalId);\n clearTimeout(timeoutId);\n\n reject(Error(`could not reach ${host}:${port} within ${timeout}ms`));\n }, timeout);\n\n callPort().catch(() => undefined);\n });\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAgB;AAOhB,MAAM,YAAY,OAAO,MAAc,SACrC,IAAI,QAAQ,CAAC,YAAY;AACvB,QAAM,SAAS,IAAI,WAAAA,QAAI,OAAO;AAE9B,QAAM,YAAY,MAAM;AACtB,WAAO,QAAQ;AACf,YAAQ,KAAK;AAAA,EACf;AAEA,QAAM,YAAY,MAAM,OAAO,IAAI,MAAM,QAAQ,IAAI,CAAC;AAEtD,SACG,QAAQ,MAAM,MAAM,SAAS,EAC7B,KAAK,SAAS,SAAS,EACvB,KAAK,WAAW,SAAS,EACzB,WAAW,GAAK;AACrB,CAAC;AAEI,MAAM,aAAa,OAAO,MAAc,MAAc,YAC3D,IAAI,QAAc,CAAC,SAAS,WAAW;AACrC,QAAM,WAAW,YAAY;AAC3B,UAAM,UAAU,MAAM,UAAU,MAAM,IAAI;AAE1C,QAAI,CAAC,SAAS;AACZ;AAAA,IACF;AAEA,iBAAa,UAAU;AACvB,iBAAa,SAAS;AAEtB,YAAQ;AAAA,EACV;AAEA,QAAM,aAAa,YAAY,MAAM;AACnC,aAAS,EAAE,MAAM,MAAM,MAAS;AAAA,EAClC,GAAG,GAAG;AAEN,QAAM,YAAY,WAAW,MAAM;AACjC,iBAAa,UAAU;AACvB,iBAAa,SAAS;AAEtB,WAAO,MAAM,mBAAmB,IAAI,IAAI,IAAI,WAAW,OAAO,IAAI,CAAC;AAAA,EACrE,GAAG,OAAO;AAEV,WAAS,EAAE,MAAM,MAAM,MAAS;AAClC,CAAC;",
6
+ "names": ["net"]
7
+ }
@@ -0,0 +1,22 @@
1
+ import { type SocketAddress } from './socket';
2
+ /**
3
+ * Wait for a resource to start listening on a socket address.
4
+ *
5
+ * The socket is polled on an interval until it accepts a connection or the
6
+ * `timeout` is reached.
7
+ */
8
+ export declare const waitFor: ({ host, port, resolveCompose, timeout, }: {
9
+ host?: string | undefined;
10
+ port: number;
11
+ /**
12
+ * Whether to treat the `host` and `port` arguments as a private Docker
13
+ * Compose network address and to resolve them to a public local address.
14
+ *
15
+ * This is typically:
16
+ *
17
+ * - Enabled locally, when the application is running directly on the machine
18
+ * - Disabled in CI, when running in a container on the Docker Compose network
19
+ */
20
+ resolveCompose?: boolean | undefined;
21
+ timeout?: number | undefined;
22
+ }) => Promise<SocketAddress>;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var waitFor_exports = {};
20
+ __export(waitFor_exports, {
21
+ waitFor: () => waitFor
22
+ });
23
+ module.exports = __toCommonJS(waitFor_exports);
24
+ var import_compose = require("./compose");
25
+ var import_socket = require("./socket");
26
+ const waitFor = async ({
27
+ host = "localhost",
28
+ port,
29
+ resolveCompose = false,
30
+ timeout = 15e3
31
+ }) => {
32
+ const resolvedAddress = resolveCompose ? await (0, import_compose.resolveComposeAddress)(host, port) : { host, port };
33
+ await (0, import_socket.pollSocket)(resolvedAddress.host, resolvedAddress.port, timeout);
34
+ return resolvedAddress;
35
+ };
36
+ // Annotate the CommonJS export names for ESM import in node:
37
+ 0 && (module.exports = {
38
+ waitFor
39
+ });
40
+ //# sourceMappingURL=waitFor.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/api/net/waitFor.ts"],
4
+ "sourcesContent": ["import { resolveComposeAddress } from './compose';\nimport { type SocketAddress, pollSocket } from './socket';\n\n/**\n * Wait for a resource to start listening on a socket address.\n *\n * The socket is polled on an interval until it accepts a connection or the\n * `timeout` is reached.\n */\nexport const waitFor = async ({\n host = 'localhost',\n port,\n resolveCompose = false,\n timeout = 15_000,\n}: {\n host?: string;\n\n port: number;\n\n /**\n * Whether to treat the `host` and `port` arguments as a private Docker\n * Compose network address and to resolve them to a public local address.\n *\n * This is typically:\n *\n * - Enabled locally, when the application is running directly on the machine\n * - Disabled in CI, when running in a container on the Docker Compose network\n */\n resolveCompose?: boolean;\n\n timeout?: number;\n}): Promise<SocketAddress> => {\n const resolvedAddress = resolveCompose\n ? await resolveComposeAddress(host, port)\n : { host, port };\n\n await pollSocket(resolvedAddress.host, resolvedAddress.port, timeout);\n\n return resolvedAddress;\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAsC;AACtC,oBAA+C;AAQxC,MAAM,UAAU,OAAO;AAAA,EAC5B,OAAO;AAAA,EACP;AAAA,EACA,iBAAiB;AAAA,EACjB,UAAU;AACZ,MAiB8B;AAC5B,QAAM,kBAAkB,iBACpB,UAAM,sCAAsB,MAAM,IAAI,IACtC,EAAE,MAAM,KAAK;AAEjB,YAAM,0BAAW,gBAAgB,MAAM,gBAAgB,MAAM,OAAO;AAEpE,SAAO;AACT;",
6
+ "names": []
7
+ }
@@ -0,0 +1,14 @@
1
+ import { type Linter } from 'eslint';
2
+ import { type Logger } from '../../utils/logging';
3
+ export interface ESLintResult {
4
+ messages: Linter.LintMessage[];
5
+ filePath: string;
6
+ }
7
+ export interface ESLintOutput {
8
+ errors: ESLintResult[];
9
+ fixable: boolean;
10
+ ok: boolean;
11
+ output: string;
12
+ warnings: ESLintResult[];
13
+ }
14
+ export declare const runESLint: (mode: 'format' | 'lint', logger: Logger) => Promise<ESLintOutput>;
@@ -0,0 +1,99 @@
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");
38
+ const symbolForResult = (result) => {
39
+ if (result.errorCount) {
40
+ return import_chalk.default.red("\u25CB");
41
+ }
42
+ return result.warningCount ? import_chalk.default.yellow("\u25CD") : import_chalk.default.green("\u25CB");
43
+ };
44
+ const runESLint = async (mode, logger) => {
45
+ logger.debug("Initialising ESLint...");
46
+ const engine = new import_eslint.ESLint({
47
+ cache: true,
48
+ fix: mode === "format",
49
+ reportUnusedDisableDirectives: "error"
50
+ });
51
+ const cwd = process.cwd();
52
+ logger.debug("Processing files...");
53
+ const start = process.hrtime.bigint();
54
+ const [formatter, results] = await Promise.all([
55
+ engine.loadFormatter(),
56
+ engine.lintFiles(".")
57
+ ]);
58
+ const end = process.hrtime.bigint();
59
+ logger.plain(
60
+ `Processed ${(0, import_logging.pluralise)(results.length, "file")} in ${logger.timing(
61
+ start,
62
+ end
63
+ )}.`
64
+ );
65
+ const errors = [];
66
+ const warnings = [];
67
+ let fixable = false;
68
+ for (const result of results) {
69
+ const relativePath = import_path.default.relative(cwd, result.filePath);
70
+ if (result.fixableErrorCount + result.fixableWarningCount) {
71
+ fixable = true;
72
+ }
73
+ if (result.errorCount) {
74
+ errors.push({
75
+ filePath: relativePath,
76
+ messages: result.messages
77
+ });
78
+ }
79
+ if (result.warningCount) {
80
+ warnings.push({
81
+ filePath: relativePath,
82
+ messages: result.messages
83
+ });
84
+ }
85
+ logger.debug(symbolForResult(result), relativePath);
86
+ }
87
+ const ok = errors.length === 0;
88
+ await import_eslint.ESLint.outputFixes(results);
89
+ const output = await formatter.format(results);
90
+ if (output) {
91
+ logger.plain(output);
92
+ }
93
+ return { errors, fixable, ok, output, warnings };
94
+ };
95
+ // Annotate the CommonJS export names for ESM import in node:
96
+ 0 && (module.exports = {
97
+ runESLint
98
+ });
99
+ //# sourceMappingURL=eslint.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/cli/adapter/eslint.ts"],
4
+ "sourcesContent": ["import path from 'path';\n\nimport chalk from 'chalk';\nimport { ESLint, type Linter } from 'eslint';\n\nimport { type Logger, pluralise } from '../../utils/logging';\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): Promise<ESLintOutput> => {\n logger.debug('Initialising ESLint...');\n\n const engine = new ESLint({\n cache: true,\n fix: mode === 'format',\n reportUnusedDisableDirectives: 'error',\n });\n\n const cwd = process.cwd();\n\n logger.debug('Processing files...');\n\n const start = process.hrtime.bigint();\n\n const [formatter, results] = await Promise.all([\n engine.loadFormatter(),\n engine.lintFiles('.'),\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(results);\n\n if (output) {\n logger.plain(output);\n }\n\n return { errors, fixable, ok, output, warnings };\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,mBAAkB;AAClB,oBAAoC;AAEpC,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,WAC0B;AAC1B,SAAO,MAAM,wBAAwB;AAErC,QAAM,SAAS,IAAI,qBAAO;AAAA,IACxB,OAAO;AAAA,IACP,KAAK,SAAS;AAAA,IACd,+BAA+B;AAAA,EACjC,CAAC;AAED,QAAM,MAAM,QAAQ,IAAI;AAExB,SAAO,MAAM,qBAAqB;AAElC,QAAM,QAAQ,QAAQ,OAAO,OAAO;AAEpC,QAAM,CAAC,WAAW,OAAO,IAAI,MAAM,QAAQ,IAAI;AAAA,IAC7C,OAAO,cAAc;AAAA,IACrB,OAAO,UAAU,GAAG;AAAA,EACtB,CAAC;AAED,QAAM,MAAM,QAAQ,OAAO,OAAO;AAElC,SAAO;AAAA,IACL,iBAAa,0BAAU,QAAQ,QAAQ,MAAM,CAAC,OAAO,OAAO;AAAA,MAC1D;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH;AAEA,QAAM,SAAyB,CAAC;AAChC,QAAM,WAA2B,CAAC;AAClC,MAAI,UAAU;AAEd,aAAW,UAAU,SAAS;AAC5B,UAAM,eAAe,YAAAC,QAAK,SAAS,KAAK,OAAO,QAAQ;AACvD,QAAI,OAAO,oBAAoB,OAAO,qBAAqB;AACzD,gBAAU;AAAA,IACZ;AAEA,QAAI,OAAO,YAAY;AACrB,aAAO,KAAK;AAAA,QACV,UAAU;AAAA,QACV,UAAU,OAAO;AAAA,MACnB,CAAC;AAAA,IACH;AAEA,QAAI,OAAO,cAAc;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,qBAAO,YAAY,OAAO;AAEhC,QAAM,SAAS,MAAM,UAAU,OAAO,OAAO;AAE7C,MAAI,QAAQ;AACV,WAAO,MAAM,MAAM;AAAA,EACrB;AAEA,SAAO,EAAE,QAAQ,SAAS,IAAI,QAAQ,SAAS;AACjD;",
6
+ "names": ["chalk", "path"]
7
+ }
@@ -0,0 +1,52 @@
1
+ import { type Options } from 'prettier';
2
+ import { type Logger } from '../../utils/logging';
3
+ /**
4
+ * Infers a parser for the specified filepath.
5
+ *
6
+ * This is a cut-down version of Prettier's built-in function of the same name;
7
+ * ours operates purely on the `filepath` string and does not perform file I/O.
8
+ * Prettier's internal `getInterpreter` function can open a file to read the
9
+ * shebang, and its file descriptor usage can throw warnings on worker threads:
10
+ *
11
+ * ```console
12
+ * Warning: File descriptor 123 closed but not opened in unmanaged mode
13
+ * at Object.closeSync (node:fs:530:11)
14
+ * at Object.closeSync (node_modules/graceful-fs/graceful-fs.js:74:20)
15
+ * ...
16
+ * ```
17
+ *
18
+ * References:
19
+ *
20
+ * - https://github.com/prettier/prettier/blob/2.4.1/src/main/options.js#L167
21
+ * - seek-oss/skuba#659
22
+ */
23
+ export declare const inferParser: (filepath: string) => Promise<string | undefined>;
24
+ interface File {
25
+ data: string;
26
+ options: Options;
27
+ filepath: string;
28
+ }
29
+ interface Result {
30
+ count: number;
31
+ errored: Array<{
32
+ err?: unknown;
33
+ filepath: string;
34
+ }>;
35
+ touched: string[];
36
+ unparsed: string[];
37
+ }
38
+ export declare const formatOrLintFile: ({ data, filepath, options }: File, mode: 'format' | 'lint', result: Result | null) => Promise<string | undefined>;
39
+ export interface PrettierOutput {
40
+ ok: boolean;
41
+ result: Result;
42
+ }
43
+ /**
44
+ * Formats/lints files with Prettier.
45
+ *
46
+ * Prettier doesn't provide a higher-level Node.js API that replicates the
47
+ * behaviour of its CLI, so we have to plumb together its lower-level functions.
48
+ * On the other hand, this affords more flexibility in how we track and report
49
+ * on progress and results.
50
+ */
51
+ export declare const runPrettier: (mode: 'format' | 'lint', logger: Logger) => Promise<PrettierOutput>;
52
+ export {};