skuba 13.0.0-subpath-imports-20250722044721 → 13.0.0-subpath-imports-20251003044159

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 (268) hide show
  1. package/README.md +1 -2
  2. package/config/tsconfig.json +2 -1
  3. package/jest/moduleNameMapper.js +3 -11
  4. package/lib/cli/build/assets.js +4 -8
  5. package/lib/cli/build/assets.js.map +2 -2
  6. package/lib/cli/build/esbuild.d.ts +2 -1
  7. package/lib/cli/build/esbuild.js +5 -4
  8. package/lib/cli/build/esbuild.js.map +2 -2
  9. package/lib/cli/build/index.js +9 -5
  10. package/lib/cli/build/index.js.map +2 -2
  11. package/lib/cli/build/tsc.d.ts +9 -2
  12. package/lib/cli/build/tsc.js +76 -40
  13. package/lib/cli/build/tsc.js.map +3 -3
  14. package/lib/cli/configure/analyseDependencies.d.ts +2 -2
  15. package/lib/cli/configure/analyseDependencies.js.map +1 -1
  16. package/lib/cli/configure/analysis/package.d.ts +1 -1
  17. package/lib/cli/configure/analysis/package.js +1 -1
  18. package/lib/cli/configure/analysis/package.js.map +2 -2
  19. package/lib/cli/configure/ensureTemplateCompletion.d.ts +2 -2
  20. package/lib/cli/configure/ensureTemplateCompletion.js.map +1 -1
  21. package/lib/cli/configure/getEntryPoint.d.ts +2 -2
  22. package/lib/cli/configure/getEntryPoint.js.map +1 -1
  23. package/lib/cli/configure/getProjectType.d.ts +2 -2
  24. package/lib/cli/configure/getProjectType.js.map +1 -1
  25. package/lib/cli/configure/processing/configFile.d.ts +1 -1
  26. package/lib/cli/configure/processing/configFile.js +48 -6
  27. package/lib/cli/configure/processing/configFile.js.map +2 -2
  28. package/lib/cli/configure/processing/package.js +8 -2
  29. package/lib/cli/configure/processing/package.js.map +2 -2
  30. package/lib/cli/init/getConfig.js +1 -1
  31. package/lib/cli/init/getConfig.js.map +2 -2
  32. package/lib/cli/init/git.js +1 -1
  33. package/lib/cli/init/git.js.map +2 -2
  34. package/lib/cli/init/index.js +4 -4
  35. package/lib/cli/init/index.js.map +3 -3
  36. package/lib/cli/lint/annotate/buildkite/eslint.js +1 -1
  37. package/lib/cli/lint/annotate/buildkite/eslint.js.map +2 -2
  38. package/lib/cli/lint/annotate/buildkite/index.js +1 -1
  39. package/lib/cli/lint/annotate/buildkite/index.js.map +2 -2
  40. package/lib/cli/lint/annotate/buildkite/internal.js +1 -1
  41. package/lib/cli/lint/annotate/buildkite/internal.js.map +2 -2
  42. package/lib/cli/lint/annotate/buildkite/prettier.js +1 -1
  43. package/lib/cli/lint/annotate/buildkite/prettier.js.map +2 -2
  44. package/lib/cli/lint/annotate/buildkite/tsc.js +1 -1
  45. package/lib/cli/lint/annotate/buildkite/tsc.js.map +2 -2
  46. package/lib/cli/lint/annotate/github/eslint.d.ts +1 -1
  47. package/lib/cli/lint/annotate/github/eslint.js.map +2 -2
  48. package/lib/cli/lint/annotate/github/index.js +3 -4
  49. package/lib/cli/lint/annotate/github/index.js.map +2 -2
  50. package/lib/cli/lint/annotate/github/internal.d.ts +1 -1
  51. package/lib/cli/lint/annotate/github/internal.js.map +2 -2
  52. package/lib/cli/lint/annotate/github/prettier.d.ts +1 -1
  53. package/lib/cli/lint/annotate/github/prettier.js.map +2 -2
  54. package/lib/cli/lint/annotate/github/tsc.d.ts +1 -1
  55. package/lib/cli/lint/annotate/github/tsc.js.map +2 -2
  56. package/lib/cli/lint/autofix.d.ts +1 -1
  57. package/lib/cli/lint/autofix.js +3 -3
  58. package/lib/cli/lint/autofix.js.map +2 -2
  59. package/lib/cli/lint/internal.js +1 -1
  60. package/lib/cli/lint/internal.js.map +2 -2
  61. package/lib/cli/lint/internalLints/patchRenovateConfig.js +3 -3
  62. package/lib/cli/lint/internalLints/patchRenovateConfig.js.map +2 -2
  63. package/lib/cli/lint/internalLints/refreshConfigFiles.js +5 -3
  64. package/lib/cli/lint/internalLints/refreshConfigFiles.js.map +2 -2
  65. package/lib/cli/lint/internalLints/upgrade/index.d.ts +2 -2
  66. package/lib/cli/lint/internalLints/upgrade/index.js.map +1 -1
  67. package/lib/{api/buildkite/md.js → cli/lint/internalLints/upgrade/patches/12.0.2/index.js} +13 -11
  68. package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/index.js.map +7 -0
  69. package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/unhandledRejections.d.ts +4 -0
  70. package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/unhandledRejections.js +162 -0
  71. package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/unhandledRejections.js.map +7 -0
  72. package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/index.d.ts +2 -0
  73. package/lib/{api/net → cli/lint/internalLints/upgrade/patches/12.1.1}/index.js +12 -6
  74. package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/index.js.map +7 -0
  75. package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/patchJestSnapshots.d.ts +3 -0
  76. package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/patchJestSnapshots.js +105 -0
  77. package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/patchJestSnapshots.js.map +7 -0
  78. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/index.d.ts +2 -0
  79. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/index.js +40 -0
  80. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/index.js.map +7 -0
  81. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchApiTokenFromEnvironment.d.ts +3 -0
  82. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchApiTokenFromEnvironment.js +100 -0
  83. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchApiTokenFromEnvironment.js.map +7 -0
  84. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchDockerfileSyntaxDirective.d.ts +3 -0
  85. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchDockerfileSyntaxDirective.js +99 -0
  86. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchDockerfileSyntaxDirective.js.map +7 -0
  87. package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/index.d.ts +2 -0
  88. package/lib/{api/buildkite → cli/lint/internalLints/upgrade/patches/12.4.0}/index.js +12 -9
  89. package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/index.js.map +7 -0
  90. package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/patchDockerfileCIVariable.d.ts +3 -0
  91. package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/patchDockerfileCIVariable.js +101 -0
  92. package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/patchDockerfileCIVariable.js.map +7 -0
  93. package/lib/cli/lint/internalLints/upgrade/patches/13.0.0/index.d.ts +2 -0
  94. package/lib/cli/lint/internalLints/upgrade/patches/{12.2.0 → 13.0.0}/index.js.map +1 -1
  95. package/lib/cli/lint/internalLints/upgrade/patches/13.0.0/rewriteSrcImports.d.ts +13 -0
  96. package/lib/cli/lint/internalLints/upgrade/patches/13.0.0/rewriteSrcImports.js +221 -0
  97. package/lib/cli/lint/internalLints/upgrade/patches/13.0.0/rewriteSrcImports.js.map +7 -0
  98. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/upgradeESLint.js +1 -1
  99. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/upgradeESLint.js.map +2 -2
  100. package/lib/cli/node/index.js +8 -2
  101. package/lib/cli/node/index.js.map +2 -2
  102. package/lib/cli/start/index.js +8 -2
  103. package/lib/cli/start/index.js.map +2 -2
  104. package/lib/cli/test/index.d.ts +1 -1
  105. package/lib/cli/test/index.js +18 -4
  106. package/lib/cli/test/index.js.map +2 -2
  107. package/lib/cli/test/reporters/github/annotations.d.ts +1 -1
  108. package/lib/cli/test/reporters/github/annotations.js.map +1 -1
  109. package/lib/cli/test/reporters/github/index.js +3 -4
  110. package/lib/cli/test/reporters/github/index.js.map +2 -2
  111. package/lib/index.d.ts +4 -4
  112. package/lib/index.js +4 -4
  113. package/lib/index.js.map +2 -2
  114. package/lib/utils/args.d.ts +2 -0
  115. package/lib/utils/args.js +5 -0
  116. package/lib/utils/args.js.map +2 -2
  117. package/lib/utils/dir.js +2 -2
  118. package/lib/utils/dir.js.map +3 -3
  119. package/lib/utils/manifest.d.ts +6 -2
  120. package/lib/utils/manifest.js +17 -8
  121. package/lib/utils/manifest.js.map +2 -2
  122. package/lib/utils/template.d.ts +1 -1
  123. package/package.json +21 -24
  124. package/template/base/_.prettierrc.js +1 -1
  125. package/template/base/_eslint.config.js +1 -1
  126. package/template/base/_pnpm-workspace.yaml +14 -3
  127. package/template/base/jest.config.ts +7 -12
  128. package/template/base/jest.setup.ts +1 -1
  129. package/template/express-rest-api/.buildkite/pipeline.yml +6 -0
  130. package/template/express-rest-api/.env +1 -1
  131. package/template/express-rest-api/.gantry/dev.yml +5 -1
  132. package/template/express-rest-api/.gantry/prod.yml +5 -1
  133. package/template/express-rest-api/Dockerfile +2 -2
  134. package/template/express-rest-api/Dockerfile.dev-deps +0 -2
  135. package/template/express-rest-api/README.md +5 -5
  136. package/template/express-rest-api/gantry.apply.yml +17 -1
  137. package/template/express-rest-api/package.json +11 -5
  138. package/template/express-rest-api/src/api/healthCheck.ts +2 -2
  139. package/template/express-rest-api/src/config.ts +7 -7
  140. package/template/express-rest-api/src/framework/logging.ts +11 -7
  141. package/template/express-rest-api/src/framework/metrics.ts +1 -1
  142. package/template/express-rest-api/src/listen.ts +6 -0
  143. package/template/express-rest-api/src/tracing.ts +56 -0
  144. package/template/greeter/Dockerfile +0 -2
  145. package/template/greeter/README.md +2 -2
  146. package/template/greeter/package.json +2 -2
  147. package/template/koa-rest-api/.buildkite/pipeline.yml +6 -0
  148. package/template/koa-rest-api/.env +1 -1
  149. package/template/koa-rest-api/.gantry/dev.yml +3 -3
  150. package/template/koa-rest-api/.gantry/prod.yml +3 -3
  151. package/template/koa-rest-api/Dockerfile +1 -1
  152. package/template/koa-rest-api/Dockerfile.dev-deps +0 -2
  153. package/template/koa-rest-api/README.md +6 -6
  154. package/template/koa-rest-api/gantry.apply.yml +15 -3
  155. package/template/koa-rest-api/package.json +13 -14
  156. package/template/koa-rest-api/src/api/healthCheck.ts +2 -2
  157. package/template/koa-rest-api/src/config.ts +7 -7
  158. package/template/koa-rest-api/src/framework/logging.ts +12 -8
  159. package/template/koa-rest-api/src/framework/metrics.ts +1 -1
  160. package/template/koa-rest-api/src/framework/server.test.ts +7 -8
  161. package/template/koa-rest-api/src/framework/server.ts +1 -4
  162. package/template/koa-rest-api/src/listen.ts +6 -0
  163. package/template/lambda-sqs-worker-cdk/.buildkite/pipeline.yml +6 -2
  164. package/template/lambda-sqs-worker-cdk/.env +1 -1
  165. package/template/lambda-sqs-worker-cdk/Dockerfile +0 -2
  166. package/template/lambda-sqs-worker-cdk/README.md +8 -8
  167. package/template/lambda-sqs-worker-cdk/infra/__snapshots__/appStack.test.ts.snap +54 -26
  168. package/template/lambda-sqs-worker-cdk/infra/appStack.test.ts +5 -22
  169. package/template/lambda-sqs-worker-cdk/infra/appStack.ts +16 -9
  170. package/template/lambda-sqs-worker-cdk/infra/config.ts +34 -20
  171. package/template/lambda-sqs-worker-cdk/infra/index.ts +1 -1
  172. package/template/lambda-sqs-worker-cdk/package.json +7 -9
  173. package/template/lambda-sqs-worker-cdk/src/app.test.ts +91 -51
  174. package/template/lambda-sqs-worker-cdk/src/app.ts +10 -9
  175. package/template/lambda-sqs-worker-cdk/src/config.ts +11 -16
  176. package/template/lambda-sqs-worker-cdk/src/framework/handler.test.ts +10 -5
  177. package/template/lambda-sqs-worker-cdk/src/framework/handler.ts +48 -24
  178. package/template/lambda-sqs-worker-cdk/src/framework/logging.ts +23 -11
  179. package/template/lambda-sqs-worker-cdk/src/framework/metrics.ts +1 -4
  180. package/template/lambda-sqs-worker-cdk/src/testing/handler.ts +4 -1
  181. package/template/oss-npm-package/.github/workflows/release.yml +7 -8
  182. package/template/oss-npm-package/.github/workflows/validate.yml +6 -6
  183. package/template/oss-npm-package/README.md +1 -1
  184. package/template/oss-npm-package/_package.json +0 -3
  185. package/template/oss-npm-package/skuba.template.js +1 -1
  186. package/lib/api/buildkite/annotate.d.ts +0 -28
  187. package/lib/api/buildkite/annotate.js +0 -62
  188. package/lib/api/buildkite/annotate.js.map +0 -7
  189. package/lib/api/buildkite/index.d.ts +0 -3
  190. package/lib/api/buildkite/index.js.map +0 -7
  191. package/lib/api/buildkite/md.d.ts +0 -6
  192. package/lib/api/buildkite/md.js.map +0 -7
  193. package/lib/api/git/commit.d.ts +0 -15
  194. package/lib/api/git/commit.js +0 -52
  195. package/lib/api/git/commit.js.map +0 -7
  196. package/lib/api/git/commitAllChanges.d.ts +0 -19
  197. package/lib/api/git/commitAllChanges.js +0 -83
  198. package/lib/api/git/commitAllChanges.js.map +0 -7
  199. package/lib/api/git/currentBranch.d.ts +0 -10
  200. package/lib/api/git/currentBranch.js +0 -59
  201. package/lib/api/git/currentBranch.js.map +0 -7
  202. package/lib/api/git/findRoot.d.ts +0 -9
  203. package/lib/api/git/findRoot.js +0 -52
  204. package/lib/api/git/findRoot.js.map +0 -7
  205. package/lib/api/git/getChangedFiles.d.ts +0 -20
  206. package/lib/api/git/getChangedFiles.js +0 -81
  207. package/lib/api/git/getChangedFiles.js.map +0 -7
  208. package/lib/api/git/index.d.ts +0 -12
  209. package/lib/api/git/index.js +0 -61
  210. package/lib/api/git/index.js.map +0 -7
  211. package/lib/api/git/isFileGitIgnored.d.ts +0 -4
  212. package/lib/api/git/isFileGitIgnored.js +0 -49
  213. package/lib/api/git/isFileGitIgnored.js.map +0 -7
  214. package/lib/api/git/log.d.ts +0 -19
  215. package/lib/api/git/log.js +0 -71
  216. package/lib/api/git/log.js.map +0 -7
  217. package/lib/api/git/pull.d.ts +0 -35
  218. package/lib/api/git/pull.js +0 -69
  219. package/lib/api/git/pull.js.map +0 -7
  220. package/lib/api/git/push.d.ts +0 -52
  221. package/lib/api/git/push.js +0 -70
  222. package/lib/api/git/push.js.map +0 -7
  223. package/lib/api/git/remote.d.ts +0 -20
  224. package/lib/api/git/remote.js +0 -73
  225. package/lib/api/git/remote.js.map +0 -7
  226. package/lib/api/git/reset.d.ts +0 -12
  227. package/lib/api/git/reset.js +0 -62
  228. package/lib/api/git/reset.js.map +0 -7
  229. package/lib/api/git/statusMatrix.d.ts +0 -7
  230. package/lib/api/git/statusMatrix.js +0 -47
  231. package/lib/api/git/statusMatrix.js.map +0 -7
  232. package/lib/api/github/checkRun.d.ts +0 -44
  233. package/lib/api/github/checkRun.js +0 -81
  234. package/lib/api/github/checkRun.js.map +0 -7
  235. package/lib/api/github/environment.d.ts +0 -17
  236. package/lib/api/github/environment.js +0 -48
  237. package/lib/api/github/environment.js.map +0 -7
  238. package/lib/api/github/index.d.ts +0 -7
  239. package/lib/api/github/index.js +0 -48
  240. package/lib/api/github/index.js.map +0 -7
  241. package/lib/api/github/issueComment.d.ts +0 -61
  242. package/lib/api/github/issueComment.js +0 -99
  243. package/lib/api/github/issueComment.js.map +0 -7
  244. package/lib/api/github/octokit.d.ts +0 -6
  245. package/lib/api/github/octokit.js +0 -42
  246. package/lib/api/github/octokit.js.map +0 -7
  247. package/lib/api/github/pullRequest.d.ts +0 -21
  248. package/lib/api/github/pullRequest.js +0 -69
  249. package/lib/api/github/pullRequest.js.map +0 -7
  250. package/lib/api/github/push.d.ts +0 -85
  251. package/lib/api/github/push.js +0 -166
  252. package/lib/api/github/push.js.map +0 -7
  253. package/lib/api/net/compose.d.ts +0 -4
  254. package/lib/api/net/compose.js +0 -51
  255. package/lib/api/net/compose.js.map +0 -7
  256. package/lib/api/net/index.d.ts +0 -1
  257. package/lib/api/net/index.js.map +0 -7
  258. package/lib/api/net/socket.d.ts +0 -5
  259. package/lib/api/net/socket.js +0 -68
  260. package/lib/api/net/socket.js.map +0 -7
  261. package/lib/api/net/waitFor.d.ts +0 -22
  262. package/lib/api/net/waitFor.js +0 -40
  263. package/lib/api/net/waitFor.js.map +0 -7
  264. package/lib/cli/lint/internalLints/upgrade/patches/12.2.0/rewriteSrcImports.d.ts +0 -6
  265. package/lib/cli/lint/internalLints/upgrade/patches/12.2.0/rewriteSrcImports.js +0 -104
  266. package/lib/cli/lint/internalLints/upgrade/patches/12.2.0/rewriteSrcImports.js.map +0 -7
  267. /package/lib/cli/lint/internalLints/upgrade/patches/{12.2.0 → 12.0.2}/index.d.ts +0 -0
  268. /package/lib/cli/lint/internalLints/upgrade/patches/{12.2.0 → 13.0.0}/index.js +0 -0
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/cli/test/index.ts"],
4
- "sourcesContent": ["import { run } from 'jest';\n\nexport const test = async () => {\n // This is usually set in `jest-cli`'s binary wrapper\n process.env.NODE_ENV ??= 'test';\n\n // ts-jest is logging a warning about `isolatedModules`.\n // This is a workaround until we can remove the `isolatedModules` option.\n // https://github.com/seek-oss/skuba/issues/1841\n process.env.TS_JEST_LOG ??= 'stdout:error';\n\n const argv = process.argv.slice(2);\n\n return run(argv);\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAoB;AAEb,MAAM,OAAO,YAAY;AAE9B,UAAQ,IAAI,aAAa;AAKzB,UAAQ,IAAI,gBAAgB;AAE5B,QAAM,OAAO,QAAQ,KAAK,MAAM,CAAC;AAEjC,aAAO,iBAAI,IAAI;AACjB;",
4
+ "sourcesContent": ["import { createExec } from '../../utils/exec.js';\n\nexport const test = async () => {\n const argv = process.argv.slice(2);\n\n const nodeOptions = process.env.NODE_OPTIONS ?? '';\n\n const execWithEnv = createExec({\n env: {\n NODE_OPTIONS: !nodeOptions.includes('--experimental-vm-modules')\n ? `${nodeOptions} --experimental-vm-modules --no-warnings=ExperimentalWarning`\n : nodeOptions,\n },\n });\n\n // Run Jest in a child process with proper environment\n return execWithEnv(require.resolve('jest/bin/jest'), ...argv);\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA2B;AAEpB,MAAM,OAAO,YAAY;AAC9B,QAAM,OAAO,QAAQ,KAAK,MAAM,CAAC;AAEjC,QAAM,cAAc,QAAQ,IAAI,gBAAgB;AAEhD,QAAM,kBAAc,wBAAW;AAAA,IAC7B,KAAK;AAAA,MACH,cAAc,CAAC,YAAY,SAAS,2BAA2B,IAC3D,GAAG,WAAW,iEACd;AAAA,IACN;AAAA,EACF,CAAC;AAGD,SAAO,YAAY,gBAAgB,eAAe,GAAG,GAAG,IAAI;AAC9D;",
6
6
  "names": []
7
7
  }
@@ -1,5 +1,5 @@
1
1
  import type { TestResult } from '@jest/test-result';
2
- import type * as GitHub from '../../../../api/github/index.js';
2
+ import type * as GitHub from '@skuba-lib/api/github';
3
3
  export declare const createAnnotations: (testResults: TestResult[]) => GitHub.Annotation[];
4
4
  interface AnnotationEntry {
5
5
  annotations: GitHub.Annotation[];
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/cli/test/reporters/github/annotations.ts"],
4
- "sourcesContent": ["import path from 'path';\nimport { stripVTControlCharacters as stripAnsi } from 'util';\n\nimport type { TestResult } from '@jest/test-result';\nimport dedent from 'ts-dedent';\n\nimport type * as GitHub from '../../../../api/github/index.js';\n\n/**\n * Matches the first stack trace location in a Jest failure message.\n *\n * For example, given the following input message:\n *\n * ```console\n * Error: expect(received).toBe(expected) // Object.is equality\n *\n * Expected: \"a\"\n * Received: \"b\"\n * at Object.<anonymous> (/workdir/skuba/src/test.test.ts:2:15)\n * at Promise.then.completed (/workdir/skuba/node_modules/jest-circus/build/utils.js:390:28)\n * ...\n * ```\n *\n * or:\n *\n * ```console\n * Error: expect(received).toBe(expected) // Object.is equality\n *\n * Expected: \"a\"\n * Received: \"b\"\n * at /workdir/skuba/src/test.test.ts:2:15\n * at Promise.then.completed (/workdir/skuba/node_modules/jest-circus/build/utils.js:390:28)\n * ...\n * ```\n *\n * This pattern will produce the following matches:\n *\n * 1. /workdir/skuba/src/test.test.ts\n * 2. 2\n * 2. 15\n */\nconst JEST_LOCATION_REGEX = /\\n +at (.+\\()?(.+?):(\\d+):(\\d+)/;\n\nexport const createAnnotations = (\n testResults: TestResult[],\n): GitHub.Annotation[] => {\n const cwd = process.cwd();\n\n return testResults.flatMap((testResult) => {\n if (testResult.testExecError) {\n return {\n annotation_level: 'failure',\n path: path.relative(cwd, testResult.testFilePath),\n start_line: 1,\n end_line: 1,\n message: stripAnsi(\n testResult.failureMessage\n ? dedent(testResult.failureMessage)\n : testResult.testExecError.message,\n ),\n title: 'Jest',\n };\n }\n\n if (testResult.numFailingTests > 0) {\n return testResult.testResults.flatMap((assertionResult) =>\n assertionResult.failureMessages.flatMap((failureMessage) => {\n const match = JEST_LOCATION_REGEX.exec(failureMessage);\n if (match?.length === 5 && match[2]) {\n return {\n annotation_level: 'failure',\n path: path.relative(cwd, match[2]),\n start_line: Number(match[3]),\n end_line: Number(match[3]),\n start_column: Number(match[4]),\n end_column: Number(match[4]),\n message: stripAnsi(failureMessage),\n title: 'Jest',\n };\n }\n\n return [];\n }),\n );\n }\n\n return [];\n });\n};\n\nconst DEFAULT_DISPLAY_NAME = Symbol('DEFAULT_DISPLAY_NAME');\n\ninterface AnnotationEntry {\n annotations: GitHub.Annotation[];\n displayName: string | undefined;\n}\n\nexport const generateAnnotationEntries = (\n testResults: TestResult[],\n): AnnotationEntry[] => {\n type ResultsByDisplayName = Record<string | symbol, TestResult[]>;\n\n // Group test results by display name.\n const resultsByDisplayName = testResults.reduce<ResultsByDisplayName>(\n (acc, result) => {\n const displayName = result.displayName?.name ?? DEFAULT_DISPLAY_NAME;\n\n (acc[displayName] ??= []).push(result);\n\n return acc;\n },\n {},\n );\n\n const defaultResults = resultsByDisplayName[DEFAULT_DISPLAY_NAME];\n\n const entries = [\n ...(defaultResults?.length ? ([[undefined, defaultResults]] as const) : []),\n ...Object.entries(resultsByDisplayName),\n ];\n\n // Create annotations for each display name.\n return entries.map<AnnotationEntry>(([displayName, results]) => ({\n annotations: createAnnotations(results),\n displayName,\n }));\n};\n"],
4
+ "sourcesContent": ["import path from 'path';\nimport { stripVTControlCharacters as stripAnsi } from 'util';\n\nimport type { TestResult } from '@jest/test-result';\nimport dedent from 'ts-dedent';\n\nimport type * as GitHub from '@skuba-lib/api/github';\n\n/**\n * Matches the first stack trace location in a Jest failure message.\n *\n * For example, given the following input message:\n *\n * ```console\n * Error: expect(received).toBe(expected) // Object.is equality\n *\n * Expected: \"a\"\n * Received: \"b\"\n * at Object.<anonymous> (/workdir/skuba/src/test.test.ts:2:15)\n * at Promise.then.completed (/workdir/skuba/node_modules/jest-circus/build/utils.js:390:28)\n * ...\n * ```\n *\n * or:\n *\n * ```console\n * Error: expect(received).toBe(expected) // Object.is equality\n *\n * Expected: \"a\"\n * Received: \"b\"\n * at /workdir/skuba/src/test.test.ts:2:15\n * at Promise.then.completed (/workdir/skuba/node_modules/jest-circus/build/utils.js:390:28)\n * ...\n * ```\n *\n * This pattern will produce the following matches:\n *\n * 1. /workdir/skuba/src/test.test.ts\n * 2. 2\n * 2. 15\n */\nconst JEST_LOCATION_REGEX = /\\n +at (.+\\()?(.+?):(\\d+):(\\d+)/;\n\nexport const createAnnotations = (\n testResults: TestResult[],\n): GitHub.Annotation[] => {\n const cwd = process.cwd();\n\n return testResults.flatMap((testResult) => {\n if (testResult.testExecError) {\n return {\n annotation_level: 'failure',\n path: path.relative(cwd, testResult.testFilePath),\n start_line: 1,\n end_line: 1,\n message: stripAnsi(\n testResult.failureMessage\n ? dedent(testResult.failureMessage)\n : testResult.testExecError.message,\n ),\n title: 'Jest',\n };\n }\n\n if (testResult.numFailingTests > 0) {\n return testResult.testResults.flatMap((assertionResult) =>\n assertionResult.failureMessages.flatMap((failureMessage) => {\n const match = JEST_LOCATION_REGEX.exec(failureMessage);\n if (match?.length === 5 && match[2]) {\n return {\n annotation_level: 'failure',\n path: path.relative(cwd, match[2]),\n start_line: Number(match[3]),\n end_line: Number(match[3]),\n start_column: Number(match[4]),\n end_column: Number(match[4]),\n message: stripAnsi(failureMessage),\n title: 'Jest',\n };\n }\n\n return [];\n }),\n );\n }\n\n return [];\n });\n};\n\nconst DEFAULT_DISPLAY_NAME = Symbol('DEFAULT_DISPLAY_NAME');\n\ninterface AnnotationEntry {\n annotations: GitHub.Annotation[];\n displayName: string | undefined;\n}\n\nexport const generateAnnotationEntries = (\n testResults: TestResult[],\n): AnnotationEntry[] => {\n type ResultsByDisplayName = Record<string | symbol, TestResult[]>;\n\n // Group test results by display name.\n const resultsByDisplayName = testResults.reduce<ResultsByDisplayName>(\n (acc, result) => {\n const displayName = result.displayName?.name ?? DEFAULT_DISPLAY_NAME;\n\n (acc[displayName] ??= []).push(result);\n\n return acc;\n },\n {},\n );\n\n const defaultResults = resultsByDisplayName[DEFAULT_DISPLAY_NAME];\n\n const entries = [\n ...(defaultResults?.length ? ([[undefined, defaultResults]] as const) : []),\n ...Object.entries(resultsByDisplayName),\n ];\n\n // Create annotations for each display name.\n return entries.map<AnnotationEntry>(([displayName, results]) => ({\n annotations: createAnnotations(results),\n displayName,\n }));\n};\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,kBAAsD;AAGtD,uBAAmB;AAqCnB,MAAM,sBAAsB;AAErB,MAAM,oBAAoB,CAC/B,gBACwB;AACxB,QAAM,MAAM,QAAQ,IAAI;AAExB,SAAO,YAAY,QAAQ,CAAC,eAAe;AACzC,QAAI,WAAW,eAAe;AAC5B,aAAO;AAAA,QACL,kBAAkB;AAAA,QAClB,MAAM,YAAAA,QAAK,SAAS,KAAK,WAAW,YAAY;AAAA,QAChD,YAAY;AAAA,QACZ,UAAU;AAAA,QACV,aAAS,YAAAC;AAAA,UACP,WAAW,qBACP,iBAAAC,SAAO,WAAW,cAAc,IAChC,WAAW,cAAc;AAAA,QAC/B;AAAA,QACA,OAAO;AAAA,MACT;AAAA,IACF;AAEA,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names": ["path", "stripAnsi", "dedent"]
7
7
  }
@@ -32,20 +32,19 @@ __export(github_exports, {
32
32
  });
33
33
  module.exports = __toCommonJS(github_exports);
34
34
  var import_util = require("util");
35
- var import_environment = require("../../../../api/github/environment.js");
36
- var GitHub = __toESM(require("../../../../api/github/index.js"));
37
35
  var import_logging = require("../../../../utils/logging.js");
38
36
  var import_wait = require("../../../../utils/wait.js");
39
37
  var import_annotations = require("./annotations.js");
38
+ var GitHub = __toESM(require("@skuba-lib/api/github"));
40
39
  class GitHubReporter {
41
40
  async onRunComplete(_contexts, { testResults }) {
42
- if (!(0, import_environment.enabledFromEnvironment)()) {
41
+ if (!GitHub.enabledFromEnvironment()) {
43
42
  return;
44
43
  }
45
44
  let lastCheckRun;
46
45
  try {
47
46
  const entries = (0, import_annotations.generateAnnotationEntries)(testResults);
48
- const build = (0, import_environment.buildNameFromEnvironment)();
47
+ const build = GitHub.buildNameFromEnvironment();
49
48
  for (const { displayName, annotations } of entries) {
50
49
  const name = `skuba/test${displayName ? ` (${displayName})` : ""}`;
51
50
  const isOk = !annotations.length;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/cli/test/reporters/github/index.ts"],
4
- "sourcesContent": ["import { inspect } from 'util';\n\nimport type { Reporter, TestContext } from '@jest/reporters';\nimport type { AggregatedResult } from '@jest/test-result';\n\nimport {\n buildNameFromEnvironment,\n enabledFromEnvironment,\n} from '../../../../api/github/environment.js';\nimport * as GitHub from '../../../../api/github/index.js';\nimport { log } from '../../../../utils/logging.js';\nimport { throwOnTimeout } from '../../../../utils/wait.js';\n\nimport { generateAnnotationEntries } from './annotations.js';\n\nexport default class GitHubReporter implements Pick<Reporter, 'onRunComplete'> {\n async onRunComplete(\n _contexts: Set<TestContext>,\n { testResults }: AggregatedResult,\n ): Promise<void> {\n if (!enabledFromEnvironment()) {\n return;\n }\n\n type CheckRun = Parameters<typeof GitHub.createCheckRun>[0];\n\n let lastCheckRun: CheckRun | undefined;\n\n try {\n const entries = generateAnnotationEntries(testResults);\n\n const build = buildNameFromEnvironment();\n\n // Create a check run per display name.\n // Run in series to reduce the likelihood of exceeding GitHub rate limits.\n for (const { displayName, annotations } of entries) {\n const name = `skuba/test${displayName ? ` (${displayName})` : ''}`;\n\n const isOk = !annotations.length;\n\n const summary = isOk\n ? '`skuba test` passed.'\n : '`skuba test` found issues that require triage.';\n\n const checkRun: CheckRun = {\n name,\n annotations,\n conclusion: isOk ? 'success' : 'failure',\n summary,\n title: `${build} ${isOk ? 'passed' : 'failed'}`,\n };\n\n lastCheckRun = checkRun;\n\n await throwOnTimeout(GitHub.createCheckRun(checkRun), {\n s: 30,\n });\n }\n } catch (err) {\n log.warn('Failed to report test results to GitHub.');\n log.subtle(inspect(err));\n\n if (lastCheckRun) {\n log.subtle('Last request:');\n log.subtle(JSON.stringify(lastCheckRun));\n }\n }\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAwB;AAKxB,yBAGO;AACP,aAAwB;AACxB,qBAAoB;AACpB,kBAA+B;AAE/B,yBAA0C;AAE1C,MAAO,eAAwE;AAAA,EAC7E,MAAM,cACJ,WACA,EAAE,YAAY,GACC;AACf,QAAI,KAAC,2CAAuB,GAAG;AAC7B;AAAA,IACF;AAIA,QAAI;AAEJ,QAAI;AACF,YAAM,cAAU,8CAA0B,WAAW;AAErD,YAAM,YAAQ,6CAAyB;AAIvC,iBAAW,EAAE,aAAa,YAAY,KAAK,SAAS;AAClD,cAAM,OAAO,aAAa,cAAc,KAAK,WAAW,MAAM,EAAE;AAEhE,cAAM,OAAO,CAAC,YAAY;AAE1B,cAAM,UAAU,OACZ,yBACA;AAEJ,cAAM,WAAqB;AAAA,UACzB;AAAA,UACA;AAAA,UACA,YAAY,OAAO,YAAY;AAAA,UAC/B;AAAA,UACA,OAAO,GAAG,KAAK,IAAI,OAAO,WAAW,QAAQ;AAAA,QAC/C;AAEA,uBAAe;AAEf,kBAAM,4BAAe,OAAO,eAAe,QAAQ,GAAG;AAAA,UACpD,GAAG;AAAA,QACL,CAAC;AAAA,MACH;AAAA,IACF,SAAS,KAAK;AACZ,yBAAI,KAAK,0CAA0C;AACnD,yBAAI,WAAO,qBAAQ,GAAG,CAAC;AAEvB,UAAI,cAAc;AAChB,2BAAI,OAAO,eAAe;AAC1B,2BAAI,OAAO,KAAK,UAAU,YAAY,CAAC;AAAA,MACzC;AAAA,IACF;AAAA,EACF;AACF;",
4
+ "sourcesContent": ["import { inspect } from 'util';\n\nimport type { Reporter, TestContext } from '@jest/reporters';\nimport type { AggregatedResult } from '@jest/test-result';\n\nimport { log } from '../../../../utils/logging.js';\nimport { throwOnTimeout } from '../../../../utils/wait.js';\n\nimport { generateAnnotationEntries } from './annotations.js';\n\nimport * as GitHub from '@skuba-lib/api/github';\n\nexport default class GitHubReporter implements Pick<Reporter, 'onRunComplete'> {\n async onRunComplete(\n _contexts: Set<TestContext>,\n { testResults }: AggregatedResult,\n ): Promise<void> {\n if (!GitHub.enabledFromEnvironment()) {\n return;\n }\n\n type CheckRun = Parameters<typeof GitHub.createCheckRun>[0];\n\n let lastCheckRun: CheckRun | undefined;\n\n try {\n const entries = generateAnnotationEntries(testResults);\n\n const build = GitHub.buildNameFromEnvironment();\n\n // Create a check run per display name.\n // Run in series to reduce the likelihood of exceeding GitHub rate limits.\n for (const { displayName, annotations } of entries) {\n const name = `skuba/test${displayName ? ` (${displayName})` : ''}`;\n\n const isOk = !annotations.length;\n\n const summary = isOk\n ? '`skuba test` passed.'\n : '`skuba test` found issues that require triage.';\n\n const checkRun: CheckRun = {\n name,\n annotations,\n conclusion: isOk ? 'success' : 'failure',\n summary,\n title: `${build} ${isOk ? 'passed' : 'failed'}`,\n };\n\n lastCheckRun = checkRun;\n\n await throwOnTimeout(GitHub.createCheckRun(checkRun), {\n s: 30,\n });\n }\n } catch (err) {\n log.warn('Failed to report test results to GitHub.');\n log.subtle(inspect(err));\n\n if (lastCheckRun) {\n log.subtle('Last request:');\n log.subtle(JSON.stringify(lastCheckRun));\n }\n }\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAwB;AAKxB,qBAAoB;AACpB,kBAA+B;AAE/B,yBAA0C;AAE1C,aAAwB;AAExB,MAAO,eAAwE;AAAA,EAC7E,MAAM,cACJ,WACA,EAAE,YAAY,GACC;AACf,QAAI,CAAC,OAAO,uBAAuB,GAAG;AACpC;AAAA,IACF;AAIA,QAAI;AAEJ,QAAI;AACF,YAAM,cAAU,8CAA0B,WAAW;AAErD,YAAM,QAAQ,OAAO,yBAAyB;AAI9C,iBAAW,EAAE,aAAa,YAAY,KAAK,SAAS;AAClD,cAAM,OAAO,aAAa,cAAc,KAAK,WAAW,MAAM,EAAE;AAEhE,cAAM,OAAO,CAAC,YAAY;AAE1B,cAAM,UAAU,OACZ,yBACA;AAEJ,cAAM,WAAqB;AAAA,UACzB;AAAA,UACA;AAAA,UACA,YAAY,OAAO,YAAY;AAAA,UAC/B;AAAA,UACA,OAAO,GAAG,KAAK,IAAI,OAAO,WAAW,QAAQ;AAAA,QAC/C;AAEA,uBAAe;AAEf,kBAAM,4BAAe,OAAO,eAAe,QAAQ,GAAG;AAAA,UACpD,GAAG;AAAA,QACL,CAAC;AAAA,MACH;AAAA,IACF,SAAS,KAAK;AACZ,yBAAI,KAAK,0CAA0C;AACnD,yBAAI,WAAO,qBAAQ,GAAG,CAAC;AAEvB,UAAI,cAAc;AAChB,2BAAI,OAAO,eAAe;AAC1B,2BAAI,OAAO,KAAK,UAAU,YAAY,CAAC;AAAA,MACzC;AAAA,IACF;AAAA,EACF;AACF;",
6
6
  "names": []
7
7
  }
package/lib/index.d.ts CHANGED
@@ -9,11 +9,11 @@
9
9
  * const { Net } = require('skuba');
10
10
  * ```
11
11
  */
12
- export * as Buildkite from './api/buildkite/index.js';
13
- export * as Git from './api/git/index.js';
14
- export * as GitHub from './api/github/index.js';
12
+ export * as Buildkite from '@skuba-lib/api/buildkite';
13
+ export * as Git from '@skuba-lib/api/git';
14
+ export * as GitHub from '@skuba-lib/api/github';
15
+ export * as Net from '@skuba-lib/api/net';
15
16
  export * as Jest from './api/jest/index.js';
16
- export * as Net from './api/net/index.js';
17
17
  declare global {
18
18
  namespace WebAssembly {
19
19
  interface Module {
package/lib/index.js CHANGED
@@ -35,11 +35,11 @@ __export(index_exports, {
35
35
  Net: () => Net
36
36
  });
37
37
  module.exports = __toCommonJS(index_exports);
38
- var Buildkite = __toESM(require("./api/buildkite/index.js"));
39
- var Git = __toESM(require("./api/git/index.js"));
40
- var GitHub = __toESM(require("./api/github/index.js"));
38
+ var Buildkite = __toESM(require("@skuba-lib/api/buildkite"));
39
+ var Git = __toESM(require("@skuba-lib/api/git"));
40
+ var GitHub = __toESM(require("@skuba-lib/api/github"));
41
+ var Net = __toESM(require("@skuba-lib/api/net"));
41
42
  var Jest = __toESM(require("./api/jest/index.js"));
42
- var Net = __toESM(require("./api/net/index.js"));
43
43
  // Annotate the CommonJS export names for ESM import in node:
44
44
  0 && (module.exports = {
45
45
  Buildkite,
package/lib/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
- "sourcesContent": ["/**\n * Entry point for the Node.js development API.\n *\n * This is where skuba imports point to:\n *\n * ```typescript\n * import { Net } from 'skuba';\n *\n * const { Net } = require('skuba');\n * ```\n */\n\nexport * as Buildkite from './api/buildkite/index.js';\nexport * as Git from './api/git/index.js';\nexport * as GitHub from './api/github/index.js';\nexport * as Jest from './api/jest/index.js';\nexport * as Net from './api/net/index.js';\n\n// evanw/esbuild#2388\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace WebAssembly {\n // eslint-disable-next-line @typescript-eslint/no-empty-object-type\n interface Module {}\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYA,gBAA2B;AAC3B,UAAqB;AACrB,aAAwB;AACxB,WAAsB;AACtB,UAAqB;",
4
+ "sourcesContent": ["/**\n * Entry point for the Node.js development API.\n *\n * This is where skuba imports point to:\n *\n * ```typescript\n * import { Net } from 'skuba';\n *\n * const { Net } = require('skuba');\n * ```\n */\n\nexport * as Buildkite from '@skuba-lib/api/buildkite';\nexport * as Git from '@skuba-lib/api/git';\nexport * as GitHub from '@skuba-lib/api/github';\nexport * as Net from '@skuba-lib/api/net';\nexport * as Jest from './api/jest/index.js';\n\n// evanw/esbuild#2388\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace WebAssembly {\n // eslint-disable-next-line @typescript-eslint/no-empty-object-type\n interface Module {}\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYA,gBAA2B;AAC3B,UAAqB;AACrB,aAAwB;AACxB,UAAqB;AACrB,WAAsB;",
6
6
  "names": []
7
7
  }
@@ -18,6 +18,8 @@ export declare const parseProcessArgs: (args?: string[]) => {
18
18
  args: string[];
19
19
  };
20
20
  interface RunArgs {
21
+ /** The conditions to pass to the entry point script. */
22
+ conditions?: string[];
21
23
  /** The path to the entry point script. */
22
24
  entryPoint?: string;
23
25
  /** The port to start an HTTP server on. */
package/lib/utils/args.js CHANGED
@@ -100,6 +100,11 @@ const parseRunArgsIteration = (state, args) => {
100
100
  }
101
101
  return args.slice(1);
102
102
  }
103
+ if (arg1.startsWith("--conditions=")) {
104
+ state.conditions ??= [];
105
+ state.conditions.push(arg1.slice(13));
106
+ return args.slice(1);
107
+ }
103
108
  state.entryPoint = arg1;
104
109
  state.script.push(...args.slice(1));
105
110
  return [];
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/utils/args.ts"],
4
- "sourcesContent": ["import assert from 'assert';\n\nimport { COMMAND_ALIASES } from './command.js';\n\nexport const hasDebugFlag = (args = process.argv) =>\n args.some((arg) => arg.toLocaleLowerCase() === '--debug');\n\nexport const hasSerialFlag = (args = process.argv, env = process.env) =>\n args.some((arg) => arg.toLocaleLowerCase() === '--serial') ||\n Boolean(\n // Run serially on SEEK's central npm publishing pipeline.\n // Exhausting agents here can cause grief.\n env.BUILDKITE_AGENT_META_DATA_QUEUE?.split(',').some((queueName) =>\n queueName.startsWith('artefacts:npm'),\n ),\n );\n\n/**\n * Parse process arguments.\n *\n * This function mutates the input list by removing the command name element.\n * Downstream commands can access their args with an ordinary\n * `process.argv.slice(2)`.\n *\n * Example input:\n *\n * ```typescript\n * ['/bin/node', 'node_modules/.bin/skuba', 'test', '--foo', '--bar']\n * ```\n */\nexport const parseProcessArgs = (args = process.argv) => {\n const skubaIdx = args.findIndex((chunk) => /skuba(\\.[jt]s)?$/.test(chunk));\n\n assert(skubaIdx >= 0, 'Cannot parse args for `skuba`');\n\n const rawCommand = (args[skubaIdx + 1] ?? 'help').toLocaleLowerCase();\n\n const commandName = COMMAND_ALIASES[rawCommand] ?? rawCommand;\n\n const payload = {\n commandName,\n args: args.slice(skubaIdx + 2),\n };\n\n args.splice(skubaIdx + 1, 1);\n\n return payload;\n};\n\ninterface RunArgs {\n /** The path to the entry point script. */\n entryPoint?: string;\n\n /** The port to start an HTTP server on. */\n port?: number;\n\n /** Arguments passed through to the Node.js executable. */\n node: string[];\n\n /** Arguments passed through to the entry point script. */\n script: string[];\n}\n\n/**\n * Make a best effort to parse \"run\" args.\n *\n * These are arguments that would be passed to `skuba node` or `skuba start`.\n * Parsing is handrolled because we support some weird and wonderful behaviour:\n *\n * - The `--port` option may be intended for skuba itself\n * - The `--inspect` options may be intended for the Node.js inspector\n * - The entry point may be omitted in favour of `package.json` inference\n * - Other args may be intended for propagation to the entry point\n */\nexport const parseRunArgs = (argv: string[]): RunArgs => {\n const state: RunArgs = {\n node: [],\n script: [],\n };\n\n let args = argv.filter((element) => element.length);\n\n while (args.length) {\n args = parseRunArgsIteration(state, args);\n }\n\n return state;\n};\n\nconst isDigits = (arg: unknown): arg is string =>\n typeof arg === 'string' && /^\\d+$/.test(arg);\n\nconst parseRunArgsIteration = (state: RunArgs, args: string[]): string[] => {\n const [arg1, arg2] = args;\n\n if (!arg1) {\n return [];\n }\n\n if (/^--inspect(-brk)?=\\d+$/.test(arg1)) {\n state.node.push(arg1);\n return args.slice(1);\n }\n\n // Node.js inspector options that are optionally followed by a numeric port.\n if (['--inspect', '--inspect-brk'].includes(arg1)) {\n if (isDigits(arg2)) {\n state.node.push(`${arg1}=${arg2}`);\n return args.slice(2);\n }\n\n state.node.push(arg1);\n\n if (arg2) {\n // Some other string that doesn't relate to the Node.js inspector option.\n // This is presumably the entry point script to run.\n state.entryPoint = arg2;\n state.script.push(...args.slice(2));\n }\n\n return [];\n }\n\n if (/^--port=\\d+$/.test(arg1)) {\n state.port = Number(arg1.slice(7));\n return args.slice(1);\n }\n\n if (arg1 === '--port') {\n if (isDigits(arg2)) {\n state.port = Number(arg2);\n return args.slice(2);\n }\n\n // Invalid port argument; eat it.\n return args.slice(1);\n }\n\n state.entryPoint = arg1;\n state.script.push(...args.slice(1));\n return [];\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAmB;AAEnB,qBAAgC;AAEzB,MAAM,eAAe,CAAC,OAAO,QAAQ,SAC1C,KAAK,KAAK,CAAC,QAAQ,IAAI,kBAAkB,MAAM,SAAS;AAEnD,MAAM,gBAAgB,CAAC,OAAO,QAAQ,MAAM,MAAM,QAAQ,QAC/D,KAAK,KAAK,CAAC,QAAQ,IAAI,kBAAkB,MAAM,UAAU,KACzD;AAAA;AAAA;AAAA,EAGE,IAAI,iCAAiC,MAAM,GAAG,EAAE;AAAA,IAAK,CA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AGR,YAAM,aAAa;AACnB,YAAM,OAAO,KAAK,GAAG,KAAK,MAAM,CAAC,CAAC;AAAA,IACpC;AAEA,WAAO,CAAC;AAAA,EACV;AAEA,MAAI,eAAe,KAAK,IAAI,GAAG;AAC7B,UAAM,OAAO,OAAO,KAAK,MAAM,CAAC,CAAC;AACjC,WAAO,KAAK,MAAM,CAAC;AAAA,EACrB;AAEA,MAAI,SAAS,UAAU;AACrB,QAAI,SAAS,IAAI,GAAG;AAClB,YAAM,OAAO,OAAO,IAAI;AACxB,aAAO,KAAK,MAAM,CAAC;AAAA,IACrB;AAGA,WAAO,KAAK,MAAM,CAAC;AAAA,EACrB;AAEA,QAAM,aAAa;AACnB,QAAM,OAAO,KAAK,GAAG,KAAK,MAAM,CAAC,CAAC;AAClC,SAAO,CAAC;AACV;",
4
+ "sourcesContent": ["import assert from 'assert';\n\nimport { COMMAND_ALIASES } from './command.js';\n\nexport const hasDebugFlag = (args = process.argv) =>\n args.some((arg) => arg.toLocaleLowerCase() === '--debug');\n\nexport const hasSerialFlag = (args = process.argv, env = process.env) =>\n args.some((arg) => arg.toLocaleLowerCase() === '--serial') ||\n Boolean(\n // Run serially on SEEK's central npm publishing pipeline.\n // Exhausting agents here can cause grief.\n env.BUILDKITE_AGENT_META_DATA_QUEUE?.split(',').some((queueName) =>\n queueName.startsWith('artefacts:npm'),\n ),\n );\n\n/**\n * Parse process arguments.\n *\n * This function mutates the input list by removing the command name element.\n * Downstream commands can access their args with an ordinary\n * `process.argv.slice(2)`.\n *\n * Example input:\n *\n * ```typescript\n * ['/bin/node', 'node_modules/.bin/skuba', 'test', '--foo', '--bar']\n * ```\n */\nexport const parseProcessArgs = (args = process.argv) => {\n const skubaIdx = args.findIndex((chunk) => /skuba(\\.[jt]s)?$/.test(chunk));\n\n assert(skubaIdx >= 0, 'Cannot parse args for `skuba`');\n\n const rawCommand = (args[skubaIdx + 1] ?? 'help').toLocaleLowerCase();\n\n const commandName = COMMAND_ALIASES[rawCommand] ?? rawCommand;\n\n const payload = {\n commandName,\n args: args.slice(skubaIdx + 2),\n };\n\n args.splice(skubaIdx + 1, 1);\n\n return payload;\n};\n\ninterface RunArgs {\n /** The conditions to pass to the entry point script. */\n conditions?: string[];\n\n /** The path to the entry point script. */\n entryPoint?: string;\n\n /** The port to start an HTTP server on. */\n port?: number;\n\n /** Arguments passed through to the Node.js executable. */\n node: string[];\n\n /** Arguments passed through to the entry point script. */\n script: string[];\n}\n\n/**\n * Make a best effort to parse \"run\" args.\n *\n * These are arguments that would be passed to `skuba node` or `skuba start`.\n * Parsing is handrolled because we support some weird and wonderful behaviour:\n *\n * - The `--port` option may be intended for skuba itself\n * - The `--inspect` options may be intended for the Node.js inspector\n * - The entry point may be omitted in favour of `package.json` inference\n * - Other args may be intended for propagation to the entry point\n */\nexport const parseRunArgs = (argv: string[]): RunArgs => {\n const state: RunArgs = {\n node: [],\n script: [],\n };\n\n let args = argv.filter((element) => element.length);\n\n while (args.length) {\n args = parseRunArgsIteration(state, args);\n }\n\n return state;\n};\n\nconst isDigits = (arg: unknown): arg is string =>\n typeof arg === 'string' && /^\\d+$/.test(arg);\n\nconst parseRunArgsIteration = (state: RunArgs, args: string[]): string[] => {\n const [arg1, arg2] = args;\n\n if (!arg1) {\n return [];\n }\n\n if (/^--inspect(-brk)?=\\d+$/.test(arg1)) {\n state.node.push(arg1);\n return args.slice(1);\n }\n\n // Node.js inspector options that are optionally followed by a numeric port.\n if (['--inspect', '--inspect-brk'].includes(arg1)) {\n if (isDigits(arg2)) {\n state.node.push(`${arg1}=${arg2}`);\n return args.slice(2);\n }\n\n state.node.push(arg1);\n\n if (arg2) {\n // Some other string that doesn't relate to the Node.js inspector option.\n // This is presumably the entry point script to run.\n state.entryPoint = arg2;\n state.script.push(...args.slice(2));\n }\n\n return [];\n }\n\n if (/^--port=\\d+$/.test(arg1)) {\n state.port = Number(arg1.slice(7));\n return args.slice(1);\n }\n\n if (arg1 === '--port') {\n if (isDigits(arg2)) {\n state.port = Number(arg2);\n return args.slice(2);\n }\n\n // Invalid port argument; eat it.\n return args.slice(1);\n }\n\n if (arg1.startsWith('--conditions=')) {\n state.conditions ??= [];\n state.conditions.push(arg1.slice(13));\n return args.slice(1);\n }\n\n state.entryPoint = arg1;\n state.script.push(...args.slice(1));\n return [];\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAmB;AAEnB,qBAAgC;AAEzB,MAAM,eAAe,CAAC,OAAO,QAAQ,SAC1C,KAAK,KAAK,CAAC,QAAQ,IAAI,kBAAkB,MAAM,SAAS;AAEnD,MAAM,gBAAgB,CAAC,OAAO,QAAQ,MAAM,MAAM,QAAQ,QAC/D,KAAK,KAAK,CAAC,QAAQ,IAAI,kBAAkB,MAAM,UAAU,KACzD;AAAA;AAAA;AAAA,EAGE,IAAI,iCAAiC,MAAM,GAAG,EAAE;AAAA,IAAK,CAAC,cACpD,UAAU,WAAW,eAAe;AAAA,EACtC;AACF;AAeK,MAAM,mBAAmB,CAAC,OAAO,QAAQ,SAAS;AACvD,QAAM,WAAW,KAAK,UAAU,CAAC,UAAU,mBAAmB,KAAK,KAAK,CAAC;AAEzE,oBAAAA,SAAO,YAAY,GAAG,+BAA+B;AAErD,QAAM,cAAc,KAAK,WAAW,CAAC,KAAK,QAAQ,kBAAkB;AAEpE,QAAM,cAAc,+BAAgB,UAAU,KAAK;AAEnD,QAAM,UAAU;AAAA,IACd;AAAA,IACA,MAAM,KAAK,MAAM,WAAW,CAAC;AAAA,EAC/B;AAEA,OAAK,OAAO,WAAW,GAAG,CAAC;AAE3B,SAAO;AACT;AA8BO,MAAM,eAAe,CAAC,SAA4B;AACvD,QAAM,QAAiB;AAAA,IACrB,MAAM,CAAC;AAAA,IACP,QAAQ,CAAC;AAAA,EACX;AAEA,MAAI,OAAO,KAAK,OAAO,CAAC,YAAY,QAAQ,MAAM;AAElD,SAAO,KAAK,QA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,CAAC;AAClC,SAAO,CAAC;AACV;",
6
6
  "names": ["assert"]
7
7
  }
package/lib/utils/dir.js CHANGED
@@ -41,8 +41,8 @@ var import_path = __toESM(require("path"));
41
41
  var import_fs_extra = __toESM(require("fs-extra"));
42
42
  var import_ignore = __toESM(require("ignore"));
43
43
  var import_picomatch = __toESM(require("picomatch"));
44
- var import_findRoot = require("../api/git/findRoot.js");
45
44
  var import_error = require("./error.js");
45
+ var Git = __toESM(require("@skuba-lib/api/git"));
46
46
  const buildPatternToFilepathMap = (patterns, allFilepaths, options) => Object.fromEntries(
47
47
  patterns.map((pattern) => {
48
48
  const isMatch = (0, import_picomatch.default)(pattern, options);
@@ -135,7 +135,7 @@ const findWorkspaceRoot = async (cwd = process.cwd()) => {
135
135
  locateNearestFile({ cwd, filename: "pnpm-lock.yaml" }),
136
136
  locateNearestFile({ cwd, filename: "yarn.lock" }),
137
137
  locateFurthestFile({ cwd, filename: "package.json" }),
138
- (0, import_findRoot.findRoot)({ dir: cwd })
138
+ Git.findRoot({ dir: cwd })
139
139
  ]);
140
140
  const candidates = [
141
141
  pnpmLock ? import_path.default.dirname(pnpmLock) : null,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/utils/dir.ts"],
4
- "sourcesContent": ["import path from 'path';\n\nimport fs from 'fs-extra';\nimport ignore from 'ignore';\nimport picomatch from 'picomatch';\n\nimport { findRoot as findGitRoot } from '../api/git/findRoot.js';\n\nimport { isErrorWithCode } from './error.js';\n\n/**\n * Build a map that associates each glob pattern with its matching filepaths.\n */\nexport const buildPatternToFilepathMap = (\n patterns: string[],\n allFilepaths: string[],\n options?: picomatch.PicomatchOptions,\n) =>\n Object.fromEntries(\n patterns.map((pattern) => {\n const isMatch = picomatch(pattern, options);\n\n const filepaths = allFilepaths.filter((filepath) => isMatch(filepath));\n\n return [pattern, filepaths] as const;\n }),\n );\n\n/**\n * List relative filepaths contained within a directory root.\n *\n * This excludes:\n *\n * - Patterns in the ignore files specified in `ignoreFilenames`\n * - `.git` subdirectories\n * - `node_modules` subdirectories\n */\nexport const crawlDirectory = async (\n root: string,\n ignoreFilenames = ['.gitignore'],\n) => {\n const ignoreFileFilter = await createInclusionFilter(\n ignoreFilenames.map((ignoreFilename) => path.join(root, ignoreFilename)),\n );\n\n const absoluteFilenames = await crawl(root, {\n includeDirName: (dirname) => !['.git', 'node_modules'].includes(dirname),\n includeFilePath: (pathname) =>\n ignoreFileFilter(path.relative(root, pathname)),\n });\n\n const relativeFilepaths = absoluteFilenames.map((filepath) =>\n path.relative(root, filepath),\n );\n\n return relativeFilepaths;\n};\n\n/**\n * Create a filter function that excludes filepaths based on ignore files like\n * `.gitignore` and `.prettierignore`.\n */\nexport const createInclusionFilter = async (ignoreFilepaths: string[]) => {\n const ignoreFiles = await Promise.all(\n ignoreFilepaths.map(async (ignoreFilepath) => {\n try {\n return await fs.promises.readFile(ignoreFilepath, 'utf8');\n } catch (err) {\n if (isErrorWithCode(err, 'ENOENT')) {\n return;\n }\n\n throw err;\n }\n }),\n );\n\n const managers = ignoreFiles\n .filter((value): value is string => typeof value === 'string')\n .map((value) => ignore().add(value));\n\n return ignore().add('.git').add(managers).createFilter();\n};\n\n/**\n * Recursively crawl a directory and return all file paths that match the\n * filters. `paths` is mutated and returned.\n */\nasync function crawl(\n directoryPath: string,\n filters: {\n includeDirName: (dirName: string) => boolean;\n includeFilePath: (path: string) => boolean;\n },\n paths: string[] = [],\n) {\n try {\n const entries = await fs.promises.readdir(directoryPath, {\n withFileTypes: true,\n });\n\n await Promise.all(\n entries.map(async (entry) => {\n const fullPath = path.join(directoryPath, entry.name);\n\n if (\n (entry.isFile() || entry.isSymbolicLink()) &&\n filters.includeFilePath(fullPath)\n ) {\n paths.push(fullPath);\n }\n\n if (entry.isDirectory() && filters.includeDirName(entry.name)) {\n await crawl(fullPath, filters, paths);\n }\n }),\n );\n } catch {\n // Ignore errors, because of e.g. permission issues reading directories\n }\n\n return paths;\n}\n\nexport const locateNearestFile = async ({\n cwd,\n filename,\n}: {\n cwd: string;\n filename: string;\n}) => {\n let currentDir = cwd;\n while (currentDir !== path.dirname(currentDir)) {\n const filePath = path.join(currentDir, filename);\n if (await fs.pathExists(filePath)) {\n return filePath;\n }\n currentDir = path.dirname(currentDir);\n }\n\n return null;\n};\n\nexport const locateFurthestFile = async ({\n cwd,\n filename,\n}: {\n cwd: string;\n filename: string;\n}) => {\n let currentDir = cwd;\n let furthestFilePath: string | null = null;\n\n while (currentDir !== path.dirname(currentDir)) {\n const filePath = path.join(currentDir, filename);\n if (await fs.pathExists(filePath)) {\n furthestFilePath = filePath;\n }\n currentDir = path.dirname(currentDir);\n }\n\n return furthestFilePath;\n};\n\nconst workspaceRootCache: Record<string, string | null> = {};\n\nexport const findWorkspaceRoot = async (\n cwd = process.cwd(),\n): Promise<string | null> => {\n const find = async (): Promise<string | null> => {\n const [pnpmLock, yarnLock, packageJson, gitRoot] = await Promise.all([\n locateNearestFile({ cwd, filename: 'pnpm-lock.yaml' }),\n locateNearestFile({ cwd, filename: 'yarn.lock' }),\n locateFurthestFile({ cwd, filename: 'package.json' }),\n findGitRoot({ dir: cwd }),\n ]);\n\n const candidates = [\n pnpmLock ? path.dirname(pnpmLock) : null,\n yarnLock ? path.dirname(yarnLock) : null,\n packageJson ? path.dirname(packageJson) : null,\n gitRoot,\n ].filter((dir): dir is string => dir !== null);\n\n if (candidates[0]) {\n // Pick the longest path. This will be the most specific, which helps guard against someone\n // having an accidental lockfile in a parent directory by mistake.\n\n return candidates.reduce((longest, current) => {\n if (current.split(path.sep).length > longest.split(path.sep).length) {\n return current;\n }\n return longest;\n }, candidates[0]);\n }\n\n return null;\n };\n\n return (workspaceRootCache[cwd] ??= await find());\n};\n\nexport const findCurrentWorkspaceProjectRoot = async (\n cwd = process.cwd(),\n): Promise<string | null> => {\n const packageJson = await locateNearestFile({\n cwd,\n filename: 'package.json',\n });\n return packageJson ? path.dirname(packageJson) : null;\n};\n"],
5
- "mappings": ";;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AI,MACS;AAC3B,QAAM,cAAc,MAAM,kBAAkB;AAAA,IAC1C;AAAA,IACA,UAAU;AAAA,EACZ,CAAC;AACD,SAAO,cAAc,YAAAA,QAAK,QAAQ,WAAW,IAAI;AACnD;",
6
- "names": ["picomatch", "path", "fs", "ignore", "findGitRoot"]
4
+ "sourcesContent": ["import path from 'path';\n\nimport fs from 'fs-extra';\nimport ignore from 'ignore';\nimport picomatch from 'picomatch';\n\nimport { isErrorWithCode } from './error.js';\n\nimport * as Git from '@skuba-lib/api/git';\n\n/**\n * Build a map that associates each glob pattern with its matching filepaths.\n */\nexport const buildPatternToFilepathMap = (\n patterns: string[],\n allFilepaths: string[],\n options?: picomatch.PicomatchOptions,\n) =>\n Object.fromEntries(\n patterns.map((pattern) => {\n const isMatch = picomatch(pattern, options);\n\n const filepaths = allFilepaths.filter((filepath) => isMatch(filepath));\n\n return [pattern, filepaths] as const;\n }),\n );\n\n/**\n * List relative filepaths contained within a directory root.\n *\n * This excludes:\n *\n * - Patterns in the ignore files specified in `ignoreFilenames`\n * - `.git` subdirectories\n * - `node_modules` subdirectories\n */\nexport const crawlDirectory = async (\n root: string,\n ignoreFilenames = ['.gitignore'],\n) => {\n const ignoreFileFilter = await createInclusionFilter(\n ignoreFilenames.map((ignoreFilename) => path.join(root, ignoreFilename)),\n );\n\n const absoluteFilenames = await crawl(root, {\n includeDirName: (dirname) => !['.git', 'node_modules'].includes(dirname),\n includeFilePath: (pathname) =>\n ignoreFileFilter(path.relative(root, pathname)),\n });\n\n const relativeFilepaths = absoluteFilenames.map((filepath) =>\n path.relative(root, filepath),\n );\n\n return relativeFilepaths;\n};\n\n/**\n * Create a filter function that excludes filepaths based on ignore files like\n * `.gitignore` and `.prettierignore`.\n */\nexport const createInclusionFilter = async (ignoreFilepaths: string[]) => {\n const ignoreFiles = await Promise.all(\n ignoreFilepaths.map(async (ignoreFilepath) => {\n try {\n return await fs.promises.readFile(ignoreFilepath, 'utf8');\n } catch (err) {\n if (isErrorWithCode(err, 'ENOENT')) {\n return;\n }\n\n throw err;\n }\n }),\n );\n\n const managers = ignoreFiles\n .filter((value): value is string => typeof value === 'string')\n .map((value) => ignore().add(value));\n\n return ignore().add('.git').add(managers).createFilter();\n};\n\n/**\n * Recursively crawl a directory and return all file paths that match the\n * filters. `paths` is mutated and returned.\n */\nasync function crawl(\n directoryPath: string,\n filters: {\n includeDirName: (dirName: string) => boolean;\n includeFilePath: (path: string) => boolean;\n },\n paths: string[] = [],\n) {\n try {\n const entries = await fs.promises.readdir(directoryPath, {\n withFileTypes: true,\n });\n\n await Promise.all(\n entries.map(async (entry) => {\n const fullPath = path.join(directoryPath, entry.name);\n\n if (\n (entry.isFile() || entry.isSymbolicLink()) &&\n filters.includeFilePath(fullPath)\n ) {\n paths.push(fullPath);\n }\n\n if (entry.isDirectory() && filters.includeDirName(entry.name)) {\n await crawl(fullPath, filters, paths);\n }\n }),\n );\n } catch {\n // Ignore errors, because of e.g. permission issues reading directories\n }\n\n return paths;\n}\n\nexport const locateNearestFile = async ({\n cwd,\n filename,\n}: {\n cwd: string;\n filename: string;\n}) => {\n let currentDir = cwd;\n while (currentDir !== path.dirname(currentDir)) {\n const filePath = path.join(currentDir, filename);\n if (await fs.pathExists(filePath)) {\n return filePath;\n }\n currentDir = path.dirname(currentDir);\n }\n\n return null;\n};\n\nexport const locateFurthestFile = async ({\n cwd,\n filename,\n}: {\n cwd: string;\n filename: string;\n}) => {\n let currentDir = cwd;\n let furthestFilePath: string | null = null;\n\n while (currentDir !== path.dirname(currentDir)) {\n const filePath = path.join(currentDir, filename);\n if (await fs.pathExists(filePath)) {\n furthestFilePath = filePath;\n }\n currentDir = path.dirname(currentDir);\n }\n\n return furthestFilePath;\n};\n\nconst workspaceRootCache: Record<string, string | null> = {};\n\nexport const findWorkspaceRoot = async (\n cwd = process.cwd(),\n): Promise<string | null> => {\n const find = async (): Promise<string | null> => {\n const [pnpmLock, yarnLock, packageJson, gitRoot] = await Promise.all([\n locateNearestFile({ cwd, filename: 'pnpm-lock.yaml' }),\n locateNearestFile({ cwd, filename: 'yarn.lock' }),\n locateFurthestFile({ cwd, filename: 'package.json' }),\n Git.findRoot({ dir: cwd }),\n ]);\n\n const candidates = [\n pnpmLock ? path.dirname(pnpmLock) : null,\n yarnLock ? path.dirname(yarnLock) : null,\n packageJson ? path.dirname(packageJson) : null,\n gitRoot,\n ].filter((dir): dir is string => dir !== null);\n\n if (candidates[0]) {\n // Pick the longest path. This will be the most specific, which helps guard against someone\n // having an accidental lockfile in a parent directory by mistake.\n\n return candidates.reduce((longest, current) => {\n if (current.split(path.sep).length > longest.split(path.sep).length) {\n return current;\n }\n return longest;\n }, candidates[0]);\n }\n\n return null;\n };\n\n return (workspaceRootCache[cwd] ??= await find());\n};\n\nexport const findCurrentWorkspaceProjectRoot = async (\n cwd = process.cwd(),\n): Promise<string | null> => {\n const packageJson = await locateNearestFile({\n cwd,\n filename: 'package.json',\n });\n return packageJson ? path.dirname(packageJson) : null;\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,sBAAe;AACf,oBAAmB;AACnB,uBAAsB;AAEtB,mBAAgC;AAEhC,UAAqB;AAKd,MAAM,4BAA4B,CACvC,UACA,cACA,YAEA,OAAO;AAAA,EACL,SAAS,IAAI,CAAC,YAAY;AACxB,UAAM,cAAU,iBAAAA,SAAU,SAAS,OAAO;AAE1C,UAAM,YAAY,aAAa,OAAO,CAAC,aAAa,QAAQ,QAAQ,CAAC;AAErE,WAAO,CAAC,SAAS,SAAS;AAAA,EAC5B,CAAC;AACH;AAWK,MAAM,iBAAiB,OAC5B,MACA,kBAAkB,CAAC,YAAY,MAC5B;AACH,QAAM,mBAAmB,MAAM;AAAA,IAC7B,gBAAgB,IAAI,CAAC,mBAAmB,YAAAC,QAAK,KAAK,MAAM,cAAc,CAAC;AAAA,EACz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IAC3B,CAAC;AAED,UAAM,aAAa;AAAA,MACjB,WAAW,YAAAA,QAAK,QAAQ,QAAQ,IAAI;AAAA,MACpC,WAAW,YAAAA,QAAK,QAAQ,QAAQ,IAAI;AAAA,MACpC,cAAc,YAAAA,QAAK,QAAQ,WAAW,IAAI;AAAA,MAC1C;AAAA,IACF,EAAE,OAAO,CAAC,QAAuB,QAAQ,IAAI;AAE7C,QAAI,WAAW,CAAC,GAAG;AAIjB,aAAO,WAAW,OAAO,CAAC,SAAS,YAAY;AAC7C,YAAI,QAAQ,MAAM,YAAAA,QAAK,GAAG,EAAE,SAAS,QAAQ,MAAM,YAAAA,QAAK,GAAG,EAAE,QAAQ;AACnE,iBAAO;AAAA,QACT;AACA,eAAO;AAAA,MACT,GAAG,WAAW,CAAC,CAAC;AAAA,IAClB;AAEA,WAAO;AAAA,EACT;AAEA,SAAQ,mBAAmB,GAAG,MAAM,MAAM,KAAK;AACjD;AAEO,MAAM,kCAAkC,OAC7C,MAAM,QAAQ,IAAI,MACS;AAC3B,QAAM,cAAc,MAAM,kBAAkB;AAAA,IAC1C;AAAA,IACA,UAAU;AAAA,EACZ,CAAC;AACD,SAAO,cAAc,YAAAA,QAAK,QAAQ,WAAW,IAAI;AACnD;",
6
+ "names": ["picomatch", "path", "fs", "ignore"]
7
7
  }
@@ -4,7 +4,11 @@ export type ProjectType = z.infer<typeof projectTypeSchema>;
4
4
  export declare const projectTypeSchema: z.ZodUnion<readonly [z.ZodLiteral<"application">, z.ZodLiteral<"package">]>;
5
5
  export declare const PROJECT_TYPES: readonly ["application", "package"];
6
6
  export declare const getSkubaManifest: () => Promise<NormalizedPackageJson>;
7
- export declare const getConsumerManifest: (cwd?: string) => Promise<readPkgUp.NormalizedReadResult | undefined>;
8
- export declare const getPropFromConsumerManifest: <T extends string, V = unknown>(prop: T) => Promise<V | undefined>;
7
+ export declare const getConsumerManifest: (cwd?: string) => Promise<readPkgUp.ReadResult | undefined>;
8
+ export declare const getManifestProperties: <T extends string, V = unknown>(prop: T) => Promise<{
9
+ value: V | undefined;
10
+ type: string | undefined;
11
+ path: string;
12
+ } | undefined>;
9
13
  export declare const getStringPropFromConsumerManifest: <T extends string>(prop: T) => Promise<string | undefined>;
10
14
  export declare const getEntryPointFromManifest: () => Promise<string>;
@@ -31,7 +31,7 @@ __export(manifest_exports, {
31
31
  PROJECT_TYPES: () => PROJECT_TYPES,
32
32
  getConsumerManifest: () => getConsumerManifest,
33
33
  getEntryPointFromManifest: () => getEntryPointFromManifest,
34
- getPropFromConsumerManifest: () => getPropFromConsumerManifest,
34
+ getManifestProperties: () => getManifestProperties,
35
35
  getSkubaManifest: () => getSkubaManifest,
36
36
  getStringPropFromConsumerManifest: () => getStringPropFromConsumerManifest,
37
37
  projectTypeSchema: () => projectTypeSchema
@@ -57,14 +57,23 @@ const getSkubaManifest = async () => {
57
57
  }
58
58
  return skubaManifest = result.packageJson;
59
59
  };
60
- const getConsumerManifest = (cwd) => (0, import_read_pkg_up.default)({ cwd });
61
- const getPropFromConsumerManifest = async (prop) => {
62
- const result = await getConsumerManifest();
63
- return result !== void 0 && (0, import_validation.hasProp)(result.packageJson.skuba, prop) ? result.packageJson.skuba[prop] : void 0;
60
+ const getConsumerManifest = (cwd) => (0, import_read_pkg_up.default)({ cwd, normalize: false });
61
+ const getManifestProperties = async (prop) => {
62
+ const manifest = await getConsumerManifest();
63
+ if (!manifest) {
64
+ return void 0;
65
+ }
66
+ const value = (0, import_validation.hasProp)(manifest.packageJson.skuba, prop) ? manifest.packageJson.skuba[prop] : void 0;
67
+ const type = typeof manifest.packageJson.type === "string" ? manifest.packageJson.type : void 0;
68
+ return {
69
+ value,
70
+ type,
71
+ path: manifest.path
72
+ };
64
73
  };
65
74
  const getStringPropFromConsumerManifest = async (prop) => {
66
- const result = await getPropFromConsumerManifest(prop);
67
- return typeof result === "string" ? result : void 0;
75
+ const manifest = await getManifestProperties(prop);
76
+ return typeof manifest?.value === "string" ? manifest.value : void 0;
68
77
  };
69
78
  const getEntryPointFromManifest = async () => {
70
79
  const entryPoint = await getStringPropFromConsumerManifest("entryPoint");
@@ -75,7 +84,7 @@ const getEntryPointFromManifest = async () => {
75
84
  PROJECT_TYPES,
76
85
  getConsumerManifest,
77
86
  getEntryPointFromManifest,
78
- getPropFromConsumerManifest,
87
+ getManifestProperties,
79
88
  getSkubaManifest,
80
89
  getStringPropFromConsumerManifest,
81
90
  projectTypeSchema
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/utils/manifest.ts"],
4
- "sourcesContent": ["import readPkgUp, { type NormalizedPackageJson } from 'read-pkg-up';\nimport * as z from 'zod/v4';\n\nimport { hasProp } from './validation.js';\n\nexport type ProjectType = z.infer<typeof projectTypeSchema>;\n\nexport const projectTypeSchema = z.union([\n z.literal('application'),\n z.literal('package'),\n]);\n\nexport const PROJECT_TYPES = ['application', 'package'] as const;\n\nconst DEFAULT_ENTRY_POINT = 'src/app.ts';\n\nlet skubaManifest: NormalizedPackageJson | undefined;\n\nexport const getSkubaManifest = async (): Promise<NormalizedPackageJson> => {\n if (skubaManifest !== undefined) {\n return skubaManifest;\n }\n\n const result = await readPkgUp({ cwd: __dirname });\n\n if (result === undefined) {\n throw Error('skuba could not find its own manifest');\n }\n\n return (skubaManifest = result.packageJson);\n};\n\nexport const getConsumerManifest = (cwd?: string) => readPkgUp({ cwd });\n\nexport const getPropFromConsumerManifest = async <\n T extends string,\n V = unknown,\n>(\n prop: T,\n): Promise<V | undefined> => {\n const result = await getConsumerManifest();\n\n return result !== undefined && hasProp<T, V>(result.packageJson.skuba, prop)\n ? result.packageJson.skuba[prop]\n : undefined;\n};\n\nexport const getStringPropFromConsumerManifest = async <T extends string>(\n prop: T,\n): Promise<string | undefined> => {\n const result = await getPropFromConsumerManifest(prop);\n\n return typeof result === 'string' ? result : undefined;\n};\n\nexport const getEntryPointFromManifest = async (): Promise<string> => {\n const entryPoint = await getStringPropFromConsumerManifest('entryPoint');\n\n return entryPoint ?? DEFAULT_ENTRY_POINT;\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAAsD;AACtD,QAAmB;AAEnB,wBAAwB;AAIjB,MAAM,oBAAoB,EAAE,MAAM;AAAA,EACvC,EAAE,QAAQ,aAAa;AAAA,EACvB,EAAE,QAAQ,SAAS;AACrB,CAAC;AAEM,MAAM,gBAAgB,CAAC,eAAe,SAAS;AAEtD,MAAM,sBAAsB;AAE5B,IAAI;AAEG,MAAM,mBAAmB,YAA4C;AAC1E,MAAI,kBAAkB,QAAW;AAC/B,WAAO;AAAA,EACT;AAEA,QAAM,SAAS,UAAM,mBAAAA,SAAU,EAAE,KAAK,UAAU,CAAC;AAEjD,MAAI,WAAW,QAAW;AACxB,UAAM,MAAM,uCAAuC;AAAA,EACrD;AAEA,SAAQ,gBAAgB,OAAO;AACjC;AAEO,MAAM,sBAAsB,CAAC,YAAiB,mBAAAA,SAAU,EAAE,IAAI,CAAC;AAE/D,MAAM,8BAA8B,OAIzC,SAC2B;AAC3B,QAAM,SAAS,MAAM,oBAAoB;AAEzC,SAAO,WAAW,cAAa,2BAAc,OAAO,YAAY,OAAO,IAAI,IACvE,OAAO,YAAY,MAAM,IAAI,IAC7B;AACN;AAEO,MAAM,oCAAoC,OAC/C,SACgC;AAChC,QAAM,SAAS,MAAM,4BAA4B,IAAI;AAErD,SAAO,OAAO,WAAW,WAAW,SAAS;AAC/C;AAEO,MAAM,4BAA4B,YAA6B;AACpE,QAAM,aAAa,MAAM,kCAAkC,YAAY;AAEvE,SAAO,cAAc;AACvB;",
4
+ "sourcesContent": ["import readPkgUp, { type NormalizedPackageJson } from 'read-pkg-up';\nimport * as z from 'zod/v4';\n\nimport { hasProp } from './validation.js';\n\nexport type ProjectType = z.infer<typeof projectTypeSchema>;\n\nexport const projectTypeSchema = z.union([\n z.literal('application'),\n z.literal('package'),\n]);\n\nexport const PROJECT_TYPES = ['application', 'package'] as const;\n\nconst DEFAULT_ENTRY_POINT = 'src/app.ts';\n\nlet skubaManifest: NormalizedPackageJson | undefined;\n\nexport const getSkubaManifest = async (): Promise<NormalizedPackageJson> => {\n if (skubaManifest !== undefined) {\n return skubaManifest;\n }\n\n const result = await readPkgUp({ cwd: __dirname });\n\n if (result === undefined) {\n throw Error('skuba could not find its own manifest');\n }\n\n return (skubaManifest = result.packageJson);\n};\n\nexport const getConsumerManifest = (cwd?: string) =>\n readPkgUp({ cwd, normalize: false });\n\nexport const getManifestProperties = async <T extends string, V = unknown>(\n prop: T,\n): Promise<\n | {\n value: V | undefined;\n type: string | undefined;\n path: string;\n }\n | undefined\n> => {\n const manifest = await getConsumerManifest();\n\n if (!manifest) {\n return undefined;\n }\n\n const value = hasProp<T, V>(manifest.packageJson.skuba, prop)\n ? manifest.packageJson.skuba[prop]\n : undefined;\n\n const type =\n typeof manifest.packageJson.type === 'string'\n ? manifest.packageJson.type\n : undefined;\n\n return {\n value,\n type,\n path: manifest.path,\n };\n};\n\nexport const getStringPropFromConsumerManifest = async <T extends string>(\n prop: T,\n): Promise<string | undefined> => {\n const manifest = await getManifestProperties(prop);\n\n return typeof manifest?.value === 'string' ? manifest.value : undefined;\n};\n\nexport const getEntryPointFromManifest = async (): Promise<string> => {\n const entryPoint = await getStringPropFromConsumerManifest('entryPoint');\n\n return entryPoint ?? DEFAULT_ENTRY_POINT;\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAAsD;AACtD,QAAmB;AAEnB,wBAAwB;AAIjB,MAAM,oBAAoB,EAAE,MAAM;AAAA,EACvC,EAAE,QAAQ,aAAa;AAAA,EACvB,EAAE,QAAQ,SAAS;AACrB,CAAC;AAEM,MAAM,gBAAgB,CAAC,eAAe,SAAS;AAEtD,MAAM,sBAAsB;AAE5B,IAAI;AAEG,MAAM,mBAAmB,YAA4C;AAC1E,MAAI,kBAAkB,QAAW;AAC/B,WAAO;AAAA,EACT;AAEA,QAAM,SAAS,UAAM,mBAAAA,SAAU,EAAE,KAAK,UAAU,CAAC;AAEjD,MAAI,WAAW,QAAW;AACxB,UAAM,MAAM,uCAAuC;AAAA,EACrD;AAEA,SAAQ,gBAAgB,OAAO;AACjC;AAEO,MAAM,sBAAsB,CAAC,YAClC,mBAAAA,SAAU,EAAE,KAAK,WAAW,MAAM,CAAC;AAE9B,MAAM,wBAAwB,OACnC,SAQG;AACH,QAAM,WAAW,MAAM,oBAAoB;AAE3C,MAAI,CAAC,UAAU;AACb,WAAO;AAAA,EACT;AAEA,QAAM,YAAQ,2BAAc,SAAS,YAAY,OAAO,IAAI,IACxD,SAAS,YAAY,MAAM,IAAI,IAC/B;AAEJ,QAAM,OACJ,OAAO,SAAS,YAAY,SAAS,WACjC,SAAS,YAAY,OACrB;AAEN,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,MAAM,SAAS;AAAA,EACjB;AACF;AAEO,MAAM,oCAAoC,OAC/C,SACgC;AAChC,QAAM,WAAW,MAAM,sBAAsB,IAAI;AAEjD,SAAO,OAAO,UAAU,UAAU,WAAW,SAAS,QAAQ;AAChE;AAEO,MAAM,4BAA4B,YAA6B;AACpE,QAAM,aAAa,MAAM,kCAAkC,YAAY;AAEvE,SAAO,cAAc;AACvB;",
6
6
  "names": ["readPkgUp"]
7
7
  }
@@ -23,7 +23,7 @@ export declare const templateConfigSchema: z.ZodObject<{
23
23
  name: z.ZodString;
24
24
  message: z.ZodString;
25
25
  initial: z.ZodString;
26
- validate: z.ZodOptional<z.ZodPipe<z.ZodCustom<z.core.$InferInnerFunctionType<z.core.$ZodTuple<[z.ZodString], null>, z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>, z.core.$InferInnerFunctionType<z.core.$ZodTuple<[z.ZodString], null>, z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>>, z.ZodTransform<(args_0: string) => string | boolean, z.core.$InferInnerFunctionType<z.core.$ZodTuple<[z.ZodString], null>, z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>>>>;
26
+ validate: z.ZodOptional<z.ZodPipe<z.ZodCustom<z.core.$InferInnerFunctionType<z.ZodTuple<readonly [z.ZodString], null>, z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>, z.core.$InferInnerFunctionType<z.ZodTuple<readonly [z.ZodString], null>, z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>>, z.ZodTransform<(args_0: string) => string | boolean, z.core.$InferInnerFunctionType<z.ZodTuple<readonly [z.ZodString], null>, z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>>>>;
27
27
  }, z.core.$strip>>;
28
28
  entryPoint: z.ZodOptional<z.ZodString>;
29
29
  noSkip: z.ZodOptional<z.ZodBoolean>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skuba",
3
- "version": "13.0.0-subpath-imports-20250722044721",
3
+ "version": "13.0.0-subpath-imports-20251003044159",
4
4
  "private": false,
5
5
  "description": "SEEK development toolkit for backend applications and packages",
6
6
  "homepage": "https://github.com/seek-oss/skuba#readme",
@@ -62,12 +62,11 @@
62
62
  "@octokit/graphql": "^9.0.0",
63
63
  "@octokit/graphql-schema": "^15.3.0",
64
64
  "@octokit/rest": "^22.0.0",
65
- "@octokit/types": "^14.0.0",
65
+ "@octokit/types": "^15.0.0",
66
66
  "@types/jest": "^30.0.0",
67
67
  "@types/node": "^22.0.0",
68
68
  "chalk": "^4.1.0",
69
69
  "concurrently": "^9.0.0",
70
- "dotenv": "^16.0.0",
71
70
  "ejs": "^3.1.6",
72
71
  "enquirer": "^2.3.6",
73
72
  "esbuild": "~0.25.0",
@@ -102,38 +101,39 @@
102
101
  "tsconfig-paths": "^4.0.0",
103
102
  "tsconfig-seek": "2.0.0",
104
103
  "tsx": "^4.16.2",
105
- "typescript": "~5.8.0",
106
- "zod": "^3.25.67",
107
- "eslint-config-skuba": "7.0.2"
104
+ "typescript": "~5.9.0",
105
+ "zod": "^4.0.0",
106
+ "@skuba-lib/api": "^1.0.1",
107
+ "eslint-config-skuba": "7.1.2"
108
108
  },
109
109
  "devDependencies": {
110
- "@changesets/cli": "2.29.5",
110
+ "@changesets/cli": "2.29.7",
111
111
  "@changesets/get-github-info": "0.6.0",
112
- "@jest/reporters": "30.0.4",
113
- "@jest/test-result": "30.0.4",
112
+ "@jest/reporters": "30.1.3",
113
+ "@jest/test-result": "30.1.3",
114
114
  "@types/ejs": "3.1.5",
115
115
  "@types/express": "5.0.3",
116
116
  "@types/fs-extra": "11.0.4",
117
- "@types/koa": "2.15.0",
117
+ "@types/koa": "3.0.0",
118
118
  "@types/lodash.mergewith": "4.6.9",
119
119
  "@types/minimist": "1.2.5",
120
120
  "@types/module-alias": "2.0.4",
121
121
  "@types/npm-registry-fetch": "8.0.8",
122
122
  "@types/npm-which": "3.0.4",
123
- "@types/picomatch": "4.0.0",
124
- "@types/semver": "7.7.0",
123
+ "@types/picomatch": "4.0.2",
124
+ "@types/semver": "7.7.1",
125
125
  "@types/supertest": "6.0.3",
126
- "enhanced-resolve": "5.18.2",
126
+ "enhanced-resolve": "5.18.3",
127
127
  "express": "5.1.0",
128
- "fastify": "5.4.0",
129
- "jest-diff": "30.0.4",
130
- "jsonfile": "6.1.0",
131
- "koa": "3.0.0",
132
- "memfs": "4.17.2",
128
+ "fastify": "5.6.1",
129
+ "jest-diff": "30.1.2",
130
+ "jsonfile": "6.2.0",
131
+ "koa": "3.0.1",
132
+ "memfs": "4.43.0",
133
133
  "remark-cli": "12.0.1",
134
134
  "remark-preset-lint-recommended": "7.0.1",
135
135
  "semver": "7.7.2",
136
- "supertest": "7.1.3",
136
+ "supertest": "7.1.4",
137
137
  "type-fest": "2.19.0"
138
138
  },
139
139
  "peerDependencies": {
@@ -147,15 +147,12 @@
147
147
  "engines": {
148
148
  "node": ">=20.9.0"
149
149
  },
150
- "publishConfig": {
151
- "provenance": true
152
- },
153
150
  "skuba": {
154
151
  "build": "esbuild",
155
152
  "entryPoint": "src/index.ts",
156
153
  "template": null,
157
154
  "type": "package",
158
- "version": "12.0.2"
155
+ "version": "12.4.1"
159
156
  },
160
157
  "scripts": {
161
158
  "build": "scripts/build.sh",
@@ -169,7 +166,7 @@
169
166
  "lint:packages": "pnpm --filter '!./template/**' lint",
170
167
  "release": "pnpm --silent build && changeset publish",
171
168
  "skuba": "pnpm --silent build && pnpm --silent skuba:exec",
172
- "skuba:exec": "node --experimental-vm-modules --no-warnings=ExperimentalWarning lib/skuba",
169
+ "skuba:exec": "node lib/skuba",
173
170
  "stage": "changeset version && node ./.changeset/inject.js && pnpm format",
174
171
  "test": "pnpm --silent skuba test --selectProjects unit",
175
172
  "test:ci": "pnpm --silent skuba test --runInBand",
@@ -1 +1 @@
1
- export { default } from 'skuba/config/prettier.js';
1
+ module.exports = require('skuba/config/prettier');
@@ -1 +1 @@
1
- export { default } from 'eslint-config-skuba';
1
+ module.exports = require('eslint-config-skuba');
@@ -1,11 +1,22 @@
1
1
  # managed by skuba
2
- nodeOptions: '${NODE_OPTIONS:- } --experimental-vm-modules'
2
+ ignorePatchFailures: false
3
+ minimumReleaseAge: 4320 # 3 days
4
+ minimumReleaseAgeExclude:
5
+ - '@seek/*'
6
+ - '@skuba-lib/*'
7
+ - eslint-config-seek
8
+ - eslint-config-skuba
9
+ - eslint-plugin-skuba
10
+ - skuba
11
+ - tsconfig-seek
3
12
  packageManagerStrictVersion: true
4
13
  publicHoistPattern:
5
14
  - '@types*'
6
- - '*eslint*'
7
- - '*prettier*'
15
+ - eslint
16
+ - eslint-config-skuba
17
+ - prettier
8
18
  - esbuild
9
19
  - jest
10
20
  - tsconfig-seek
21
+ - typescript
11
22
  # end managed by skuba
@@ -1,15 +1,6 @@
1
- import { readFileSync } from 'fs';
1
+ import { Jest } from 'skuba';
2
2
 
3
- const packageJson = JSON.parse(readFileSync('package.json', 'utf8')) as {
4
- type?: string;
5
- };
6
- const isESM = packageJson.type === 'module';
7
-
8
- export default {
9
- preset: 'skuba',
10
- ...(isESM && {
11
- extensionsToTreatAsEsm: ['.ts'],
12
- }),
3
+ export default Jest.mergePreset({
13
4
  coveragePathIgnorePatterns: ['src/testing'],
14
5
  coverageThreshold: {
15
6
  global: {
@@ -21,4 +12,8 @@ export default {
21
12
  },
22
13
  setupFiles: ['<rootDir>/jest.setup.ts'],
23
14
  testPathIgnorePatterns: ['/test\\.ts'],
24
- };
15
+ moduleNameMapper: {
16
+ '^#src/(.*)\\.js$': ['<rootDir>/src/$1'],
17
+ '^#src/(.*)$': ['<rootDir>/src/$1'],
18
+ },
19
+ });
@@ -1,3 +1,3 @@
1
- process.env.ENVIRONMENT = 'test';
1
+ process.env.DEPLOYMENT = 'test';
2
2
 
3
3
  export {};
@@ -77,6 +77,9 @@ steps:
77
77
  queue: <%- devBuildkiteQueueName %>
78
78
  label: 🤞 Deploy Dev
79
79
  concurrency_group: <%- teamName %>/deploy/gantry/<%- devGantryEnvironmentName %>
80
+ env:
81
+ DD_DEPLOYMENT_ENVIRONMENT: development
82
+ DD_DEPLOYMENT_SERVICE: <%- serviceName %>
80
83
  key: deploy-dev
81
84
  plugins:
82
85
  - seek-jobs/gantry#v4.0.0:
@@ -93,6 +96,9 @@ steps:
93
96
  branches: ${BUILDKITE_PIPELINE_DEFAULT_BRANCH}
94
97
  concurrency_group: <%- teamName %>/deploy/gantry/<%- prodGantryEnvironmentName %>
95
98
  depends_on: deploy-dev
99
+ env:
100
+ DD_DEPLOYMENT_ENVIRONMENT: production
101
+ DD_DEPLOYMENT_SERVICE: <%- serviceName %>
96
102
  plugins:
97
103
  - seek-jobs/gantry#v4.0.0:
98
104
  command: apply
@@ -1 +1 @@
1
- ENVIRONMENT=local
1
+ DEPLOYMENT=local
@@ -1,7 +1,11 @@
1
- environment: dev
1
+ deployment: dev
2
+ env: development
2
3
 
3
4
  maxInstanceCount: 1
4
5
  minInstanceCount: 1
5
6
 
6
7
  # Disable dashboard for cost savings
7
8
  cloudwatchDashboardDisabled: true
9
+
10
+ openTelemetry:
11
+ enabled: true
@@ -1,4 +1,8 @@
1
- environment: prod
1
+ deployment: prod
2
+ env: production
2
3
 
3
4
  maxInstanceCount: 10
4
5
  minInstanceCount: 3
6
+
7
+ openTelemetry:
8
+ enabled: true