skuba 4.4.1 → 5.0.0-beta.0

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 (313) hide show
  1. package/config/tsconfig.json +1 -0
  2. package/jest/moduleNameMapper.js +50 -78
  3. package/jest/moduleNameMapper.test.ts +4 -14
  4. package/jest/transform.js +10 -1
  5. package/jest/tsConfig.js +26 -0
  6. package/lib/api/buildkite/annotate.js +46 -33
  7. package/lib/api/buildkite/annotate.js.map +7 -1
  8. package/lib/api/buildkite/index.js +31 -7
  9. package/lib/api/buildkite/index.js.map +7 -1
  10. package/lib/api/buildkite/md.js +31 -8
  11. package/lib/api/buildkite/md.js.map +7 -1
  12. package/lib/api/git/commit.js +45 -17
  13. package/lib/api/git/commit.js.map +7 -1
  14. package/lib/api/git/commitAllChanges.js +57 -27
  15. package/lib/api/git/commitAllChanges.js.map +7 -1
  16. package/lib/api/git/currentBranch.js +50 -28
  17. package/lib/api/git/currentBranch.js.map +7 -1
  18. package/lib/api/git/getChangedFiles.js +49 -27
  19. package/lib/api/git/getChangedFiles.js.map +7 -1
  20. package/lib/api/git/index.js +54 -22
  21. package/lib/api/git/index.js.map +7 -1
  22. package/lib/api/git/log.js +63 -42
  23. package/lib/api/git/log.js.map +7 -1
  24. package/lib/api/git/pull.js +62 -31
  25. package/lib/api/git/pull.js.map +7 -1
  26. package/lib/api/git/push.js +63 -31
  27. package/lib/api/git/push.js.map +7 -1
  28. package/lib/api/git/remote.js +59 -56
  29. package/lib/api/git/remote.js.map +7 -1
  30. package/lib/api/git/reset.js +55 -27
  31. package/lib/api/git/reset.js.map +7 -1
  32. package/lib/api/git/statusMatrix.js +46 -13
  33. package/lib/api/git/statusMatrix.js.map +7 -1
  34. package/lib/api/github/checkRun.js +70 -79
  35. package/lib/api/github/checkRun.js.map +7 -1
  36. package/lib/api/github/environment.js +40 -33
  37. package/lib/api/github/environment.js.map +7 -1
  38. package/lib/api/github/index.js +47 -17
  39. package/lib/api/github/index.js.map +7 -1
  40. package/lib/api/github/issueComment.js +73 -81
  41. package/lib/api/github/issueComment.js.map +7 -1
  42. package/lib/api/github/pullRequest.js +60 -61
  43. package/lib/api/github/pullRequest.js.map +7 -1
  44. package/lib/api/github/push.js +138 -133
  45. package/lib/api/github/push.js.map +7 -1
  46. package/lib/api/jest/index.d.ts +2 -1
  47. package/lib/api/jest/index.js +35 -14
  48. package/lib/api/jest/index.js.map +7 -1
  49. package/lib/api/net/compose.js +45 -17
  50. package/lib/api/net/compose.js.map +7 -1
  51. package/lib/api/net/index.js +28 -5
  52. package/lib/api/net/index.js.map +7 -1
  53. package/lib/api/net/socket.js +58 -36
  54. package/lib/api/net/socket.js.map +7 -1
  55. package/lib/api/net/waitFor.js +38 -18
  56. package/lib/api/net/waitFor.js.map +7 -1
  57. package/lib/cli/adapter/eslint.js +95 -72
  58. package/lib/cli/adapter/eslint.js.map +7 -1
  59. package/lib/cli/adapter/prettier.js +126 -124
  60. package/lib/cli/adapter/prettier.js.map +7 -1
  61. package/lib/cli/build/args.d.ts +7 -0
  62. package/lib/cli/build/args.js +69 -0
  63. package/lib/cli/build/args.js.map +7 -0
  64. package/lib/cli/build/esbuild.d.ts +5 -0
  65. package/lib/cli/build/esbuild.js +128 -0
  66. package/lib/cli/build/esbuild.js.map +7 -0
  67. package/lib/cli/build/index.d.ts +1 -1
  68. package/lib/cli/build/index.js +68 -5
  69. package/lib/cli/build/index.js.map +7 -1
  70. package/lib/cli/build/tsc.d.ts +1 -1
  71. package/lib/cli/build/tsc.js +34 -23
  72. package/lib/cli/build/tsc.js.map +7 -1
  73. package/lib/cli/buildPackage.js +53 -23
  74. package/lib/cli/buildPackage.js.map +7 -1
  75. package/lib/cli/configure/addEmptyExports.d.ts +5 -0
  76. package/lib/cli/configure/addEmptyExports.js +67 -0
  77. package/lib/cli/configure/addEmptyExports.js.map +7 -0
  78. package/lib/cli/configure/analyseConfiguration.js +61 -31
  79. package/lib/cli/configure/analyseConfiguration.js.map +7 -1
  80. package/lib/cli/configure/analyseDependencies.js +122 -113
  81. package/lib/cli/configure/analyseDependencies.js.map +7 -1
  82. package/lib/cli/configure/analysis/diff.js +37 -11
  83. package/lib/cli/configure/analysis/diff.js.map +7 -1
  84. package/lib/cli/configure/analysis/files.js +49 -22
  85. package/lib/cli/configure/analysis/files.js.map +7 -1
  86. package/lib/cli/configure/analysis/git.js +46 -16
  87. package/lib/cli/configure/analysis/git.js.map +7 -1
  88. package/lib/cli/configure/analysis/package.js +99 -52
  89. package/lib/cli/configure/analysis/package.js.map +7 -1
  90. package/lib/cli/configure/analysis/project.js +90 -54
  91. package/lib/cli/configure/analysis/project.js.map +7 -1
  92. package/lib/cli/configure/dependencies/index.js +40 -13
  93. package/lib/cli/configure/dependencies/index.js.map +7 -1
  94. package/lib/cli/configure/dependencies/seekDatadogCustomMetrics.js +57 -32
  95. package/lib/cli/configure/dependencies/seekDatadogCustomMetrics.js.map +7 -1
  96. package/lib/cli/configure/dependencies/seekKoala.js +53 -31
  97. package/lib/cli/configure/dependencies/seekKoala.js.map +7 -1
  98. package/lib/cli/configure/dependencies/skuba.js +49 -27
  99. package/lib/cli/configure/dependencies/skuba.js.map +7 -1
  100. package/lib/cli/configure/dependencies/skubaDeps.js +49 -28
  101. package/lib/cli/configure/dependencies/skubaDeps.js.map +7 -1
  102. package/lib/cli/configure/dependencies/skubaDive.js +65 -38
  103. package/lib/cli/configure/dependencies/skubaDive.js.map +7 -1
  104. package/lib/cli/configure/ensureTemplateCompletion.js +69 -41
  105. package/lib/cli/configure/ensureTemplateCompletion.js.map +7 -1
  106. package/lib/cli/configure/getEntryPoint.js +62 -32
  107. package/lib/cli/configure/getEntryPoint.js.map +7 -1
  108. package/lib/cli/configure/getProjectType.js +50 -28
  109. package/lib/cli/configure/getProjectType.js.map +7 -1
  110. package/lib/cli/configure/index.js +134 -109
  111. package/lib/cli/configure/index.js.map +7 -1
  112. package/lib/cli/configure/modules/eslint.js +57 -26
  113. package/lib/cli/configure/modules/eslint.js.map +7 -1
  114. package/lib/cli/configure/modules/ignore.js +37 -14
  115. package/lib/cli/configure/modules/ignore.js.map +7 -1
  116. package/lib/cli/configure/modules/index.js +53 -28
  117. package/lib/cli/configure/modules/index.js.map +7 -1
  118. package/lib/cli/configure/modules/jest.js +84 -47
  119. package/lib/cli/configure/modules/jest.js.map +7 -1
  120. package/lib/cli/configure/modules/nodemon.js +29 -6
  121. package/lib/cli/configure/modules/nodemon.js.map +7 -1
  122. package/lib/cli/configure/modules/package.js +113 -92
  123. package/lib/cli/configure/modules/package.js.map +7 -1
  124. package/lib/cli/configure/modules/prettier.js +48 -19
  125. package/lib/cli/configure/modules/prettier.js.map +7 -1
  126. package/lib/cli/configure/modules/renovate.js +52 -39
  127. package/lib/cli/configure/modules/renovate.js.map +7 -1
  128. package/lib/cli/configure/modules/serverless.js +33 -15
  129. package/lib/cli/configure/modules/serverless.js.map +7 -1
  130. package/lib/cli/configure/modules/skubaDive.js +63 -37
  131. package/lib/cli/configure/modules/skubaDive.js.map +7 -1
  132. package/lib/cli/configure/modules/tsconfig.js +79 -63
  133. package/lib/cli/configure/modules/tsconfig.js.map +7 -1
  134. package/lib/cli/configure/modules/tslint.js +29 -6
  135. package/lib/cli/configure/modules/tslint.js.map +7 -1
  136. package/lib/cli/configure/processing/deleteFiles.js +30 -8
  137. package/lib/cli/configure/processing/deleteFiles.js.map +7 -1
  138. package/lib/cli/configure/processing/ignoreFile.js +65 -59
  139. package/lib/cli/configure/processing/ignoreFile.js.map +7 -1
  140. package/lib/cli/configure/processing/javascript.js +35 -15
  141. package/lib/cli/configure/processing/javascript.js.map +7 -1
  142. package/lib/cli/configure/processing/json.js +51 -20
  143. package/lib/cli/configure/processing/json.js.map +7 -1
  144. package/lib/cli/configure/processing/loadFiles.js +30 -8
  145. package/lib/cli/configure/processing/loadFiles.js.map +7 -1
  146. package/lib/cli/configure/processing/module.js +37 -14
  147. package/lib/cli/configure/processing/module.js.map +7 -1
  148. package/lib/cli/configure/processing/package.js +73 -43
  149. package/lib/cli/configure/processing/package.js.map +7 -1
  150. package/lib/cli/configure/processing/prettier.js +37 -11
  151. package/lib/cli/configure/processing/prettier.js.map +7 -1
  152. package/lib/cli/configure/processing/record.js +54 -31
  153. package/lib/cli/configure/processing/record.js.map +7 -1
  154. package/lib/cli/configure/processing/typescript.js +176 -158
  155. package/lib/cli/configure/processing/typescript.js.map +7 -1
  156. package/lib/cli/configure/refreshIgnoreFiles.js +64 -40
  157. package/lib/cli/configure/refreshIgnoreFiles.js.map +7 -1
  158. package/lib/cli/configure/types.js +16 -2
  159. package/lib/cli/configure/types.js.map +7 -1
  160. package/lib/cli/format.js +58 -31
  161. package/lib/cli/format.js.map +7 -1
  162. package/lib/cli/help.js +31 -8
  163. package/lib/cli/help.js.map +7 -1
  164. package/lib/cli/init/getConfig.js +238 -207
  165. package/lib/cli/init/getConfig.js.map +7 -1
  166. package/lib/cli/init/git.js +70 -63
  167. package/lib/cli/init/git.js.map +7 -1
  168. package/lib/cli/init/index.js +133 -100
  169. package/lib/cli/init/index.js.map +7 -1
  170. package/lib/cli/init/prompts.js +84 -54
  171. package/lib/cli/init/prompts.js.map +7 -1
  172. package/lib/cli/init/types.js +52 -52
  173. package/lib/cli/init/types.js.map +7 -1
  174. package/lib/cli/init/validation.js +34 -12
  175. package/lib/cli/init/validation.js.map +7 -1
  176. package/lib/cli/init/writePackageJson.js +51 -22
  177. package/lib/cli/init/writePackageJson.js.map +7 -1
  178. package/lib/cli/lint/annotate/buildkite/eslint.js +34 -28
  179. package/lib/cli/lint/annotate/buildkite/eslint.js.map +7 -1
  180. package/lib/cli/lint/annotate/buildkite/index.js +50 -44
  181. package/lib/cli/lint/annotate/buildkite/index.js.map +7 -1
  182. package/lib/cli/lint/annotate/buildkite/prettier.js +41 -35
  183. package/lib/cli/lint/annotate/buildkite/prettier.js.map +7 -1
  184. package/lib/cli/lint/annotate/buildkite/tsc.js +39 -39
  185. package/lib/cli/lint/annotate/buildkite/tsc.js.map +7 -1
  186. package/lib/cli/lint/annotate/github/eslint.js +40 -16
  187. package/lib/cli/lint/annotate/github/eslint.js.map +7 -1
  188. package/lib/cli/lint/annotate/github/index.js +55 -51
  189. package/lib/cli/lint/annotate/github/index.js.map +7 -1
  190. package/lib/cli/lint/annotate/github/prettier.js +36 -13
  191. package/lib/cli/lint/annotate/github/prettier.js.map +7 -1
  192. package/lib/cli/lint/annotate/github/tsc.js +52 -52
  193. package/lib/cli/lint/annotate/github/tsc.js.map +7 -1
  194. package/lib/cli/lint/annotate/index.js +33 -10
  195. package/lib/cli/lint/annotate/index.js.map +7 -1
  196. package/lib/cli/lint/autofix.js +122 -117
  197. package/lib/cli/lint/autofix.js.map +7 -1
  198. package/lib/cli/lint/eslint.js +48 -18
  199. package/lib/cli/lint/eslint.js.map +7 -1
  200. package/lib/cli/lint/external.js +102 -81
  201. package/lib/cli/lint/external.js.map +7 -1
  202. package/lib/cli/lint/index.js +42 -18
  203. package/lib/cli/lint/index.js.map +7 -1
  204. package/lib/cli/lint/internal.js +54 -21
  205. package/lib/cli/lint/internal.js.map +7 -1
  206. package/lib/cli/lint/prettier.js +48 -18
  207. package/lib/cli/lint/prettier.js.map +7 -1
  208. package/lib/cli/lint/tsc.js +56 -32
  209. package/lib/cli/lint/tsc.js.map +7 -1
  210. package/lib/cli/lint/types.js +16 -2
  211. package/lib/cli/lint/types.js.map +7 -1
  212. package/lib/cli/node.js +65 -58
  213. package/lib/cli/node.js.map +7 -1
  214. package/lib/cli/release.js +29 -6
  215. package/lib/cli/release.js.map +7 -1
  216. package/lib/cli/start.js +61 -24
  217. package/lib/cli/start.js.map +7 -1
  218. package/lib/cli/test/index.js +35 -11
  219. package/lib/cli/test/index.js.map +7 -1
  220. package/lib/cli/test/reporters/github/annotations.js +89 -92
  221. package/lib/cli/test/reporters/github/annotations.js.map +7 -1
  222. package/lib/cli/test/reporters/github/index.js +68 -68
  223. package/lib/cli/test/reporters/github/index.js.map +7 -1
  224. package/lib/cli/version.js +31 -8
  225. package/lib/cli/version.js.map +7 -1
  226. package/lib/enquirer.d.js +2 -0
  227. package/lib/enquirer.d.js.map +7 -0
  228. package/lib/index.d.ts +6 -0
  229. package/lib/index.js +45 -41
  230. package/lib/index.js.map +7 -1
  231. package/lib/skuba.js +45 -38
  232. package/lib/skuba.js.map +7 -1
  233. package/lib/utils/args.js +97 -96
  234. package/lib/utils/args.js.map +7 -1
  235. package/lib/utils/command.js +64 -33
  236. package/lib/utils/command.js.map +7 -1
  237. package/lib/utils/copy.js +88 -51
  238. package/lib/utils/copy.js.map +7 -1
  239. package/lib/utils/dir.js +79 -67
  240. package/lib/utils/dir.js.map +7 -1
  241. package/lib/utils/env.js +27 -7
  242. package/lib/utils/env.js.map +7 -1
  243. package/lib/utils/error.js +58 -56
  244. package/lib/utils/error.js.map +7 -1
  245. package/lib/utils/exec.js +139 -110
  246. package/lib/utils/exec.js.map +7 -1
  247. package/lib/utils/help.js +31 -8
  248. package/lib/utils/help.js.map +7 -1
  249. package/lib/utils/logging.js +52 -24
  250. package/lib/utils/logging.js.map +7 -1
  251. package/lib/utils/logo.js +65 -27
  252. package/lib/utils/logo.js.map +7 -1
  253. package/lib/utils/manifest.d.ts +1 -0
  254. package/lib/utils/manifest.js +65 -51
  255. package/lib/utils/manifest.js.map +7 -1
  256. package/lib/utils/port.js +38 -17
  257. package/lib/utils/port.js.map +7 -1
  258. package/lib/utils/template.js +106 -87
  259. package/lib/utils/template.js.map +7 -1
  260. package/lib/utils/validation.js +43 -18
  261. package/lib/utils/validation.js.map +7 -1
  262. package/lib/utils/version.js +72 -82
  263. package/lib/utils/version.js.map +7 -1
  264. package/lib/utils/wait.js +52 -25
  265. package/lib/utils/wait.js.map +7 -1
  266. package/lib/utils/worker.js +59 -44
  267. package/lib/utils/worker.js.map +7 -1
  268. package/lib/wrapper/function-arguments.d.js +2 -0
  269. package/lib/wrapper/function-arguments.d.js.map +7 -0
  270. package/lib/wrapper/functionHandler.js +56 -29
  271. package/lib/wrapper/functionHandler.js.map +7 -1
  272. package/lib/wrapper/http.js +66 -56
  273. package/lib/wrapper/http.js.map +7 -1
  274. package/lib/wrapper/index.js +9 -21
  275. package/lib/wrapper/index.js.map +7 -1
  276. package/lib/wrapper/main.js +39 -20
  277. package/lib/wrapper/main.js.map +7 -1
  278. package/lib/wrapper/requestListener.js +50 -35
  279. package/lib/wrapper/requestListener.js.map +7 -1
  280. package/package.json +19 -13
  281. package/template/base/jest.config.ts +0 -6
  282. package/template/base/jest.setup.ts +2 -0
  283. package/template/express-rest-api/.buildkite/pipeline.yml +1 -1
  284. package/template/express-rest-api/package.json +1 -1
  285. package/template/greeter/.buildkite/pipeline.yml +1 -1
  286. package/template/greeter/package.json +1 -1
  287. package/template/greeter/src/app.test.ts +3 -1
  288. package/template/koa-rest-api/.buildkite/pipeline.yml +1 -1
  289. package/template/koa-rest-api/package.json +6 -7
  290. package/template/koa-rest-api/src/api/jobs/postJob.test.ts +3 -7
  291. package/template/koa-rest-api/src/api/jobs/postJob.ts +2 -2
  292. package/template/koa-rest-api/src/framework/validation.test.ts +17 -15
  293. package/template/koa-rest-api/src/framework/validation.ts +50 -9
  294. package/template/koa-rest-api/src/testing/types.ts +5 -10
  295. package/template/koa-rest-api/src/types/jobs.ts +5 -10
  296. package/template/lambda-sqs-worker/.buildkite/pipeline.yml +3 -3
  297. package/template/lambda-sqs-worker/package.json +2 -6
  298. package/template/lambda-sqs-worker/src/app.ts +2 -2
  299. package/template/lambda-sqs-worker/src/framework/validation.test.ts +37 -17
  300. package/template/lambda-sqs-worker/src/framework/validation.ts +4 -2
  301. package/template/lambda-sqs-worker/src/services/jobScorer.ts +2 -2
  302. package/template/lambda-sqs-worker/src/testing/types.ts +5 -10
  303. package/template/lambda-sqs-worker/src/types/jobScorer.ts +9 -16
  304. package/template/lambda-sqs-worker/src/types/pipelineEvents.ts +13 -20
  305. package/template/lambda-sqs-worker-cdk/.buildkite/pipeline.yml +3 -3
  306. package/template/lambda-sqs-worker-cdk/infra/__snapshots__/appStack.test.ts.snap +6 -0
  307. package/template/lambda-sqs-worker-cdk/infra/appStack.ts +3 -3
  308. package/template/lambda-sqs-worker-cdk/infra/index.ts +2 -2
  309. package/template/lambda-sqs-worker-cdk/package.json +2 -2
  310. package/template/lambda-sqs-worker-cdk/shared/context-types.ts +16 -25
  311. package/template/oss-npm-package/_package.json +1 -1
  312. package/template/private-npm-package/_package.json +1 -1
  313. package/jest/resolver.js +0 -24
