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,24 @@
1
+ import './register';
2
+
3
+ import app from './app';
4
+ import { config } from './config';
5
+ import { logger } from './framework/logging';
6
+
7
+ // This implements a minimal version of `koa-cluster`'s interface
8
+ // If your application is deployed with more than 1 vCPU you can delete this
9
+ // file and use `koa-cluster` to run `lib/app`.
10
+
11
+ const listener = app.listen(config.port, () => {
12
+ const address = listener.address();
13
+
14
+ if (typeof address === 'object' && address) {
15
+ logger.debug(`listening on port ${address.port}`);
16
+ }
17
+ });
18
+
19
+ // Gantry ALB default idle timeout is 30 seconds
20
+ // https://nodejs.org/docs/latest-v18.x/api/http.html#serverkeepalivetimeout
21
+ // Node default is 5 seconds
22
+ // https://docs.aws.amazon.com/elasticloadbalancing/latest/application/application-load-balancers.html#connection-idle-timeout
23
+ // AWS recommends setting an application timeout larger than the load balancer
24
+ listener.keepAliveTimeout = 31000;
@@ -0,0 +1 @@
1
+ import 'skuba-dive/register';
@@ -0,0 +1,28 @@
1
+ import { randomUUID } from 'crypto';
2
+
3
+ import type { Job, JobInput } from 'src/types/jobs';
4
+
5
+ const jobStore: Record<string, Job> = {};
6
+
7
+ export const createJob = (jobInput: JobInput): Promise<Job> => {
8
+ const id = randomUUID();
9
+
10
+ const job = { ...jobInput, id };
11
+
12
+ jobStore[id] = job;
13
+
14
+ return Promise.resolve(job);
15
+ };
16
+
17
+ export const readJobs = (): Promise<Job[]> => {
18
+ const jobs = Object.values(jobStore);
19
+
20
+ return Promise.resolve(jobs);
21
+ };
22
+
23
+ /**
24
+ * Tests that we have access to read from and write to our storage.
25
+ */
26
+ export const smokeTestJobStorage = async (): Promise<void> => {
27
+ await Promise.resolve();
28
+ };
@@ -0,0 +1,16 @@
1
+ import * as logging from 'src/framework/logging';
2
+
3
+ export const logger = {
4
+ error: jest.fn(),
5
+ info: jest.fn(),
6
+
7
+ clear: () => {
8
+ logger.error.mockClear();
9
+ logger.info.mockClear();
10
+ },
11
+
12
+ spy: () => {
13
+ jest.spyOn(logging.logger, 'error').mockImplementation(logger.error);
14
+ jest.spyOn(logging.logger, 'info').mockImplementation(logger.info);
15
+ },
16
+ };
@@ -0,0 +1,29 @@
1
+ import * as metrics from 'src/framework/metrics';
2
+
3
+ function assertDefined<T>(value: T | undefined): asserts value is T {
4
+ expect(value).toBeDefined();
5
+ }
6
+
7
+ export const metricsClient = {
8
+ clear: () => (metrics.metricsClient.mockBuffer = []),
9
+
10
+ expectTagSubset: (subset: string[], index: number = 0) => {
11
+ const tags = metricsClient.tags(index);
12
+
13
+ subset.forEach((tag) => expect(tags).toContain(tag));
14
+ },
15
+
16
+ tags: (index: number = 0) => {
17
+ assertDefined(metrics.metricsClient.mockBuffer);
18
+
19
+ const line = metrics.metricsClient.mockBuffer[index];
20
+
21
+ assertDefined(line);
22
+
23
+ const [, tagString] = line.split('#', 2);
24
+
25
+ assertDefined(tagString);
26
+
27
+ return tagString.split(',');
28
+ },
29
+ };
@@ -0,0 +1,31 @@
1
+ import type Router from '@koa/router';
2
+ import type Koa from 'koa';
3
+ import request from 'supertest';
4
+
5
+ import { createApp } from 'src/framework/server';
6
+
7
+ /**
8
+ * Create a new SuperTest agent from a Koa application.
9
+ */
10
+ export const agentFromApp = <State, Context>(app: Koa<State, Context>) =>
11
+ request.agent(app.callback());
12
+
13
+ /**
14
+ * Create a new SuperTest agent from a set of Koa middleware.
15
+ */
16
+ export const agentFromMiddleware = <State, Context>(
17
+ ...middleware: Array<Koa.Middleware<State, Context>>
18
+ ) => {
19
+ const app = createApp(...middleware);
20
+
21
+ return agentFromApp(app);
22
+ };
23
+
24
+ /**
25
+ * Create a new SuperTest agent from a Koa router.
26
+ */
27
+ export const agentFromRouter = (router: Router) => {
28
+ const app = createApp(router.routes(), router.allowedMethods());
29
+
30
+ return agentFromApp(app);
31
+ };
@@ -0,0 +1,24 @@
1
+ import { Chance } from 'chance';
2
+ import { z } from 'zod';
3
+
4
+ import type { JobInput } from 'src/types/jobs';
5
+
6
+ export type IdDescription = z.infer<typeof IdDescriptionSchema>;
7
+
8
+ export const IdDescriptionSchema = z.object({
9
+ id: z.string(),
10
+ description: z.string(),
11
+ });
12
+
13
+ export const chance = new Chance();
14
+
15
+ export const mockIdDescription = (): IdDescription => ({
16
+ id: chance.guid({ version: 4 }),
17
+ description: chance.sentence(),
18
+ });
19
+
20
+ export const mockJobInput = (): JobInput => ({
21
+ hirer: {
22
+ id: chance.guid({ version: 4 }),
23
+ },
24
+ });
@@ -0,0 +1,56 @@
1
+ /**
2
+ * OpenTelemetry tracing initialisation. This is a standalone TS/JS module that is not
3
+ * referenced by application source code directly. It is required at runtime using the
4
+ * node command's `--require` argument, see Dockerfile for details.
5
+ */
6
+
7
+ import { propagation } from '@opentelemetry/api';
8
+ import { CompositePropagator } from '@opentelemetry/core';
9
+ import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-grpc';
10
+ import { AwsInstrumentation } from '@opentelemetry/instrumentation-aws-sdk';
11
+ import { HttpInstrumentation } from '@opentelemetry/instrumentation-http';
12
+ import { B3InjectEncoding, B3Propagator } from '@opentelemetry/propagator-b3';
13
+ import { NodeSDK } from '@opentelemetry/sdk-node';
14
+
15
+ const app = 'opentelemetry';
16
+ const log = (level: string, msg: string, extra = {}) => {
17
+ const toLog = { msg, level, app, time: new Date().toISOString(), ...extra };
18
+ console.log(JSON.stringify(toLog)); // eslint-disable-line no-console
19
+ };
20
+
21
+ const main = () => {
22
+ // Use B3 propagation to ensure proper propagation between systems that use
23
+ // OpenTelemetry and native Datadog APM, such as Istio/Envoy.
24
+ propagation.setGlobalPropagator(
25
+ new CompositePropagator({
26
+ propagators: [
27
+ new B3Propagator(),
28
+ new B3Propagator({ injectEncoding: B3InjectEncoding.MULTI_HEADER }),
29
+ ],
30
+ }),
31
+ );
32
+
33
+ const sdk = new NodeSDK({
34
+ traceExporter: new OTLPTraceExporter(),
35
+ autoDetectResources: false,
36
+ instrumentations: [new HttpInstrumentation(), new AwsInstrumentation()],
37
+ });
38
+
39
+ sdk.start();
40
+
41
+ process.on('SIGTERM', () => {
42
+ sdk
43
+ .shutdown()
44
+ .then(() => log('info', 'OpenTelemetry successfully terminated'))
45
+ .catch((err: Error) =>
46
+ log('error', 'OpenTelemetry failed to terminate', { err }),
47
+ )
48
+ .finally(() => process.exit(0)); // eslint-disable-line no-process-exit
49
+ });
50
+ };
51
+
52
+ if (process.env.OPENTELEMETRY_ENABLED === 'true') {
53
+ main();
54
+ } else {
55
+ log('info', 'OpenTelemetry not enabled');
56
+ }
@@ -0,0 +1,17 @@
1
+ import { z } from 'zod';
2
+
3
+ export interface Job {
4
+ id: string;
5
+
6
+ hirer: {
7
+ id: string;
8
+ };
9
+ }
10
+
11
+ export type JobInput = z.infer<typeof JobInputSchema>;
12
+
13
+ export const JobInputSchema = z.object({
14
+ hirer: z.object({
15
+ id: z.string(),
16
+ }),
17
+ });
@@ -0,0 +1,8 @@
1
+ import type Koa from 'koa';
2
+ import type { RequestLogging } from 'seek-koala';
3
+
4
+ export type Context = Koa.ParameterizedContext<State>;
5
+
6
+ export type Middleware = Koa.Middleware<State>;
7
+
8
+ export type State = RequestLogging.State;
@@ -0,0 +1,18 @@
1
+ {
2
+ "compilerOptions": {
3
+ "baseUrl": ".",
4
+ "lib": [
5
+ // open-telemetry/opentelemetry-js#3580
6
+ "DOM",
7
+
8
+ "ES2022"
9
+ ],
10
+ "outDir": "lib",
11
+ "paths": {
12
+ "src": ["src"]
13
+ },
14
+ "target": "ES2022"
15
+ },
16
+ "exclude": ["lib*/**/*"],
17
+ "extends": "skuba/config/tsconfig.json"
18
+ }
@@ -0,0 +1,98 @@
1
+ agents:
2
+ queue: <%- prodBuildkiteQueueName %>
3
+
4
+ configs:
5
+ plugins:
6
+ - &aws-sm
7
+ seek-oss/aws-sm#v2.3.1:
8
+ env:
9
+ NPM_READ_TOKEN: arn:aws:secretsmanager:ap-southeast-2:987872074697:secret:npm/npm-read-token
10
+
11
+ - &docker-ecr-cache
12
+ seek-oss/docker-ecr-cache#v2.1.0: &docker-ecr-cache-defaults
13
+ cache-on:
14
+ - package.json
15
+ - yarn.lock
16
+ secrets: id=npm,src=.npmrc
17
+
18
+ - &private-npm
19
+ seek-oss/private-npm#v1.2.0:
20
+ env: NPM_READ_TOKEN
21
+
22
+ base-steps:
23
+ - &deploy
24
+ commands:
25
+ - echo '+++ yarn deploy'
26
+ - yarn deploy
27
+ concurrency: 1
28
+ plugins:
29
+ - artifacts#v1.9.2:
30
+ build: ${BUILDKITE_BUILD_ID}
31
+ download: lib/*
32
+ - *aws-sm
33
+ - *private-npm
34
+ - *docker-ecr-cache
35
+ - docker-compose#v4.14.0:
36
+ dependencies: false
37
+ run: app
38
+ retry:
39
+ manual:
40
+ # Only use this if you need to roll back a deployment ASAP.
41
+ # Always follow up with a proper revert or fix in Git history.
42
+ permit_on_passed: true
43
+
44
+ env:
45
+ VERSION: ${BUILDKITE_COMMIT:0:7}.${BUILDKITE_BUILD_NUMBER}
46
+
47
+ steps:
48
+ - label: 🧪 Test, Lint & Build
49
+ artifact_paths: lib/**/*
50
+ commands:
51
+ - echo '+++ yarn test:ci'
52
+ - yarn test:ci
53
+ - echo '--- yarn lint'
54
+ - yarn lint
55
+ - echo '--- yarn build'
56
+ - yarn build
57
+ env:
58
+ GET_GITHUB_TOKEN: please
59
+ plugins:
60
+ - *aws-sm
61
+ - *private-npm
62
+ - *docker-ecr-cache
63
+ - docker-compose#v4.14.0:
64
+ run: app
65
+ timeout_in_minutes: 10
66
+
67
+ - agents:
68
+ queue: <%- devBuildkiteQueueName %>
69
+ branches: '!renovate-*'
70
+ label: 🧖‍♀️ Warm Dev
71
+ command: ':'
72
+ plugins:
73
+ - *aws-sm
74
+ - *private-npm
75
+ - seek-oss/docker-ecr-cache#v2.1.0:
76
+ <<: *docker-ecr-cache-defaults
77
+ skip-pull-from-cache: true
78
+
79
+ - wait
80
+ - block: 🙋🏻‍♀️ Deploy Dev
81
+ branches: '!${BUILDKITE_PIPELINE_DEFAULT_BRANCH}'
82
+
83
+ - <<: *deploy
84
+ agents:
85
+ queue: <%- devBuildkiteQueueName %>
86
+ env:
87
+ ENVIRONMENT: dev
88
+ concurrency_group: <%- repoName %>/deploy/dev
89
+ label: 🤞 Deploy Dev
90
+
91
+ - wait
92
+
93
+ - <<: *deploy
94
+ env:
95
+ ENVIRONMENT: prod
96
+ branches: ${BUILDKITE_PIPELINE_DEFAULT_BRANCH}
97
+ concurrency_group: <%- repoName %>/deploy/prod
98
+ label: 🚀 Deploy Prod
@@ -0,0 +1 @@
1
+ ENVIRONMENT=local
@@ -0,0 +1 @@
1
+ 18
@@ -0,0 +1,12 @@
1
+ # syntax=docker/dockerfile:1.2
2
+
3
+ FROM --platform=${BUILDPLATFORM:-<%- platformName %>} node:18-alpine AS dev-deps
4
+
5
+ WORKDIR /workdir
6
+
7
+ COPY package.json yarn.lock ./
8
+
9
+ RUN \
10
+ --mount=type=secret,id=npm,dst=/workdir/.npmrc \
11
+ yarn install --frozen-lockfile --ignore-optional --non-interactive && \
12
+ yarn cache clean
@@ -0,0 +1,132 @@
1
+ # <%- repoName %>
2
+
3
+ [![Powered by skuba](https://img.shields.io/badge/🤿%20skuba-powered-009DC4)](https://github.com/seek-oss/skuba)
4
+
5
+ Next steps:
6
+
7
+ 1. [ ] Finish templating if this was skipped earlier:
8
+
9
+ ```shell
10
+ yarn skuba configure
11
+ ```
12
+
13
+ 2. [ ] Create a new repository in the appropriate GitHub organisation.
14
+ 3. [ ] Add the repository to BuildAgency;
15
+ see [Builds at SEEK] for more information.
16
+ 4. [ ] Add Datadog extension, deployment bucket configuration and data classification tags to [serverless.yml](serverless.yml).
17
+ 5. [ ] Push local commits to the upstream GitHub branch.
18
+ 6. [ ] Configure [GitHub repository settings].
19
+ 7. [ ] Delete this checklist 😌.
20
+
21
+ [builds at seek]: https://builds-at-seek.ssod.skinfra.xyz
22
+ [github repository settings]: https://github.com/<%-orgName%>/<%-repoName%>/settings
23
+
24
+ ## Design
25
+
26
+ <%-repoName %> is a Node.js [Lambda] application built in line with our [technology strategy].
27
+ It is backed by a typical SQS message + dead letter queue configuration and uses common SEEK packages.
28
+ Workers enable fault-tolerant asynchronous processing of events.
29
+
30
+ The `lambda-sqs-worker` template is modelled after a hypothetical enricher that scores job advertisements.
31
+ It's stubbed out with in-memory [scoring service](src/services/jobScorer.ts).
32
+ This would be replaced with internal logic or an external service in production.
33
+
34
+ This project is deployed with [Serverless].
35
+ The Lambda runtime provisions a single Node.js process per container.
36
+ The supplied [serverless.yml](serverless.yml) starts out with a minimal `memorySize` which may require tuning based on workload.
37
+ Under load, we autoscale horizontally in terms of container count up to `reservedConcurrency`.
38
+
39
+ Serverless configures [CodeDeploy] for a blue-green deployment approach.
40
+ A smoke test is run against the new version before traffic is switched over,
41
+ providing an opportunity to test access and connectivity to online dependencies.
42
+ This defaults to an invocation with an empty object `{}`, per [src/hooks.ts](src/hooks.ts).
43
+
44
+ ## Development
45
+
46
+ ### Test
47
+
48
+ ```shell
49
+ # Run Jest tests locally
50
+ yarn test
51
+
52
+ # Authenticate to dev account
53
+ awsauth
54
+
55
+ # Run smoke test against deployed application
56
+ ENVIRONMENT=dev yarn smoke
57
+ ```
58
+
59
+ ### Lint
60
+
61
+ ```shell
62
+ # Fix issues
63
+ yarn format
64
+
65
+ # Check for issues
66
+ yarn lint
67
+ ```
68
+
69
+ ### Start
70
+
71
+ ```shell
72
+ # Start a local HTTP server
73
+ yarn start
74
+
75
+ # Start with Node.js Inspector enabled
76
+ yarn start:debug
77
+ ```
78
+
79
+ This serves the Lambda application over HTTP.
80
+ For example, to invoke the handler with an empty object `{}` for smoke testing:
81
+
82
+ ```shell
83
+ curl --data '[{}, {"awsRequestId": "local"}]' --include localhost:<%- port %>
84
+ ```
85
+
86
+ ### Deploy
87
+
88
+ This project is deployed through a [Buildkite pipeline](.buildkite/pipeline.yml).
89
+
90
+ - Commits to a feature branch can be deployed to the dev environment by unblocking a step in the Buildkite UI
91
+ - Commits to the default branch are automatically deployed to the dev and prod environments in sequence
92
+
93
+ To deploy locally:
94
+
95
+ ```shell
96
+ # Authenticate to dev account
97
+ awsauth
98
+
99
+ ENVIRONMENT=dev yarn deploy
100
+ ```
101
+
102
+ To rapidly roll back a change,
103
+ retry an individual deployment step from the previous build in Buildkite.
104
+ Note that this will introduce drift between the head of the default Git branch and the live environment;
105
+ use with caution and always follow up with a proper revert or fix in Git history.
106
+
107
+ ## Support
108
+
109
+ ### Dev
110
+
111
+ TODO: add support links for the dev environment.
112
+
113
+ <!--
114
+ - CloudWatch dashboard
115
+ - Datadog dashboard
116
+ - Splunk logs
117
+ -->
118
+
119
+ ### Prod
120
+
121
+ TODO: add support links for the prod environment.
122
+
123
+ <!--
124
+ - CloudWatch dashboard
125
+ - Datadog dashboard
126
+ - Splunk logs
127
+ -->
128
+
129
+ [codedeploy]: https://docs.aws.amazon.com/codedeploy
130
+ [lambda]: https://docs.aws.amazon.com/lambda
131
+ [serverless]: https://www.serverless.com/
132
+ [technology strategy]: https://tech-strategy.ssod.skinfra.xyz
@@ -0,0 +1,27 @@
1
+ version: '3.7'
2
+
3
+ services:
4
+ app:
5
+ environment:
6
+ # Enable Buildkite + GitHub integrations.
7
+ - BUILDKITE
8
+ - BUILDKITE_AGENT_ACCESS_TOKEN
9
+ - BUILDKITE_BRANCH
10
+ - BUILDKITE_BUILD_NUMBER
11
+ - BUILDKITE_JOB_ID
12
+ - BUILDKITE_PIPELINE_DEFAULT_BRANCH
13
+ - BUILDKITE_STEP_ID
14
+ - GITHUB_API_TOKEN
15
+ # Tag AWS resources with the commit hash.
16
+ - BUILDKITE_COMMIT
17
+ # Pass through application configuration.
18
+ - ENVIRONMENT
19
+ - VERSION
20
+ image: ${BUILDKITE_PLUGIN_DOCKER_IMAGE:-''}
21
+ init: true
22
+ volumes:
23
+ - ./:/workdir
24
+ # Mount agent for Buildkite annotations.
25
+ - /usr/bin/buildkite-agent:/usr/bin/buildkite-agent
26
+ # Mount cached dependencies.
27
+ - /workdir/node_modules
@@ -0,0 +1,44 @@
1
+ {
2
+ "private": true,
3
+ "license": "UNLICENSED",
4
+ "scripts": {
5
+ "build": "skuba build",
6
+ "deploy": "serverless deploy --force --verbose",
7
+ "format": "skuba format",
8
+ "lint": "skuba lint",
9
+ "smoke": "serverless invoke --data '{}' --function Worker",
10
+ "start": "skuba start --port <%- port %>",
11
+ "start:debug": "yarn start --inspect-brk",
12
+ "test": "skuba test",
13
+ "test:ci": "skuba test --coverage",
14
+ "test:watch": "skuba test --watch"
15
+ },
16
+ "dependencies": {
17
+ "@aws-sdk/client-codedeploy": "^3.363.0",
18
+ "@aws-sdk/client-lambda": "^3.363.0",
19
+ "@aws-sdk/client-sns": "^3.363.0",
20
+ "@aws-sdk/util-utf8-node": "^3.259.0",
21
+ "@seek/logger": "^6.0.0",
22
+ "datadog-lambda-js": "^7.0.0",
23
+ "dd-trace": "^4.0.0",
24
+ "skuba-dive": "^2.0.0",
25
+ "zod": "^3.19.1"
26
+ },
27
+ "devDependencies": {
28
+ "@types/aws-lambda": "^8.10.84",
29
+ "@types/chance": "^1.1.3",
30
+ "@types/node": "^18.11.9",
31
+ "aws-sdk-client-mock": "^3.0.0",
32
+ "aws-sdk-client-mock-jest": "^3.0.0",
33
+ "chance": "^1.1.8",
34
+ "pino-pretty": "^10.0.0",
35
+ "serverless": "^3.25.0",
36
+ "serverless-plugin-canary-deployments": "^0.8.0",
37
+ "serverless-plugin-datadog": "^5.12.0",
38
+ "serverless-prune-plugin": "^2.0.0",
39
+ "skuba": "*"
40
+ },
41
+ "engines": {
42
+ "node": ">=18.12"
43
+ }
44
+ }