skuba 9.0.0-main-20240928020811 → 9.0.0-main-20240930131437

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.
@@ -29,7 +29,7 @@ const collapseDuplicateMergeKeys = async ({
29
29
  mode
30
30
  }) => {
31
31
  const buildkiteFiles = await (0, import_fast_glob.glob)(
32
- [".buildkite/**/*.yml", ".buildkite/**/*.yaml"],
32
+ ["{apps/*/,packages/*/,./}.buildkite/**/*.y*ml"],
33
33
  { onlyFiles: true }
34
34
  );
35
35
  if (buildkiteFiles.length === 0) {
@@ -57,10 +57,14 @@ const collapseDuplicateMergeKeys = async ({
57
57
  };
58
58
  const collapseDuplicateMergeKeysInFile = (input) => replaceAllUntilStable(
59
59
  input,
60
- /^([ \-]*)<<: \[?(\*[^\n\]]+)\]?$\n^( *)<<: \[?(\*[^\n\]]+)\]?$/gm,
61
- (match, a, b, c, d) => {
62
- if (a.length === c.length) {
63
- return `${a}<<: [${b}, ${d}]`;
60
+ /^([ \-]*)<<: \[?(\*[^\n#\]]+)\]?(\s*#.*)?$\n^( *)<<: \[?(\*[^\n#\]]+)\]?(\s*#.*)?$/gm,
61
+ (match, prefixA, keyA, commentA, prefixB, keyB, commentB) => {
62
+ if (prefixA.length === prefixB.length) {
63
+ return [
64
+ ...commentA ? [`${" ".repeat(prefixA.length)}${commentA.trim()}`] : [],
65
+ ...commentB ? [`${" ".repeat(prefixA.length)}${commentB.trim()}`] : [],
66
+ `${prefixA}<<: [${keyA.trim()}, ${keyB.trim()}]`
67
+ ].join("\n");
64
68
  }
65
69
  return match;
66
70
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../src/cli/lint/internalLints/upgrade/patches/8.2.1/collapseDuplicateMergeKeys.ts"],
4
- "sourcesContent": ["import { inspect } from 'util';\n\nimport { glob } from 'fast-glob';\nimport { promises as fs } from 'fs-extra';\n\nimport type { PatchFunction, PatchReturnType } from '../..';\nimport { log } from '../../../../../../utils/logging';\n\nconst collapseDuplicateMergeKeys: PatchFunction = async ({\n mode,\n}): Promise<PatchReturnType> => {\n const buildkiteFiles = await glob(\n ['.buildkite/**/*.yml', '.buildkite/**/*.yaml'],\n { onlyFiles: true },\n );\n\n if (buildkiteFiles.length === 0) {\n return { result: 'skip', reason: 'no Buildkite files found' };\n }\n\n const input = await Promise.all(\n buildkiteFiles.map((name) => fs.readFile(name, 'utf-8')),\n );\n\n const replaced = input.map(collapseDuplicateMergeKeysInFile);\n\n if (replaced.every((r, i) => r === input[i])) {\n return { result: 'skip', reason: 'no duplicate merge keys found' };\n }\n\n if (mode === 'lint') {\n return { result: 'apply' };\n }\n\n await Promise.all(\n buildkiteFiles.flatMap((name, i) =>\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n replaced[i] !== input[i] ? [fs.writeFile(name, replaced[i]!)] : [],\n ),\n );\n\n return { result: 'apply' };\n};\n\nconst collapseDuplicateMergeKeysInFile = (input: string) =>\n replaceAllUntilStable(\n input,\n /^([ \\-]*)<<: \\[?(\\*[^\\n\\]]+)\\]?$\\n^( *)<<: \\[?(\\*[^\\n\\]]+)\\]?$/gm,\n (match, a, b, c, d) => {\n if (a.length === c.length) {\n return `${a}<<: [${b}, ${d}]`;\n }\n return match;\n },\n );\n\nconst replaceAllUntilStable = (\n input: string,\n searchValue: RegExp,\n replacer: (substring: string, ...args: string[]) => string,\n): string => {\n let output = input;\n let previousOutput;\n\n do {\n previousOutput = output;\n output = output.replace(searchValue, replacer);\n } while (output !== previousOutput);\n\n return output;\n};\n\nexport const tryCollapseDuplicateMergeKeys: PatchFunction = async (config) => {\n try {\n return await collapseDuplicateMergeKeys(config);\n } catch (err) {\n log.warn('Failed to collapse duplicate merge keys.');\n log.subtle(inspect(err));\n return { result: 'skip', reason: 'due to an error' };\n }\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAwB;AAExB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B;AACjB,aAAS,OAAO,QAAQ,aAAa,QAAQ;AAAA,EAC/C,SAAS,WAAW;AAEpB,SAAO;AACT;AAEO,MAAM,gCAA+C,OAAO,WAAW;AAC5E,MAAI;AACF,WAAO,MAAM,2BAA2B,MAAM;AAAA,EAChD,SAAS,KAAK;AACZ,uBAAI,KAAK,0CAA0C;AACnD,uBAAI,WAAO,qBAAQ,GAAG,CAAC;AACvB,WAAO,EAAE,QAAQ,QAAQ,QAAQ,kBAAkB;AAAA,EACrD;AACF;",
4
+ "sourcesContent": ["import { inspect } from 'util';\n\nimport { glob } from 'fast-glob';\nimport { promises as fs } from 'fs-extra';\n\nimport type { PatchFunction, PatchReturnType } from '../..';\nimport { log } from '../../../../../../utils/logging';\n\nconst collapseDuplicateMergeKeys: PatchFunction = async ({\n mode,\n}): Promise<PatchReturnType> => {\n const buildkiteFiles = await glob(\n ['{apps/*/,packages/*/,./}.buildkite/**/*.y*ml'],\n { onlyFiles: true },\n );\n\n if (buildkiteFiles.length === 0) {\n return { result: 'skip', reason: 'no Buildkite files found' };\n }\n\n const input = await Promise.all(\n buildkiteFiles.map((name) => fs.readFile(name, 'utf-8')),\n );\n\n const replaced = input.map(collapseDuplicateMergeKeysInFile);\n\n if (replaced.every((r, i) => r === input[i])) {\n return { result: 'skip', reason: 'no duplicate merge keys found' };\n }\n\n if (mode === 'lint') {\n return { result: 'apply' };\n }\n\n await Promise.all(\n buildkiteFiles.flatMap((name, i) =>\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n replaced[i] !== input[i] ? [fs.writeFile(name, replaced[i]!)] : [],\n ),\n );\n\n return { result: 'apply' };\n};\n\nconst collapseDuplicateMergeKeysInFile = (input: string) =>\n replaceAllUntilStable(\n input,\n /^([ \\-]*)<<: \\[?(\\*[^\\n#\\]]+)\\]?(\\s*#.*)?$\\n^( *)<<: \\[?(\\*[^\\n#\\]]+)\\]?(\\s*#.*)?$/gm,\n (match, prefixA, keyA, commentA, prefixB, keyB, commentB) => {\n if (prefixA.length === prefixB.length) {\n return [\n ...(commentA\n ? [`${' '.repeat(prefixA.length)}${commentA.trim()}`]\n : []),\n ...(commentB\n ? [`${' '.repeat(prefixA.length)}${commentB.trim()}`]\n : []),\n `${prefixA}<<: [${keyA.trim()}, ${keyB.trim()}]`,\n ].join('\\n');\n }\n return match;\n },\n );\n\nconst replaceAllUntilStable = (\n input: string,\n searchValue: RegExp,\n replacer: (substring: string, ...args: string[]) => string,\n): string => {\n let output = input;\n let previousOutput;\n\n do {\n previousOutput = output;\n output = output.replace(searchValue, replacer);\n } while (output !== previousOutput);\n\n return output;\n};\n\nexport const tryCollapseDuplicateMergeKeys: PatchFunction = async (config) => {\n try {\n return await collapseDuplicateMergeKeys(config);\n } catch (err) {\n log.warn('Failed to collapse duplicate merge keys.');\n log.subtle(inspect(err));\n return { result: 'skip', reason: 'due to an error' };\n }\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAwB;AAExB,uBAAqB;AACrB,sBAA+B;AAG/B,qBAAoB;AAEpB,MAAM,6BAA4C,OAAO;AAAA,EACvD;AACF,MAAgC;AAC9B,QAAM,iBAAiB,UAAM;AAAA,IAC3B,CAAC,8CAA8C;AAAA,IAC/C,EAAE,WAAW,KAAK;AAAA,EACpB;AAEA,MAAI,eAAe,WAAW,GAAG;AAC/B,WAAO,EAAE,QAAQ,QAAQ,QAAQ,2BAA2B;AAAA,EAC9D;AAEA,QAAM,QAAQ,MAAM,QAAQ;AAAA,IAC1B,eAAe,IAAI,CAAC,SAAS,gBAAAA,SAAG,SAAS,MAAM,OAAO,CAAC;AAAA,EACzD;AAEA,QAAM,WAAW,MAAM,IAAI,gCAAgC;AAE3D,MAAI,SAAS,MAAM,CAAC,GAAG,MAAM,MAAM,MAAM,CAAC,CAAC,GAAG;AAC5C,WAAO,EAAE,QAAQ,QAAQ,QAAQ,gCAAgC;AAAA,EACnE;AAEA,MAAI,SAAS,QAAQ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F;",
6
6
  "names": ["fs"]
7
7
  }
@@ -22,6 +22,7 @@ __export(__exports, {
22
22
  });
23
23
  module.exports = __toCommonJS(__exports);
24
24
  var import_collapseDuplicateMergeKeys = require("./collapseDuplicateMergeKeys");
25
+ var import_moveNpmrcMounts = require("./moveNpmrcMounts");
25
26
  var import_patchDockerCompose = require("./patchDockerCompose");
26
27
  var import_patchDockerImages = require("./patchDockerImages");
27
28
  var import_upgradeESLint = require("./upgradeESLint");
@@ -41,6 +42,10 @@ const patches = [
41
42
  {
42
43
  apply: import_patchDockerImages.tryPatchDockerImages,
43
44
  description: "Update docker image references to use public.ecr.aws and remove --platform flag"
45
+ },
46
+ {
47
+ apply: import_moveNpmrcMounts.tryMoveNpmrcMounts,
48
+ description: "Move .npmrc mounts from tmp/.npmrc to /tmp/.npmrc"
44
49
  }
45
50
  ];
46
51
  // Annotate the CommonJS export names for ESM import in node:
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../src/cli/lint/internalLints/upgrade/patches/8.2.1/index.ts"],
4
- "sourcesContent": ["import type { Patches } from '../..';\n\nimport { tryCollapseDuplicateMergeKeys } from './collapseDuplicateMergeKeys';\nimport { tryPatchDockerComposeFiles } from './patchDockerCompose';\nimport { tryPatchDockerImages } from './patchDockerImages';\nimport { tryUpgradeESLint } from './upgradeESLint';\n\nexport const patches: Patches = [\n {\n apply: tryCollapseDuplicateMergeKeys,\n description: 'Collapse duplicate merge keys in .buildkite files',\n },\n {\n apply: tryUpgradeESLint,\n description: 'Upgrade to ESLint flat config',\n },\n {\n apply: tryPatchDockerComposeFiles,\n description: 'Remove version field from docker-compose files',\n },\n {\n apply: tryPatchDockerImages,\n description:\n 'Update docker image references to use public.ecr.aws and remove --platform flag',\n },\n];\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,wCAA8C;AAC9C,gCAA2C;AAC3C,+BAAqC;AACrC,2BAAiC;AAE1B,MAAM,UAAmB;AAAA,EAC9B;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,aACE;AAAA,EACJ;AACF;",
4
+ "sourcesContent": ["import type { Patches } from '../..';\n\nimport { tryCollapseDuplicateMergeKeys } from './collapseDuplicateMergeKeys';\nimport { tryMoveNpmrcMounts } from './moveNpmrcMounts';\nimport { tryPatchDockerComposeFiles } from './patchDockerCompose';\nimport { tryPatchDockerImages } from './patchDockerImages';\nimport { tryUpgradeESLint } from './upgradeESLint';\n\nexport const patches: Patches = [\n {\n apply: tryCollapseDuplicateMergeKeys,\n description: 'Collapse duplicate merge keys in .buildkite files',\n },\n {\n apply: tryUpgradeESLint,\n description: 'Upgrade to ESLint flat config',\n },\n {\n apply: tryPatchDockerComposeFiles,\n description: 'Remove version field from docker-compose files',\n },\n {\n apply: tryPatchDockerImages,\n description:\n 'Update docker image references to use public.ecr.aws and remove --platform flag',\n },\n {\n apply: tryMoveNpmrcMounts,\n description: 'Move .npmrc mounts from tmp/.npmrc to /tmp/.npmrc',\n },\n];\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,wCAA8C;AAC9C,6BAAmC;AACnC,gCAA2C;AAC3C,+BAAqC;AACrC,2BAAiC;AAE1B,MAAM,UAAmB;AAAA,EAC9B;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,aACE;AAAA,EACJ;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AACF;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,2 @@
1
+ import type { PatchFunction } from '../..';
2
+ export declare const tryMoveNpmrcMounts: PatchFunction;
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var moveNpmrcMounts_exports = {};
20
+ __export(moveNpmrcMounts_exports, {
21
+ tryMoveNpmrcMounts: () => tryMoveNpmrcMounts
22
+ });
23
+ module.exports = __toCommonJS(moveNpmrcMounts_exports);
24
+ var import_util = require("util");
25
+ var import_fast_glob = require("fast-glob");
26
+ var import_fs_extra = require("fs-extra");
27
+ var import_logging = require("../../../../../../utils/logging");
28
+ const moveNpmrcMounts = async ({
29
+ mode
30
+ }) => {
31
+ const buildkiteFiles = await (0, import_fast_glob.glob)(
32
+ ["{apps/*/,packages/*/,./}.buildkite/**/*.y*ml"],
33
+ { onlyFiles: true }
34
+ );
35
+ if (buildkiteFiles.length === 0) {
36
+ return { result: "skip", reason: "no Buildkite files found" };
37
+ }
38
+ const input = await Promise.all(
39
+ buildkiteFiles.map((name) => import_fs_extra.promises.readFile(name, "utf-8"))
40
+ );
41
+ const replaced = input.map(moveNpmrcMountsInFile);
42
+ if (replaced.every((r, i) => r === input[i])) {
43
+ return {
44
+ result: "skip",
45
+ reason: "no .npmrc mounts found need to be updated"
46
+ };
47
+ }
48
+ if (mode === "lint") {
49
+ return { result: "apply" };
50
+ }
51
+ await Promise.all(
52
+ buildkiteFiles.flatMap(
53
+ (name, i) => (
54
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
55
+ replaced[i] !== input[i] ? [import_fs_extra.promises.writeFile(name, replaced[i])] : []
56
+ )
57
+ )
58
+ );
59
+ return { result: "apply" };
60
+ };
61
+ const secret = /^(\s*)secrets: id=npm,src=tmp\/\.npmrc(\s*#?.*)$/gm;
62
+ const outputPath = /^(\s*)output-path: tmp\/(\s*#?.*)$/gm;
63
+ const moveNpmrcMountsInFile = (input) => {
64
+ if (!secret.test(input) || !outputPath.test(input)) {
65
+ return input;
66
+ }
67
+ return input.replaceAll(secret, "$1secrets: id=npm,src=/tmp/.npmrc$2").replaceAll(outputPath, "$1output-path: /tmp/$2");
68
+ };
69
+ const tryMoveNpmrcMounts = async (config) => {
70
+ try {
71
+ return await moveNpmrcMounts(config);
72
+ } catch (err) {
73
+ import_logging.log.warn("Failed to move .npmrc mounts");
74
+ import_logging.log.subtle((0, import_util.inspect)(err));
75
+ return { result: "skip", reason: "due to an error" };
76
+ }
77
+ };
78
+ // Annotate the CommonJS export names for ESM import in node:
79
+ 0 && (module.exports = {
80
+ tryMoveNpmrcMounts
81
+ });
82
+ //# sourceMappingURL=moveNpmrcMounts.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../src/cli/lint/internalLints/upgrade/patches/8.2.1/moveNpmrcMounts.ts"],
4
+ "sourcesContent": ["import { inspect } from 'util';\n\nimport { glob } from 'fast-glob';\nimport { promises as fs } from 'fs-extra';\n\nimport type { PatchFunction, PatchReturnType } from '../..';\nimport { log } from '../../../../../../utils/logging';\n\nconst moveNpmrcMounts: PatchFunction = async ({\n mode,\n}): Promise<PatchReturnType> => {\n const buildkiteFiles = await glob(\n ['{apps/*/,packages/*/,./}.buildkite/**/*.y*ml'],\n { onlyFiles: true },\n );\n\n if (buildkiteFiles.length === 0) {\n return { result: 'skip', reason: 'no Buildkite files found' };\n }\n\n const input = await Promise.all(\n buildkiteFiles.map((name) => fs.readFile(name, 'utf-8')),\n );\n\n const replaced = input.map(moveNpmrcMountsInFile);\n\n if (replaced.every((r, i) => r === input[i])) {\n return {\n result: 'skip',\n reason: 'no .npmrc mounts found need to be updated',\n };\n }\n\n if (mode === 'lint') {\n return { result: 'apply' };\n }\n\n await Promise.all(\n buildkiteFiles.flatMap((name, i) =>\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n replaced[i] !== input[i] ? [fs.writeFile(name, replaced[i]!)] : [],\n ),\n );\n\n return { result: 'apply' };\n};\n\nconst secret = /^(\\s*)secrets: id=npm,src=tmp\\/\\.npmrc(\\s*#?.*)$/gm;\nconst outputPath = /^(\\s*)output-path: tmp\\/(\\s*#?.*)$/gm;\n\nconst moveNpmrcMountsInFile = (input: string) => {\n if (!secret.test(input) || !outputPath.test(input)) {\n return input;\n }\n\n return input\n .replaceAll(secret, '$1secrets: id=npm,src=/tmp/.npmrc$2')\n .replaceAll(outputPath, '$1output-path: /tmp/$2');\n};\n\nexport const tryMoveNpmrcMounts: PatchFunction = async (config) => {\n try {\n return await moveNpmrcMounts(config);\n } catch (err) {\n log.warn('Failed to move .npmrc mounts');\n log.subtle(inspect(err));\n return { result: 'skip', reason: 'due to an error' };\n }\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAwB;AAExB,uBAAqB;AACrB,sBAA+B;AAG/B,qBAAoB;AAEpB,MAAM,kBAAiC,OAAO;AAAA,EAC5C;AACF,MAAgC;AAC9B,QAAM,iBAAiB,UAAM;AAAA,IAC3B,CAAC,8CAA8C;AAAA,IAC/C,EAAE,WAAW,KAAK;AAAA,EACpB;AAEA,MAAI,eAAe,WAAW,GAAG;AAC/B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": "skuba",
3
- "version": "9.0.0-main-20240928020811",
3
+ "version": "9.0.0-main-20240930131437",
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",
@@ -101,7 +101,7 @@
101
101
  "typescript": "~5.6.0",
102
102
  "validate-npm-package-name": "^6.0.0",
103
103
  "zod": "^3.22.4",
104
- "eslint-config-skuba": "5.0.0-main-20240928020811"
104
+ "eslint-config-skuba": "5.0.0-main-20240930131437"
105
105
  },
106
106
  "devDependencies": {
107
107
  "@changesets/cli": "2.27.8",
@@ -15,12 +15,12 @@ configs:
15
15
  - package.json#.packageManager
16
16
  - pnpm-lock.yaml
17
17
  dockerfile: Dockerfile.dev-deps
18
- secrets: id=npm,src=tmp/.npmrc
18
+ secrets: id=npm,src=/tmp/.npmrc
19
19
 
20
20
  - &private-npm
21
21
  seek-oss/private-npm#v1.2.0:
22
22
  env: NPM_READ_TOKEN
23
- output-path: tmp/
23
+ output-path: /tmp/
24
24
 
25
25
  base-steps:
26
26
  - &deploy
@@ -16,12 +16,12 @@ configs:
16
16
  - .npmrc
17
17
  - package.json#.packageManager
18
18
  - pnpm-lock.yaml
19
- secrets: id=npm,src=tmp/.npmrc
19
+ secrets: id=npm,src=/tmp/.npmrc
20
20
 
21
21
  - &private-npm
22
22
  seek-oss/private-npm#v1.2.0:
23
23
  env: NPM_READ_TOKEN
24
- output-path: tmp/
24
+ output-path: /tmp/
25
25
 
26
26
  steps:
27
27
  - label: 🧪 Test & Lint
@@ -17,7 +17,7 @@
17
17
  },
18
18
  "devDependencies": {
19
19
  "@types/node": "^20.9.0",
20
- "skuba": "9.0.0-main-20240928020811"
20
+ "skuba": "9.0.0-main-20240930131437"
21
21
  },
22
22
  "packageManager": "pnpm@9.11.0",
23
23
  "engines": {
@@ -15,12 +15,12 @@ configs:
15
15
  - package.json#.packageManager
16
16
  - pnpm-lock.yaml
17
17
  dockerfile: Dockerfile.dev-deps
18
- secrets: id=npm,src=tmp/.npmrc
18
+ secrets: id=npm,src=/tmp/.npmrc
19
19
 
20
20
  - &private-npm
21
21
  seek-oss/private-npm#v1.2.0:
22
22
  env: NPM_READ_TOKEN
23
- output-path: tmp/
23
+ output-path: /tmp/
24
24
 
25
25
  base-steps:
26
26
  - &deploy
@@ -13,6 +13,7 @@
13
13
  "test:watch": "skuba test --watch"
14
14
  },
15
15
  "dependencies": {
16
+ "@koa/bodyparser": "^5.1.1",
16
17
  "@koa/router": "^13.0.0",
17
18
  "@opentelemetry/api": "^1.9.0",
18
19
  "@opentelemetry/core": "^1.25.0",
@@ -24,7 +25,6 @@
24
25
  "@seek/logger": "^9.0.0",
25
26
  "hot-shots": "^10.0.0",
26
27
  "koa": "^2.13.4",
27
- "koa-bodyparser": "^4.3.0",
28
28
  "koa-compose": "^4.1.0",
29
29
  "seek-datadog-custom-metrics": "^4.6.3",
30
30
  "seek-koala": "^7.0.0",
@@ -33,8 +33,8 @@
33
33
  },
34
34
  "devDependencies": {
35
35
  "@types/chance": "^1.1.3",
36
+ "@types/co-body": "^6.1.3",
36
37
  "@types/koa": "^2.13.4",
37
- "@types/koa-bodyparser": "^5.0.2",
38
38
  "@types/koa__router": "^12.0.0",
39
39
  "@types/node": "^20.16.5",
40
40
  "@types/supertest": "^6.0.0",
@@ -1,3 +1,3 @@
1
- import bodyParser from 'koa-bodyparser';
1
+ import { bodyParser } from '@koa/bodyparser';
2
2
 
3
3
  export const jsonBodyParser = bodyParser({ enableTypes: ['json'] });
@@ -203,7 +203,6 @@ describe('createApp', () => {
203
203
 
204
204
  it('handles null error', async () => {
205
205
  middleware.mockImplementation(() => {
206
- /* eslint-disable-next-line @typescript-eslint/only-throw-error */
207
206
  throw null;
208
207
  });
209
208
 
@@ -14,12 +14,12 @@ configs:
14
14
  - .npmrc
15
15
  - package.json#.packageManager
16
16
  - pnpm-lock.yaml
17
- secrets: id=npm,src=tmp/.npmrc
17
+ secrets: id=npm,src=/tmp/.npmrc
18
18
 
19
19
  - &private-npm
20
20
  seek-oss/private-npm#v1.2.0:
21
21
  env: NPM_READ_TOKEN
22
- output-path: tmp/
22
+ output-path: /tmp/
23
23
 
24
24
  base-steps:
25
25
  - &deploy
@@ -14,12 +14,12 @@ configs:
14
14
  - .npmrc
15
15
  - package.json#.packageManager
16
16
  - pnpm-lock.yaml
17
- secrets: id=npm,src=tmp/.npmrc
17
+ secrets: id=npm,src=/tmp/.npmrc
18
18
 
19
19
  - &private-npm
20
20
  seek-oss/private-npm#v1.2.0:
21
21
  env: NPM_READ_TOKEN
22
- output-path: tmp/
22
+ output-path: /tmp/
23
23
 
24
24
  base-steps:
25
25
  - &deploy
@@ -28,7 +28,7 @@
28
28
  "aws-cdk-lib": "^2.109.0",
29
29
  "constructs": "^10.0.17",
30
30
  "pino-pretty": "^11.0.0",
31
- "skuba": "9.0.0-main-20240928020811"
31
+ "skuba": "9.0.0-main-20240930131437"
32
32
  },
33
33
  "packageManager": "pnpm@9.11.0",
34
34
  "engines": {