@@ -1 +1,7 @@
1
- {"version":3,"file":"push.js","sourceRoot":"","sources":["../../../src/api/git/push.ts"],"names":[],"mappings":";;;;;;AAAA,wDAA0B;AAC1B,oEAAiC;AACjC,oEAA4C;AAE5C,uDAAgE;AAEhE,qCAA2C;AA+C3C;;GAEG;AACI,MAAM,IAAI,GAAG,KAAK,EAAE,EACzB,IAAI,EACJ,GAAG,EACH,GAAG,EACH,MAAM,EACN,SAAS,EACT,KAAK,GACU,EAAE,EAAE;IACnB,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,MAAM,IAAA,wBAAe,EAAC,EAAE,GAAG,EAAE,CAAC,CAAC;IAEvD,MAAM,GAAG,GAAG,sBAAsB,kBAAkB,CAClD,KAAK,CACN,IAAI,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC;IAEhC,OAAO,wBAAG,CAAC,IAAI,CAAC;QACd,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;YACb,QAAQ,EAAE,gBAAgB;YAC1B,QAAQ,EAAE,IAAI,CAAC,KAAK,IAAI,IAAA,qCAAuB,GAAE;SAClD,CAAC;QACF,GAAG;QACH,EAAE,EAAF,kBAAE;QACF,IAAI,EAAJ,cAAI;QACJ,GAAG;QACH,MAAM;QACN,SAAS;QACT,GAAG;QACH,KAAK;KACN,CAAC,CAAC;AACL,CAAC,CAAC;AA5BW,QAAA,IAAI,QA4Bf"}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/api/git/push.ts"],
4
+ "sourcesContent": ["import fs from 'fs-extra';\nimport git from 'isomorphic-git';\nimport http from 'isomorphic-git/http/node';\n\nimport { apiTokenFromEnvironment } from '../github/environment';\n\nimport { getOwnerAndRepo } from './remote';\n\n/**\n * Use a GitHub app token to auth the Git push.\n *\n * This defaults to the `GITHUB_API_TOKEN` and `GITHUB_TOKEN` environment\n * variables if `token` is not provided.\n */\ninterface GitHubAppAuth {\n type: 'gitHubApp';\n token?: string;\n}\n\ninterface PushParameters {\n /**\n * The auth mechanism for the push.\n *\n * Currently, only GitHub app tokens are supported.\n */\n auth: GitHubAppAuth;\n\n dir: string;\n\n /**\n * The reference to push to the remote.\n *\n * This may be a commit, branch or tag in the local repository.\n */\n ref: string;\n\n remote?: string;\n\n /**\n * The destination branch or tag on the remote.\n *\n * This defaults to `ref`.\n */\n remoteRef?: string;\n\n /**\n * Forcefully override any conflicts.\n *\n * This defaults to `false`.\n */\n force?: boolean;\n}\n\n/**\n * Pushes the specified `ref` from the local Git repository to a remote.\n */\nexport const push = async ({\n auth,\n dir,\n ref,\n remote,\n remoteRef,\n force,\n}: PushParameters) => {\n const { owner, repo } = await getOwnerAndRepo({ dir });\n\n const url = `https://github.com/${encodeURIComponent(\n owner,\n )}/${encodeURIComponent(repo)}`;\n\n return git.push({\n onAuth: () => ({\n username: 'x-access-token',\n password: auth.token ?? apiTokenFromEnvironment(),\n }),\n dir,\n fs,\n http,\n ref,\n remote,\n remoteRef,\n url,\n force,\n });\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAe;AACf,4BAAgB;AAChB,kBAAiB;AAEjB,yBAAwC;AAExC,oBAAgC;AAkDzB,MAAM,OAAO,OAAO;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAsB;AACpB,QAAM,EAAE,OAAO,KAAK,IAAI,UAAM,+BAAgB,EAAE,IAAI,CAAC;AAErD,QAAM,MAAM,sBAAsB;AAAA,IAChC;AAAA,EACF,KAAK,mBAAmB,IAAI;AAE5B,SAAO,sBAAAA,QAAI,KAAK;AAAA,IACd,QAAQ,OAAO;AAAA,MACb,UAAU;AAAA,MACV,UAAU,KAAK,aAAS,4CAAwB;AAAA,IAClD;AAAA,IACA;AAAA,IACA,oBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACH;",
6
+ "names": ["git", "fs", "http"]
7
+ }
@@ -1,65 +1,68 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
4
11
  };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getOwnerAndRepo = void 0;
7
- const fs_extra_1 = __importDefault(require("fs-extra"));
8
- const isomorphic_git_1 = __importDefault(require("isomorphic-git"));
9
- /**
10
- * Matches the owner and repository names in a GitHub repository URL.
11
- *
12
- * For example, given the following input strings:
13
- *
14
- * ```console
15
- * git@github.com:seek-oss/skuba.git
16
- * https://github.com/seek-oss/skuba.git
17
- * ```
18
- *
19
- * This pattern will produce the following matches:
20
- *
21
- * 1. seek-oss
22
- * 2. skuba
23
- */
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
24
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
+ var remote_exports = {};
26
+ __export(remote_exports, {
27
+ getOwnerAndRepo: () => getOwnerAndRepo
28
+ });
29
+ module.exports = __toCommonJS(remote_exports);
30
+ var import_fs_extra = __toESM(require("fs-extra"));
31
+ var import_isomorphic_git = __toESM(require("isomorphic-git"));
24
32
  const ownerRepoRegex = /github.com(?::|\/)(.+)\/(.+).git$/;
25
33
  const ownerAndRepoFromUrl = (url) => {
26
- const match = ownerRepoRegex.exec(url);
27
- const owner = match?.[1];
28
- const repo = match?.[2];
29
- return { owner, repo };
34
+ const match = ownerRepoRegex.exec(url);
35
+ const owner = match?.[1];
36
+ const repo = match?.[2];
37
+ return { owner, repo };
30
38
  };
31
- /**
32
- * Extracts the owner and repository names from CI environment variables,
33
- * falling back to local Git remotes.
34
- *
35
- * Currently, only GitHub repository URLs are supported:
36
- *
37
- * ```console
38
- * git@github.com:seek-oss/skuba.git
39
- * https://github.com/seek-oss/skuba.git
40
- * ```
41
- */
42
- const getOwnerAndRepo = async ({ dir, env = process.env, }) => {
43
- if (env.GITHUB_REPOSITORY) {
44
- const [owner, repo] = env.GITHUB_REPOSITORY.split('/');
45
- if (owner && repo) {
46
- return { owner, repo };
47
- }
39
+ const getOwnerAndRepo = async ({
40
+ dir,
41
+ env = process.env
42
+ }) => {
43
+ if (env.GITHUB_REPOSITORY) {
44
+ const [owner, repo] = env.GITHUB_REPOSITORY.split("/");
45
+ if (owner && repo) {
46
+ return { owner, repo };
48
47
  }
49
- if (env.BUILDKITE_REPO) {
50
- const { owner, repo } = ownerAndRepoFromUrl(env.BUILDKITE_REPO);
51
- if (owner && repo) {
52
- return { owner, repo };
53
- }
48
+ }
49
+ if (env.BUILDKITE_REPO) {
50
+ const { owner, repo } = ownerAndRepoFromUrl(env.BUILDKITE_REPO);
51
+ if (owner && repo) {
52
+ return { owner, repo };
54
53
  }
55
- const remotes = await isomorphic_git_1.default.listRemotes({ dir, fs: fs_extra_1.default });
56
- for (const { url } of remotes) {
57
- const { owner, repo } = ownerAndRepoFromUrl(url);
58
- if (owner && repo) {
59
- return { owner, repo };
60
- }
54
+ }
55
+ const remotes = await import_isomorphic_git.default.listRemotes({ dir, fs: import_fs_extra.default });
56
+ for (const { url } of remotes) {
57
+ const { owner, repo } = ownerAndRepoFromUrl(url);
58
+ if (owner && repo) {
59
+ return { owner, repo };
61
60
  }
62
- throw new Error('Could not find a GitHub remote');
61
+ }
62
+ throw new Error("Could not find a GitHub remote");
63
63
  };
64
- exports.getOwnerAndRepo = getOwnerAndRepo;
65
- //# sourceMappingURL=remote.js.map
64
+ // Annotate the CommonJS export names for ESM import in node:
65
+ 0 && (module.exports = {
66
+ getOwnerAndRepo
67
+ });
68
+ //# sourceMappingURL=remote.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"remote.js","sourceRoot":"","sources":["../../../src/api/git/remote.ts"],"names":[],"mappings":";;;;;;AAAA,wDAA0B;AAC1B,oEAAiC;AAEjC;;;;;;;;;;;;;;GAcG;AACH,MAAM,cAAc,GAAG,mCAAmC,CAAC;AAE3D,MAAM,mBAAmB,GAAG,CAAC,GAAW,EAAE,EAAE;IAC1C,MAAM,KAAK,GAAG,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAEvC,MAAM,KAAK,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;IACzB,MAAM,IAAI,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;IAExB,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AACzB,CAAC,CAAC;AAOF;;;;;;;;;;GAUG;AACI,MAAM,eAAe,GAAG,KAAK,EAAE,EACpC,GAAG,EACH,GAAG,GAAG,OAAO,CAAC,GAAG,GACS,EAA4C,EAAE;IACxE,IAAI,GAAG,CAAC,iBAAiB,EAAE;QACzB,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,GAAG,CAAC,iBAAiB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAEvD,IAAI,KAAK,IAAI,IAAI,EAAE;YACjB,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;SACxB;KACF;IAED,IAAI,GAAG,CAAC,cAAc,EAAE;QACtB,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,mBAAmB,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;QAEhE,IAAI,KAAK,IAAI,IAAI,EAAE;YACjB,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;SACxB;KACF;IAED,MAAM,OAAO,GAAG,MAAM,wBAAG,CAAC,WAAW,CAAC,EAAE,GAAG,EAAE,EAAE,EAAF,kBAAE,EAAE,CAAC,CAAC;IAEnD,KAAK,MAAM,EAAE,GAAG,EAAE,IAAI,OAAO,EAAE;QAC7B,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC;QAEjD,IAAI,KAAK,IAAI,IAAI,EAAE;YACjB,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;SACxB;KACF;IAED,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;AACpD,CAAC,CAAC;AA/BW,QAAA,eAAe,mBA+B1B"}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/api/git/remote.ts"],
4
+ "sourcesContent": ["import fs from 'fs-extra';\nimport git from 'isomorphic-git';\n\n/**\n * Matches the owner and repository names in a GitHub repository URL.\n *\n * For example, given the following input strings:\n *\n * ```console\n * git@github.com:seek-oss/skuba.git\n * https://github.com/seek-oss/skuba.git\n * ```\n *\n * This pattern will produce the following matches:\n *\n * 1. seek-oss\n * 2. skuba\n */\nconst ownerRepoRegex = /github.com(?::|\\/)(.+)\\/(.+).git$/;\n\nconst ownerAndRepoFromUrl = (url: string) => {\n const match = ownerRepoRegex.exec(url);\n\n const owner = match?.[1];\n const repo = match?.[2];\n\n return { owner, repo };\n};\n\ninterface GetOwnerAndRepoParameters {\n dir: string;\n env?: Record<string, string | undefined>;\n}\n\n/**\n * Extracts the owner and repository names from CI environment variables,\n * falling back to local Git remotes.\n *\n * Currently, only GitHub repository URLs are supported:\n *\n * ```console\n * git@github.com:seek-oss/skuba.git\n * https://github.com/seek-oss/skuba.git\n * ```\n */\nexport const getOwnerAndRepo = async ({\n dir,\n env = process.env,\n}: GetOwnerAndRepoParameters): Promise<{ owner: string; repo: string }> => {\n if (env.GITHUB_REPOSITORY) {\n const [owner, repo] = env.GITHUB_REPOSITORY.split('/');\n\n if (owner && repo) {\n return { owner, repo };\n }\n }\n\n if (env.BUILDKITE_REPO) {\n const { owner, repo } = ownerAndRepoFromUrl(env.BUILDKITE_REPO);\n\n if (owner && repo) {\n return { owner, repo };\n }\n }\n\n const remotes = await git.listRemotes({ dir, fs });\n\n for (const { url } of remotes) {\n const { owner, repo } = ownerAndRepoFromUrl(url);\n\n if (owner && repo) {\n return { owner, repo };\n }\n }\n\n throw new Error('Could not find a GitHub remote');\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAe;AACf,4BAAgB;AAiBhB,MAAM,iBAAiB;AAEvB,MAAM,sBAAsB,CAAC,QAAgB;AAC3C,QAAM,QAAQ,eAAe,KAAK,GAAG;AAErC,QAAM,QAAQ,QAAQ;AACtB,QAAM,OAAO,QAAQ;AAErB,SAAO,EAAE,OAAO,KAAK;AACvB;AAkBO,MAAM,kBAAkB,OAAO;AAAA,EACpC;AAAA,EACA,MAAM,QAAQ;AAChB,MAA2E;AACzE,MAAI,IAAI,mBAAmB;AACzB,UAAM,CAAC,OAAO,IAAI,IAAI,IAAI,kBAAkB,MAAM,GAAG;AAErD,QAAI,SAAS,MAAM;AACjB,aAAO,EAAE,OAAO,KAAK;AAAA,IACvB;AAAA,EACF;AAEA,MAAI,IAAI,gBAAgB;AACtB,UAAM,EAAE,OAAO,KAAK,IAAI,oBAAoB,IAAI,cAAc;AAE9D,QAAI,SAAS,MAAM;AACjB,aAAO,EAAE,OAAO,KAAK;AAAA,IACvB;AAAA,EACF;AAEA,QAAM,UAAU,MAAM,sBAAAA,QAAI,YAAY,EAAE,KAAK,oBAAAC,QAAG,CAAC;AAEjD,aAAW,EAAE,IAAI,KAAK,SAAS;AAC7B,UAAM,EAAE,OAAO,KAAK,IAAI,oBAAoB,GAAG;AAE/C,QAAI,SAAS,MAAM;AACjB,aAAO,EAAE,OAAO,KAAK;AAAA,IACvB;AAAA,EACF;AAEA,QAAM,IAAI,MAAM,gCAAgC;AAClD;",
6
+ "names": ["git", "fs"]
7
+ }
@@ -1,30 +1,58 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
4
11
  };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.reset = void 0;
7
- const path_1 = __importDefault(require("path"));
8
- const fs_extra_1 = __importDefault(require("fs-extra"));
9
- const isomorphic_git_1 = __importDefault(require("isomorphic-git"));
10
- const statusMatrix_1 = require("./statusMatrix");
11
- /**
12
- * Resets the specified branch in the local Git repository to a particular
13
- * commit.
14
- */
15
- const reset = async ({ dir, branch, commitId, hard, }) => {
16
- await fs_extra_1.default.promises.writeFile(path_1.default.join(dir, '.git/refs/heads', branch), `${commitId}\n`);
17
- if (hard) {
18
- const allFiles = await isomorphic_git_1.default.statusMatrix({ dir, fs: fs_extra_1.default });
19
- // Get all files which have been modified or staged - does not include new untracked files or deleted files
20
- const modifiedFiles = allFiles
21
- .filter((row) => row[statusMatrix_1.WORKDIR] > statusMatrix_1.UNMODIFIED && row[statusMatrix_1.STAGE] > statusMatrix_1.UNMODIFIED)
22
- .map((row) => row[statusMatrix_1.FILEPATH]);
23
- // Delete modified/staged files
24
- await Promise.all(modifiedFiles.map((filePath) => fs_extra_1.default.promises.rm(filePath)));
25
- // This will bring in the unmodified versions of files plus any files which were deleted
26
- await isomorphic_git_1.default.checkout({ dir, fs: fs_extra_1.default, ref: branch, force: true });
27
- }
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
28
19
  };
29
- exports.reset = reset;
30
- //# sourceMappingURL=reset.js.map
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
24
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
+ var reset_exports = {};
26
+ __export(reset_exports, {
27
+ reset: () => reset
28
+ });
29
+ module.exports = __toCommonJS(reset_exports);
30
+ var import_path = __toESM(require("path"));
31
+ var import_fs_extra = __toESM(require("fs-extra"));
32
+ var import_isomorphic_git = __toESM(require("isomorphic-git"));
33
+ var import_statusMatrix = require("./statusMatrix");
34
+ const reset = async ({
35
+ dir,
36
+ branch,
37
+ commitId,
38
+ hard
39
+ }) => {
40
+ await import_fs_extra.default.promises.writeFile(
41
+ import_path.default.join(dir, ".git/refs/heads", branch),
42
+ `${commitId}
43
+ `
44
+ );
45
+ if (hard) {
46
+ const allFiles = await import_isomorphic_git.default.statusMatrix({ dir, fs: import_fs_extra.default });
47
+ const modifiedFiles = allFiles.filter((row) => row[import_statusMatrix.WORKDIR] > import_statusMatrix.UNMODIFIED && row[import_statusMatrix.STAGE] > import_statusMatrix.UNMODIFIED).map((row) => row[import_statusMatrix.FILEPATH]);
48
+ await Promise.all(
49
+ modifiedFiles.map((filePath) => import_fs_extra.default.promises.rm(filePath))
50
+ );
51
+ await import_isomorphic_git.default.checkout({ dir, fs: import_fs_extra.default, ref: branch, force: true });
52
+ }
53
+ };
54
+ // Annotate the CommonJS export names for ESM import in node:
55
+ 0 && (module.exports = {
56
+ reset
57
+ });
58
+ //# sourceMappingURL=reset.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"reset.js","sourceRoot":"","sources":["../../../src/api/git/reset.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,wDAA0B;AAC1B,oEAAiC;AAEjC,iDAAsE;AAStE;;;GAGG;AACI,MAAM,KAAK,GAAG,KAAK,EAAE,EAC1B,GAAG,EACH,MAAM,EACN,QAAQ,EACR,IAAI,GACY,EAAiB,EAAE;IACnC,MAAM,kBAAE,CAAC,QAAQ,CAAC,SAAS,CACzB,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,iBAAiB,EAAE,MAAM,CAAC,EACzC,GAAG,QAAQ,IAAI,CAChB,CAAC;IAEF,IAAI,IAAI,EAAE;QACR,MAAM,QAAQ,GAAG,MAAM,wBAAG,CAAC,YAAY,CAAC,EAAE,GAAG,EAAE,EAAE,EAAF,kBAAE,EAAE,CAAC,CAAC;QACrD,2GAA2G;QAC3G,MAAM,aAAa,GAAG,QAAQ;aAC3B,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,sBAAO,CAAC,GAAG,yBAAU,IAAI,GAAG,CAAC,oBAAK,CAAC,GAAG,yBAAU,CAAC;aACrE,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,uBAAQ,CAAC,CAAC,CAAC;QAE/B,+BAA+B;QAC/B,MAAM,OAAO,CAAC,GAAG,CACf,aAAa,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,kBAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAC1D,CAAC;QAEF,wFAAwF;QACxF,MAAM,wBAAG,CAAC,QAAQ,CAAC,EAAE,GAAG,EAAE,EAAE,EAAF,kBAAE,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;KAC3D;AACH,CAAC,CAAC;AA1BW,QAAA,KAAK,SA0BhB"}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/api/git/reset.ts"],
4
+ "sourcesContent": ["import path from 'path';\n\nimport fs from 'fs-extra';\nimport git from 'isomorphic-git';\n\nimport { FILEPATH, STAGE, UNMODIFIED, WORKDIR } from './statusMatrix';\n\ninterface ResetParameters {\n dir: string;\n branch: string;\n commitId: string;\n hard?: boolean;\n}\n\n/**\n * Resets the specified branch in the local Git repository to a particular\n * commit.\n */\nexport const reset = async ({\n dir,\n branch,\n commitId,\n hard,\n}: ResetParameters): Promise<void> => {\n await fs.promises.writeFile(\n path.join(dir, '.git/refs/heads', branch),\n `${commitId}\\n`,\n );\n\n if (hard) {\n const allFiles = await git.statusMatrix({ dir, fs });\n // Get all files which have been modified or staged - does not include new untracked files or deleted files\n const modifiedFiles = allFiles\n .filter((row) => row[WORKDIR] > UNMODIFIED && row[STAGE] > UNMODIFIED)\n .map((row) => row[FILEPATH]);\n\n // Delete modified/staged files\n await Promise.all(\n modifiedFiles.map((filePath) => fs.promises.rm(filePath)),\n );\n\n // This will bring in the unmodified versions of files plus any files which were deleted\n await git.checkout({ dir, fs, ref: branch, force: true });\n }\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,sBAAe;AACf,4BAAgB;AAEhB,0BAAqD;AAa9C,MAAM,QAAQ,OAAO;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAsC;AACpC,QAAM,gBAAAA,QAAG,SAAS;AAAA,IAChB,YAAAC,QAAK,KAAK,KAAK,mBAAmB,MAAM;AAAA,IACxC,GAAG;AAAA;AAAA,EACL;AAEA,MAAI,MAAM;AACR,UAAM,WAAW,MAAM,sBAAAC,QAAI,aAAa,EAAE,KAAK,oBAAAF,QAAG,CAAC;AAEnD,UAAM,gBAAgB,SACnB,OAAO,CAAC,QAAQ,IAAI,+BAAW,kCAAc,IAAI,6BAAS,8BAAU,EACpE,IAAI,CAAC,QAAQ,IAAI,6BAAS;AAG7B,UAAM,QAAQ;AAAA,MACZ,cAAc,IAAI,CAAC,aAAa,gBAAAA,QAAG,SAAS,GAAG,QAAQ,CAAC;AAAA,IAC1D;AAGA,UAAM,sBAAAE,QAAI,SAAS,EAAE,KAAK,oBAAAF,SAAI,KAAK,QAAQ,OAAO,KAAK,CAAC;AAAA,EAC1D;AACF;",
6
+ "names": ["fs", "path", "git"]
7
+ }
@@ -1,14 +1,47 @@
1
1
  "use strict";
2
- // Based off https://isomorphic-git.org/docs/en/statusMatrix.html
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.MODIFIED = exports.UNMODIFIED = exports.ABSENT = exports.STAGE = exports.WORKDIR = exports.HEAD = exports.FILEPATH = void 0;
5
- // Status matrix row indexes
6
- exports.FILEPATH = 0;
7
- exports.HEAD = 1;
8
- exports.WORKDIR = 2;
9
- exports.STAGE = 3;
10
- // Status matrix state
11
- exports.ABSENT = 0;
12
- exports.UNMODIFIED = 1;
13
- exports.MODIFIED = 2;
14
- //# sourceMappingURL=statusMatrix.js.map
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var statusMatrix_exports = {};
20
+ __export(statusMatrix_exports, {
21
+ ABSENT: () => ABSENT,
22
+ FILEPATH: () => FILEPATH,
23
+ HEAD: () => HEAD,
24
+ MODIFIED: () => MODIFIED,
25
+ STAGE: () => STAGE,
26
+ UNMODIFIED: () => UNMODIFIED,
27
+ WORKDIR: () => WORKDIR
28
+ });
29
+ module.exports = __toCommonJS(statusMatrix_exports);
30
+ const FILEPATH = 0;
31
+ const HEAD = 1;
32
+ const WORKDIR = 2;
33
+ const STAGE = 3;
34
+ const ABSENT = 0;
35
+ const UNMODIFIED = 1;
36
+ const MODIFIED = 2;
37
+ // Annotate the CommonJS export names for ESM import in node:
38
+ 0 && (module.exports = {
39
+ ABSENT,
40
+ FILEPATH,
41
+ HEAD,
42
+ MODIFIED,
43
+ STAGE,
44
+ UNMODIFIED,
45
+ WORKDIR
46
+ });
47
+ //# sourceMappingURL=statusMatrix.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"statusMatrix.js","sourceRoot":"","sources":["../../../src/api/git/statusMatrix.ts"],"names":[],"mappings":";AAAA,iEAAiE;;;AAEjE,4BAA4B;AACf,QAAA,QAAQ,GAAG,CAAC,CAAC;AACb,QAAA,IAAI,GAAG,CAAC,CAAC;AACT,QAAA,OAAO,GAAG,CAAC,CAAC;AACZ,QAAA,KAAK,GAAG,CAAC,CAAC;AAEvB,sBAAsB;AACT,QAAA,MAAM,GAAG,CAAC,CAAC;AACX,QAAA,UAAU,GAAG,CAAC,CAAC;AACf,QAAA,QAAQ,GAAG,CAAC,CAAC"}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/api/git/statusMatrix.ts"],
4
+ "sourcesContent": ["// Based off https://isomorphic-git.org/docs/en/statusMatrix.html\n\n// Status matrix row indexes\nexport const FILEPATH = 0;\nexport const HEAD = 1;\nexport const WORKDIR = 2;\nexport const STAGE = 3;\n\n// Status matrix state\nexport const ABSENT = 0;\nexport const UNMODIFIED = 1;\nexport const MODIFIED = 2;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGO,MAAM,WAAW;AACjB,MAAM,OAAO;AACb,MAAM,UAAU;AAChB,MAAM,QAAQ;AAGd,MAAM,SAAS;AACf,MAAM,aAAa;AACnB,MAAM,WAAW;",
6
+ "names": []
7
+ }
@@ -1,86 +1,77 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
24
19
  };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.createCheckRun = void 0;
27
- const rest_1 = require("@octokit/rest");
28
- const logging_1 = require("../../utils/logging");
29
- const Git = __importStar(require("../git"));
30
- const environment_1 = require("./environment");
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
24
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
+ var checkRun_exports = {};
26
+ __export(checkRun_exports, {
27
+ createCheckRun: () => createCheckRun
28
+ });
29
+ module.exports = __toCommonJS(checkRun_exports);
30
+ var import_rest = require("@octokit/rest");
31
+ var import_logging = require("../../utils/logging");
32
+ var Git = __toESM(require("../git"));
33
+ var import_environment = require("./environment");
31
34
  const GITHUB_MAX_ANNOTATIONS = 50;
32
- /**
33
- * Suffixes the title with the number of annotations added, e.g.
34
- *
35
- * ```text
36
- * Build #12 failed (24 annotations added)
37
- * ```
38
- */
39
35
  const suffixTitle = (title, inputAnnotations) => {
40
- const addedAnnotations = inputAnnotations > GITHUB_MAX_ANNOTATIONS
41
- ? GITHUB_MAX_ANNOTATIONS
42
- : inputAnnotations;
43
- return `${title} (${(0, logging_1.pluralise)(addedAnnotations, 'annotation')} added)`;
36
+ const addedAnnotations = inputAnnotations > GITHUB_MAX_ANNOTATIONS ? GITHUB_MAX_ANNOTATIONS : inputAnnotations;
37
+ return `${title} (${(0, import_logging.pluralise)(addedAnnotations, "annotation")} added)`;
44
38
  };
45
- /**
46
- * Enriches the summary with more context about the check run.
47
- */
48
39
  const createEnrichedSummary = (summary, inputAnnotations) => [
49
- summary,
50
- ...(inputAnnotations > GITHUB_MAX_ANNOTATIONS
51
- ? [
52
- `${inputAnnotations} annotations were provided, but only the first ${GITHUB_MAX_ANNOTATIONS} are visible in GitHub.`,
53
- ]
54
- : []),
55
- ].join('\n\n');
56
- /**
57
- * Asynchronously creates a GitHub check run with annotations.
58
- *
59
- * The first 50 `annotations` are written in full to GitHub.
60
- *
61
- * A `GITHUB_API_TOKEN` or `GITHUB_TOKEN` with the `checks:write` permission
62
- * must be present on the environment.
63
- */
64
- const createCheckRun = async ({ annotations, conclusion, name, summary, text, title, }) => {
65
- const dir = process.cwd();
66
- const [commitId, { owner, repo }] = await Promise.all([
67
- Git.getHeadCommitId({ dir }),
68
- Git.getOwnerAndRepo({ dir }),
69
- ]);
70
- const client = new rest_1.Octokit({ auth: (0, environment_1.apiTokenFromEnvironment)() });
71
- await client.checks.create({
72
- conclusion,
73
- head_sha: commitId,
74
- name,
75
- output: {
76
- annotations: annotations.slice(0, GITHUB_MAX_ANNOTATIONS),
77
- summary: createEnrichedSummary(summary, annotations.length),
78
- text,
79
- title: suffixTitle(title, annotations.length),
80
- },
81
- owner,
82
- repo,
83
- });
40
+ summary,
41
+ ...inputAnnotations > GITHUB_MAX_ANNOTATIONS ? [
42
+ `${inputAnnotations} annotations were provided, but only the first ${GITHUB_MAX_ANNOTATIONS} are visible in GitHub.`
43
+ ] : []
44
+ ].join("\n\n");
45
+ const createCheckRun = async ({
46
+ annotations,
47
+ conclusion,
48
+ name,
49
+ summary,
50
+ text,
51
+ title
52
+ }) => {
53
+ const dir = process.cwd();
54
+ const [commitId, { owner, repo }] = await Promise.all([
55
+ Git.getHeadCommitId({ dir }),
56
+ Git.getOwnerAndRepo({ dir })
57
+ ]);
58
+ const client = new import_rest.Octokit({ auth: (0, import_environment.apiTokenFromEnvironment)() });
59
+ await client.checks.create({
60
+ conclusion,
61
+ head_sha: commitId,
62
+ name,
63
+ output: {
64
+ annotations: annotations.slice(0, GITHUB_MAX_ANNOTATIONS),
65
+ summary: createEnrichedSummary(summary, annotations.length),
66
+ text,
67
+ title: suffixTitle(title, annotations.length)
68
+ },
69
+ owner,
70
+ repo
71
+ });
84
72
  };
85
- exports.createCheckRun = createCheckRun;
86
- //# sourceMappingURL=checkRun.js.map
73
+ // Annotate the CommonJS export names for ESM import in node:
74
+ 0 && (module.exports = {
75
+ createCheckRun
76
+ });
77
+ //# sourceMappingURL=checkRun.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"checkRun.js","sourceRoot":"","sources":["../../../src/api/github/checkRun.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wCAAwC;AAGxC,iDAAgD;AAChD,4CAA8B;AAE9B,+CAAwD;AAQxD,MAAM,sBAAsB,GAAG,EAAE,CAAC;AAElC;;;;;;GAMG;AACH,MAAM,WAAW,GAAG,CAAC,KAAa,EAAE,gBAAwB,EAAU,EAAE;IACtE,MAAM,gBAAgB,GACpB,gBAAgB,GAAG,sBAAsB;QACvC,CAAC,CAAC,sBAAsB;QACxB,CAAC,CAAC,gBAAgB,CAAC;IAEvB,OAAO,GAAG,KAAK,KAAK,IAAA,mBAAS,EAAC,gBAAgB,EAAE,YAAY,CAAC,SAAS,CAAC;AACzE,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,qBAAqB,GAAG,CAC5B,OAAe,EACf,gBAAwB,EAChB,EAAE,CACV;IACE,OAAO;IACP,GAAG,CAAC,gBAAgB,GAAG,sBAAsB;QAC3C,CAAC,CAAC;YACE,GAAG,gBAAgB,kDAAkD,sBAAsB,yBAAyB;SACrH;QACH,CAAC,CAAC,EAAE,CAAC;CACR,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAuCjB;;;;;;;GAOG;AACI,MAAM,cAAc,GAAG,KAAK,EAAE,EACnC,WAAW,EACX,UAAU,EACV,IAAI,EACJ,OAAO,EACP,IAAI,EACJ,KAAK,GACoB,EAAiB,EAAE;IAC5C,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAE1B,MAAM,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QACpD,GAAG,CAAC,eAAe,CAAC,EAAE,GAAG,EAAE,CAAC;QAC5B,GAAG,CAAC,eAAe,CAAC,EAAE,GAAG,EAAE,CAAC;KAC7B,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,IAAI,cAAO,CAAC,EAAE,IAAI,EAAE,IAAA,qCAAuB,GAAE,EAAE,CAAC,CAAC;IAEhE,MAAM,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;QACzB,UAAU;QACV,QAAQ,EAAE,QAAQ;QAClB,IAAI;QACJ,MAAM,EAAE;YACN,WAAW,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,sBAAsB,CAAC;YACzD,OAAO,EAAE,qBAAqB,CAAC,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC;YAC3D,IAAI;YACJ,KAAK,EAAE,WAAW,CAAC,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC;SAC9C;QACD,KAAK;QACL,IAAI;KACL,CAAC,CAAC;AACL,CAAC,CAAC;AA9BW,QAAA,cAAc,kBA8BzB"}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/api/github/checkRun.ts"],
4
+ "sourcesContent": ["import { Octokit } from '@octokit/rest';\nimport type { Endpoints } from '@octokit/types';\n\nimport { pluralise } from '../../utils/logging';\nimport * as Git from '../git';\n\nimport { apiTokenFromEnvironment } from './environment';\n\ntype Output = NonNullable<\n Endpoints['POST /repos/{owner}/{repo}/check-runs']['parameters']['output']\n>;\n\nexport type Annotation = NonNullable<Output['annotations']>[number];\n\nconst GITHUB_MAX_ANNOTATIONS = 50;\n\n/**\n * Suffixes the title with the number of annotations added, e.g.\n *\n * ```text\n * Build #12 failed (24 annotations added)\n * ```\n */\nconst suffixTitle = (title: string, inputAnnotations: number): string => {\n const addedAnnotations =\n inputAnnotations > GITHUB_MAX_ANNOTATIONS\n ? GITHUB_MAX_ANNOTATIONS\n : inputAnnotations;\n\n return `${title} (${pluralise(addedAnnotations, 'annotation')} added)`;\n};\n\n/**\n * Enriches the summary with more context about the check run.\n */\nconst createEnrichedSummary = (\n summary: string,\n inputAnnotations: number,\n): string =>\n [\n summary,\n ...(inputAnnotations > GITHUB_MAX_ANNOTATIONS\n ? [\n `${inputAnnotations} annotations were provided, but only the first ${GITHUB_MAX_ANNOTATIONS} are visible in GitHub.`,\n ]\n : []),\n ].join('\\n\\n');\n\n/**\n * {@link https://docs.github.com/en/rest/reference/checks#create-a-check-run}\n */\ninterface CreateCheckRunParameters {\n /**\n * Adds information from your analysis to specific lines of code.\n * Annotations are visible on GitHub in the **Checks** and **Files changed**\n * tab of the pull request.\n */\n annotations: Annotation[];\n\n /**\n * The final conclusion of the check.\n */\n conclusion: 'failure' | 'success';\n\n /**\n * The name of the check. For example, \"code-coverage\".\n */\n name: string;\n\n /**\n * The summary of the check run. This parameter supports Markdown.\n */\n summary: string;\n\n /**\n * The details of the check run. This parameter supports Markdown.\n */\n text?: string;\n\n /**\n * The title of the check run.\n */\n title: string;\n}\n\n/**\n * Asynchronously creates a GitHub check run with annotations.\n *\n * The first 50 `annotations` are written in full to GitHub.\n *\n * A `GITHUB_API_TOKEN` or `GITHUB_TOKEN` with the `checks:write` permission\n * must be present on the environment.\n */\nexport const createCheckRun = async ({\n annotations,\n conclusion,\n name,\n summary,\n text,\n title,\n}: CreateCheckRunParameters): Promise<void> => {\n const dir = process.cwd();\n\n const [commitId, { owner, repo }] = await Promise.all([\n Git.getHeadCommitId({ dir }),\n Git.getOwnerAndRepo({ dir }),\n ]);\n\n const client = new Octokit({ auth: apiTokenFromEnvironment() });\n\n await client.checks.create({\n conclusion,\n head_sha: commitId,\n name,\n output: {\n annotations: annotations.slice(0, GITHUB_MAX_ANNOTATIONS),\n summary: createEnrichedSummary(summary, annotations.length),\n text,\n title: suffixTitle(title, annotations.length),\n },\n owner,\n repo,\n });\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAwB;AAGxB,qBAA0B;AAC1B,UAAqB;AAErB,yBAAwC;AAQxC,MAAM,yBAAyB;AAS/B,MAAM,cAAc,CAAC,OAAe,qBAAqC;AACvE,QAAM,mBACJ,mBAAmB,yBACf,yBACA;AAEN,SAAO,GAAG,cAAU,0BAAU,kBAAkB,YAAY;AAC9D;AAKA,MAAM,wBAAwB,CAC5B,SACA,qBAEA;AAAA,EACE;AAAA,EACA,GAAI,mBAAmB,yBACnB;AAAA,IACE,GAAG,kEAAkE;AAAA,EACvE,IACA,CAAC;AACP,EAAE,KAAK,MAAM;AA+CR,MAAM,iBAAiB,OAAO;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAA+C;AAC7C,QAAM,MAAM,QAAQ,IAAI;AAExB,QAAM,CAAC,UAAU,EAAE,OAAO,KAAK,CAAC,IAAI,MAAM,QAAQ,IAAI;AAAA,IACpD,IAAI,gBAAgB,EAAE,IAAI,CAAC;AAAA,IAC3B,IAAI,gBAAgB,EAAE,IAAI,CAAC;AAAA,EAC7B,CAAC;AAED,QAAM,SAAS,IAAI,oBAAQ,EAAE,UAAM,4CAAwB,EAAE,CAAC;AAE9D,QAAM,OAAO,OAAO,OAAO;AAAA,IACzB;AAAA,IACA,UAAU;AAAA,IACV;AAAA,IACA,QAAQ;AAAA,MACN,aAAa,YAAY,MAAM,GAAG,sBAAsB;AAAA,MACxD,SAAS,sBAAsB,SAAS,YAAY,MAAM;AAAA,MAC1D;AAAA,MACA,OAAO,YAAY,OAAO,YAAY,MAAM;AAAA,IAC9C;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACH;",
6
+ "names": []
7
+ }
@@ -1,37 +1,44 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.apiTokenFromEnvironment = exports.enabledFromEnvironment = exports.buildNameFromEnvironment = void 0;
4
- const env_1 = require("../../utils/env");
5
- /**
6
- * Returns the name of the build as seen in GitHub status checks.
7
- *
8
- * This is driven off of environment variables and falls back to `Build`.
9
- */
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var environment_exports = {};
20
+ __export(environment_exports, {
21
+ apiTokenFromEnvironment: () => apiTokenFromEnvironment,
22
+ buildNameFromEnvironment: () => buildNameFromEnvironment,
23
+ enabledFromEnvironment: () => enabledFromEnvironment
24
+ });
25
+ module.exports = __toCommonJS(environment_exports);
26
+ var import_env = require("../../utils/env");
10
27
  const buildNameFromEnvironment = (env = process.env) => {
11
- if (env.BUILDKITE_BUILD_NUMBER) {
12
- return `Build #${env.BUILDKITE_BUILD_NUMBER}`;
13
- }
14
- if (env.GITHUB_RUN_NUMBER) {
15
- return `${env.GITHUB_WORKFLOW ?? 'Build'} #${env.GITHUB_RUN_NUMBER}`;
16
- }
17
- return 'Build';
28
+ if (env.BUILDKITE_BUILD_NUMBER) {
29
+ return `Build #${env.BUILDKITE_BUILD_NUMBER}`;
30
+ }
31
+ if (env.GITHUB_RUN_NUMBER) {
32
+ return `${env.GITHUB_WORKFLOW ?? "Build"} #${env.GITHUB_RUN_NUMBER}`;
33
+ }
34
+ return "Build";
18
35
  };
19
- exports.buildNameFromEnvironment = buildNameFromEnvironment;
20
- /**
21
- * Whether GitHub API interactions should be enabled.
22
- *
23
- * This checks environment variables to see if the code is executing in a CI
24
- * environment and has access to a GitHub API token.
25
- */
26
- const enabledFromEnvironment = (env = process.env) =>
27
- // Running in a CI environment.
28
- (0, env_1.isCiEnv)(env) &&
29
- // Has an API token at the ready.
30
- Boolean((0, exports.apiTokenFromEnvironment)(env));
31
- exports.enabledFromEnvironment = enabledFromEnvironment;
32
- /**
33
- * Tries to return a GitHub API token from the environment.
34
- */
36
+ const enabledFromEnvironment = (env = process.env) => (0, import_env.isCiEnv)(env) && Boolean(apiTokenFromEnvironment(env));
35
37
  const apiTokenFromEnvironment = (env = process.env) => env.GITHUB_API_TOKEN ?? env.GITHUB_TOKEN;
36
- exports.apiTokenFromEnvironment = apiTokenFromEnvironment;
37
- //# sourceMappingURL=environment.js.map
38
+ // Annotate the CommonJS export names for ESM import in node:
39
+ 0 && (module.exports = {
40
+ apiTokenFromEnvironment,
41
+ buildNameFromEnvironment,
42
+ enabledFromEnvironment
43
+ });
44
+ //# sourceMappingURL=environment.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"environment.js","sourceRoot":"","sources":["../../../src/api/github/environment.ts"],"names":[],"mappings":";;;AAAA,yCAA0C;AAE1C;;;;GAIG;AACI,MAAM,wBAAwB,GAAG,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,EAAU,EAAE;IACpE,IAAI,GAAG,CAAC,sBAAsB,EAAE;QAC9B,OAAO,UAAU,GAAG,CAAC,sBAAsB,EAAE,CAAC;KAC/C;IAED,IAAI,GAAG,CAAC,iBAAiB,EAAE;QACzB,OAAO,GAAG,GAAG,CAAC,eAAe,IAAI,OAAO,KAAK,GAAG,CAAC,iBAAiB,EAAE,CAAC;KACtE;IAED,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAVW,QAAA,wBAAwB,4BAUnC;AAEF;;;;;GAKG;AACI,MAAM,sBAAsB,GAAG,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,EAAW,EAAE;AACnE,+BAA+B;AAC/B,IAAA,aAAO,EAAC,GAAG,CAAC;IACZ,iCAAiC;IACjC,OAAO,CAAC,IAAA,+BAAuB,EAAC,GAAG,CAAC,CAAC,CAAC;AAJ3B,QAAA,sBAAsB,0BAIK;AAExC;;GAEG;AACI,MAAM,uBAAuB,GAAG,CACrC,GAAG,GAAG,OAAO,CAAC,GAAG,EACG,EAAE,CAAC,GAAG,CAAC,gBAAgB,IAAI,GAAG,CAAC,YAAY,CAAC;AAFrD,QAAA,uBAAuB,2BAE8B"}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/api/github/environment.ts"],
4
+ "sourcesContent": ["import { isCiEnv } from '../../utils/env';\n\n/**\n * Returns the name of the build as seen in GitHub status checks.\n *\n * This is driven off of environment variables and falls back to `Build`.\n */\nexport const buildNameFromEnvironment = (env = process.env): string => {\n if (env.BUILDKITE_BUILD_NUMBER) {\n return `Build #${env.BUILDKITE_BUILD_NUMBER}`;\n }\n\n if (env.GITHUB_RUN_NUMBER) {\n return `${env.GITHUB_WORKFLOW ?? 'Build'} #${env.GITHUB_RUN_NUMBER}`;\n }\n\n return 'Build';\n};\n\n/**\n * Whether GitHub API interactions should be enabled.\n *\n * This checks environment variables to see if the code is executing in a CI\n * environment and has access to a GitHub API token.\n */\nexport const enabledFromEnvironment = (env = process.env): boolean =>\n // Running in a CI environment.\n isCiEnv(env) &&\n // Has an API token at the ready.\n Boolean(apiTokenFromEnvironment(env));\n\n/**\n * Tries to return a GitHub API token from the environment.\n */\nexport const apiTokenFromEnvironment = (\n env = process.env,\n): string | undefined => env.GITHUB_API_TOKEN ?? env.GITHUB_TOKEN;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAwB;AAOjB,MAAM,2BAA2B,CAAC,MAAM,QAAQ,QAAgB;AACrE,MAAI,IAAI,wBAAwB;AAC9B,WAAO,UAAU,IAAI;AAAA,EACvB;AAEA,MAAI,IAAI,mBAAmB;AACzB,WAAO,GAAG,IAAI,mBAAmB,YAAY,IAAI;AAAA,EACnD;AAEA,SAAO;AACT;AAQO,MAAM,yBAAyB,CAAC,MAAM,QAAQ,YAEnD,oBAAQ,GAAG,KAEX,QAAQ,wBAAwB,GAAG,CAAC;AAK/B,MAAM,0BAA0B,CACrC,MAAM,QAAQ,QACS,IAAI,oBAAoB,IAAI;",
6
+ "names": []
7
+ }