skuba 12.1.0-async-checks-20250803102239 → 12.1.0-conditions-20250808085844
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.
- package/README.md +1 -2
- package/config/tsconfig.json +3 -2
- package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/unhandledRejections.js +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/unhandledRejections.js.map +1 -1
- package/lib/cli/node/index.js +6 -0
- package/lib/cli/node/index.js.map +2 -2
- package/lib/cli/start/index.js +6 -0
- package/lib/cli/start/index.js.map +2 -2
- package/lib/utils/args.d.ts +2 -0
- package/lib/utils/args.js +5 -0
- package/lib/utils/args.js.map +2 -2
- package/lib/utils/tsconfig.d.ts +4 -0
- package/lib/utils/tsconfig.js +39 -0
- package/lib/utils/tsconfig.js.map +7 -0
- package/package.json +9 -9
- package/template/express-rest-api/package.json +3 -3
- package/template/greeter/package.json +1 -1
- package/template/koa-rest-api/package.json +4 -4
- package/template/koa-rest-api/src/framework/server.test.ts +0 -1
- package/template/lambda-sqs-worker-cdk/infra/__snapshots__/appStack.test.ts.snap +2 -2
- package/template/lambda-sqs-worker-cdk/infra/appStack.ts +1 -1
- package/template/lambda-sqs-worker-cdk/infra/config.ts +1 -1
- package/template/lambda-sqs-worker-cdk/package.json +2 -2
package/README.md
CHANGED
|
@@ -12,11 +12,10 @@
|
|
|
12
12
|
- Write in [TypeScript]
|
|
13
13
|
- Enforce coding standards with [ESLint] and [Prettier]
|
|
14
14
|
- Test with [Jest]
|
|
15
|
-
- Deploy with [Gantry]
|
|
15
|
+
- Deploy with [Gantry] or the [AWS CDK]
|
|
16
16
|
|
|
17
17
|
[aws cdk]: https://docs.aws.amazon.com/cdk/latest/guide/work-with-cdk-typescript.html
|
|
18
18
|
[gantry]: https://backstage.myseek.xyz/docs/default/component/gantry/
|
|
19
|
-
[serverless]: https://serverless.com/
|
|
20
19
|
|
|
21
20
|
It provides you with:
|
|
22
21
|
|
package/config/tsconfig.json
CHANGED
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
"incremental": true,
|
|
4
4
|
"isolatedModules": true,
|
|
5
5
|
"moduleResolution": "node",
|
|
6
|
-
"
|
|
6
|
+
"noUncheckedSideEffectImports": true,
|
|
7
7
|
"noUnusedLocals": false,
|
|
8
|
-
"noUnusedParameters": false
|
|
8
|
+
"noUnusedParameters": false,
|
|
9
|
+
"resolveJsonModule": true
|
|
9
10
|
},
|
|
10
11
|
"extends": "tsconfig-seek"
|
|
11
12
|
}
|
|
@@ -61,7 +61,7 @@ const tryReadFilesSequentially = async (filepaths) => {
|
|
|
61
61
|
}
|
|
62
62
|
return;
|
|
63
63
|
};
|
|
64
|
-
const IMPORT_REGEX = /import\s+(?:\{\s*(\w*[Ll]ogger)(?:\s+as\s+(\w*[Ll]ogger))?\s*\}|(\w*[Ll]ogger))\s+from\s+['"][^'"]+\/(?:logger|logging)(?:\.
|
|
64
|
+
const IMPORT_REGEX = /import\s+(?:\{\s*(\w*[Ll]ogger)(?:\s+as\s+(\w*[Ll]ogger))?\s*\}|(\w*[Ll]ogger))\s+from\s+['"][^'"]+\/(?:logger|logging)(?:\/index)?(?:\.[jt]s)?['"]/u;
|
|
65
65
|
const NAMED_EXPORT_REGEX = /export\s+(?:const\s+|\{[^{}]*)\b(\w*[Ll]ogger)\b/u;
|
|
66
66
|
const findLogger = async ({
|
|
67
67
|
contents,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../src/cli/lint/internalLints/upgrade/patches/12.0.2/unhandledRejections.ts"],
|
|
4
|
-
"sourcesContent": ["import path from 'path';\nimport { inspect } from 'util';\n\nimport { glob } from 'fast-glob';\nimport fs from 'fs-extra';\n\nimport { isErrorWithCode } from '../../../../../../utils/error.js';\nimport { log } from '../../../../../../utils/logging.js';\nimport { formatPrettier } from '../../../../../configure/processing/prettier.js';\nimport type { PatchFunction, PatchReturnType } from '../../index.js';\n\nconst addListener = (identifier: string) =>\n `\n// Report unhandled rejections instead of crashing the process\n// Make sure to monitor these reports and alert as appropriate\nprocess.on('unhandledRejection', (err) =>\n ${identifier}.error(err, 'Unhandled promise rejection'),\n);\n`.trim();\n\nconst tryReadFilesSequentially = async (\n filepaths: string[],\n): Promise<{ contents: string; filepath: string } | undefined> => {\n for (const filepath of filepaths) {\n try {\n const contents = await fs.promises.readFile(filepath, 'utf8');\n\n return { contents, filepath };\n } catch (err) {\n if (isErrorWithCode(err, 'ENOENT')) {\n continue;\n }\n\n throw err;\n }\n }\n\n return;\n};\n\nexport const IMPORT_REGEX =\n /import\\s+(?:\\{\\s*(\\w*[Ll]ogger)(?:\\s+as\\s+(\\w*[Ll]ogger))?\\s*\\}|(\\w*[Ll]ogger))\\s+from\\s+['\"][^'\"]+\\/(?:logger|logging)(?:\\.
|
|
4
|
+
"sourcesContent": ["import path from 'path';\nimport { inspect } from 'util';\n\nimport { glob } from 'fast-glob';\nimport fs from 'fs-extra';\n\nimport { isErrorWithCode } from '../../../../../../utils/error.js';\nimport { log } from '../../../../../../utils/logging.js';\nimport { formatPrettier } from '../../../../../configure/processing/prettier.js';\nimport type { PatchFunction, PatchReturnType } from '../../index.js';\n\nconst addListener = (identifier: string) =>\n `\n// Report unhandled rejections instead of crashing the process\n// Make sure to monitor these reports and alert as appropriate\nprocess.on('unhandledRejection', (err) =>\n ${identifier}.error(err, 'Unhandled promise rejection'),\n);\n`.trim();\n\nconst tryReadFilesSequentially = async (\n filepaths: string[],\n): Promise<{ contents: string; filepath: string } | undefined> => {\n for (const filepath of filepaths) {\n try {\n const contents = await fs.promises.readFile(filepath, 'utf8');\n\n return { contents, filepath };\n } catch (err) {\n if (isErrorWithCode(err, 'ENOENT')) {\n continue;\n }\n\n throw err;\n }\n }\n\n return;\n};\n\nexport const IMPORT_REGEX =\n /import\\s+(?:\\{\\s*(\\w*[Ll]ogger)(?:\\s+as\\s+(\\w*[Ll]ogger))?\\s*\\}|(\\w*[Ll]ogger))\\s+from\\s+['\"][^'\"]+\\/(?:logger|logging)(?:\\/index)?(?:\\.[jt]s)?['\"]/u;\n\nexport const NAMED_EXPORT_REGEX =\n /export\\s+(?:const\\s+|\\{[^{}]*)\\b(\\w*[Ll]ogger)\\b/u;\n\nconst findLogger = async ({\n contents,\n root,\n}: {\n contents: string;\n root: string;\n}): Promise<{ identifier: string; import?: string }> => {\n const importResult = IMPORT_REGEX.exec(contents);\n\n {\n const identifier =\n importResult?.[3] ?? importResult?.[2] ?? importResult?.[1];\n\n if (identifier) {\n return { identifier };\n }\n }\n\n const loggerPaths = await glob('**/{logger,logging}.ts', {\n cwd: root,\n ignore: ['**/.git', '**/node_modules'],\n });\n\n const loggingModule = await tryReadFilesSequentially(loggerPaths);\n\n if (!loggingModule) {\n return { identifier: 'console' };\n }\n\n const parsedPath = path.parse(path.relative(root, loggingModule.filepath));\n\n const importPath = path.join(parsedPath.dir, parsedPath.name);\n\n const namedExportResult = NAMED_EXPORT_REGEX.exec(loggingModule.contents);\n\n if (namedExportResult?.[1]) {\n const identifier = namedExportResult[1];\n\n return {\n identifier: namedExportResult[1],\n import: `import { ${identifier} } from '${importPath}';`,\n };\n }\n\n if (loggingModule.contents.includes('export default')) {\n return {\n identifier: 'logger',\n import: `import logger from '${importPath}';`,\n };\n }\n\n return { identifier: 'console' };\n};\n\nconst patchUnhandledRejections = async (\n mode: 'format' | 'lint',\n): Promise<PatchReturnType> => {\n const filepaths = await glob('**/src/listen.ts', {\n ignore: ['**/.git', '**/node_modules'],\n });\n\n let hasPatched = false;\n\n for (const filepath of filepaths) {\n const contents = await fs.promises.readFile(filepath, 'utf8');\n\n if (contents.includes('unhandledRejection')) {\n log.subtle(\n 'Skipping entry point that appears to have an unhandled rejection listener:',\n filepath,\n );\n continue;\n }\n\n const root = path.dirname(path.dirname(filepath));\n\n const logger = await findLogger({ contents, root });\n\n log.subtle(\n 'Logging unhandled rejections to',\n logger.identifier,\n 'in file:',\n filepath,\n );\n\n const patched = [\n contents,\n\n ...[logger.import ? [logger.import] : []],\n\n addListener(logger.identifier),\n ].join('\\n\\n');\n\n const newContents = await formatPrettier(patched, { parser: 'typescript' });\n\n if (mode === 'lint') {\n return { result: 'apply' };\n }\n\n await fs.promises.writeFile(filepath, newContents);\n\n hasPatched = true;\n }\n\n if (hasPatched) {\n return { result: 'apply' };\n }\n\n return {\n result: 'skip',\n reason: 'no applicable src/listen.ts entry points found',\n };\n};\n\nexport const tryPatchUnhandledRejections: PatchFunction = async ({\n mode,\n}): Promise<PatchReturnType> => {\n try {\n return await patchUnhandledRejections(mode);\n } catch (err) {\n log.warn('Failed to patch listeners for unhandled promise rejections');\n log.subtle(inspect(err));\n return { result: 'skip', reason: 'due to an error' };\n }\n};\n"],
|
|
5
5
|
"mappings": "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",
|
|
6
6
|
"names": ["fs", "path"]
|
|
7
7
|
}
|
package/lib/cli/node/index.js
CHANGED
|
@@ -37,13 +37,19 @@ var import_execa = __toESM(require("execa"));
|
|
|
37
37
|
var import_get_port = __toESM(require("get-port"));
|
|
38
38
|
var import_args = require("../../utils/args.js");
|
|
39
39
|
var import_exec = require("../../utils/exec.js");
|
|
40
|
+
var import_tsconfig = require("../../utils/tsconfig.js");
|
|
40
41
|
var import_validation = require("../../utils/validation.js");
|
|
41
42
|
const longRunning = true;
|
|
42
43
|
const node = async () => {
|
|
43
44
|
const args = (0, import_args.parseRunArgs)(process.argv.slice(2));
|
|
45
|
+
const customConditions = (0, import_tsconfig.getCustomConditions)();
|
|
46
|
+
const uniqueConditions = [
|
|
47
|
+
.../* @__PURE__ */ new Set([...args.conditions ?? [], ...customConditions])
|
|
48
|
+
];
|
|
44
49
|
const availablePort = await (0, import_get_port.default)();
|
|
45
50
|
const commonArgs = [
|
|
46
51
|
...args.node,
|
|
52
|
+
...uniqueConditions.map((condition) => `--conditions=${condition}`),
|
|
47
53
|
"--env-file-if-exists",
|
|
48
54
|
".env",
|
|
49
55
|
"--require",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/node/index.ts"],
|
|
4
|
-
"sourcesContent": ["import path from 'path';\n\nimport execa from 'execa';\nimport getPort from 'get-port';\n\nimport { parseRunArgs } from '../../utils/args.js';\nimport { createExec } from '../../utils/exec.js';\nimport { isIpPort } from '../../utils/validation.js';\n\nexport const longRunning = true;\n\nexport const node = async () => {\n const args = parseRunArgs(process.argv.slice(2));\n\n const availablePort = await getPort();\n\n const commonArgs = [\n ...args.node,\n '--env-file-if-exists',\n '.env',\n '--require',\n require.resolve('tsconfig-paths/register'),\n ];\n\n if (args.entryPoint) {\n const exec = createExec({\n env: {\n __SKUBA_ENTRY_POINT: args.entryPoint,\n __SKUBA_PORT: String(isIpPort(args.port) ? args.port : availablePort),\n },\n });\n\n return exec(\n 'tsx',\n ...commonArgs,\n path.join(__dirname, '..', '..', 'wrapper', 'index.js'),\n ...args.script,\n );\n }\n\n return execa(\n require.resolve('tsx/cli'),\n [\n ...commonArgs,\n '--require',\n // Unsure if bug or feature that this is needed, but tsx appears to not do anything typescript in the REPL without this!\n // Doesn't occur when just running the tsx binary directly \uD83E\uDDD0\n require.resolve('tsx/patch-repl'),\n ],\n {\n stdio: 'inherit',\n },\n );\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,mBAAkB;AAClB,sBAAoB;AAEpB,kBAA6B;AAC7B,kBAA2B;AAC3B,wBAAyB;AAElB,MAAM,cAAc;AAEpB,MAAM,OAAO,YAAY;AAC9B,QAAM,WAAO,0BAAa,QAAQ,KAAK,MAAM,CAAC,CAAC;
|
|
4
|
+
"sourcesContent": ["import path from 'path';\n\nimport execa from 'execa';\nimport getPort from 'get-port';\n\nimport { parseRunArgs } from '../../utils/args.js';\nimport { createExec } from '../../utils/exec.js';\nimport { getCustomConditions } from '../../utils/tsconfig.js';\nimport { isIpPort } from '../../utils/validation.js';\n\nexport const longRunning = true;\n\nexport const node = async () => {\n const args = parseRunArgs(process.argv.slice(2));\n const customConditions = getCustomConditions();\n\n const uniqueConditions = [\n ...new Set([...(args.conditions ?? []), ...customConditions]),\n ];\n\n const availablePort = await getPort();\n\n const commonArgs = [\n ...args.node,\n ...uniqueConditions.map((condition) => `--conditions=${condition}`),\n '--env-file-if-exists',\n '.env',\n '--require',\n require.resolve('tsconfig-paths/register'),\n ];\n\n if (args.entryPoint) {\n const exec = createExec({\n env: {\n __SKUBA_ENTRY_POINT: args.entryPoint,\n __SKUBA_PORT: String(isIpPort(args.port) ? args.port : availablePort),\n },\n });\n\n return exec(\n 'tsx',\n ...commonArgs,\n path.join(__dirname, '..', '..', 'wrapper', 'index.js'),\n ...args.script,\n );\n }\n\n return execa(\n require.resolve('tsx/cli'),\n [\n ...commonArgs,\n '--require',\n // Unsure if bug or feature that this is needed, but tsx appears to not do anything typescript in the REPL without this!\n // Doesn't occur when just running the tsx binary directly \uD83E\uDDD0\n require.resolve('tsx/patch-repl'),\n ],\n {\n stdio: 'inherit',\n },\n );\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,mBAAkB;AAClB,sBAAoB;AAEpB,kBAA6B;AAC7B,kBAA2B;AAC3B,sBAAoC;AACpC,wBAAyB;AAElB,MAAM,cAAc;AAEpB,MAAM,OAAO,YAAY;AAC9B,QAAM,WAAO,0BAAa,QAAQ,KAAK,MAAM,CAAC,CAAC;AAC/C,QAAM,uBAAmB,qCAAoB;AAE7C,QAAM,mBAAmB;AAAA,IACvB,GAAG,oBAAI,IAAI,CAAC,GAAI,KAAK,cAAc,CAAC,GAAI,GAAG,gBAAgB,CAAC;AAAA,EAC9D;AAEA,QAAM,gBAAgB,UAAM,gBAAAA,SAAQ;AAEpC,QAAM,aAAa;AAAA,IACjB,GAAG,KAAK;AAAA,IACR,GAAG,iBAAiB,IAAI,CAAC,cAAc,gBAAgB,SAAS,EAAE;AAAA,IAClE;AAAA,IACA;AAAA,IACA;AAAA,IACA,gBAAgB,yBAAyB;AAAA,EAC3C;AAEA,MAAI,KAAK,YAAY;AACnB,UAAM,WAAO,wBAAW;AAAA,MACtB,KAAK;AAAA,QACH,qBAAqB,KAAK;AAAA,QAC1B,cAAc,WAAO,4BAAS,KAAK,IAAI,IAAI,KAAK,OAAO,aAAa;AAAA,MACtE;AAAA,IACF,CAAC;AAED,WAAO;AAAA,MACL;AAAA,MACA,GAAG;AAAA,MACH,YAAAC,QAAK,KAAK,WAAW,MAAM,MAAM,WAAW,UAAU;AAAA,MACtD,GAAG,KAAK;AAAA,IACV;AAAA,EACF;AAEA,aAAO,aAAAC;AAAA,IACL,gBAAgB,SAAS;AAAA,IACzB;AAAA,MACE,GAAG;AAAA,MACH;AAAA;AAAA;AAAA,MAGA,gBAAgB,gBAAgB;AAAA,IAClC;AAAA,IACA;AAAA,MACE,OAAO;AAAA,IACT;AAAA,EACF;AACF;",
|
|
6
6
|
"names": ["getPort", "path", "execa"]
|
|
7
7
|
}
|
package/lib/cli/start/index.js
CHANGED
|
@@ -36,12 +36,17 @@ var import_get_port = __toESM(require("get-port"));
|
|
|
36
36
|
var import_args = require("../../utils/args.js");
|
|
37
37
|
var import_exec = require("../../utils/exec.js");
|
|
38
38
|
var import_manifest = require("../../utils/manifest.js");
|
|
39
|
+
var import_tsconfig = require("../../utils/tsconfig.js");
|
|
39
40
|
var import_validation = require("../../utils/validation.js");
|
|
40
41
|
const start = async () => {
|
|
42
|
+
const customConditions = (0, import_tsconfig.getCustomConditions)();
|
|
41
43
|
const [args, availablePort] = await Promise.all([
|
|
42
44
|
(0, import_args.parseRunArgs)(process.argv.slice(2)),
|
|
43
45
|
(0, import_get_port.default)()
|
|
44
46
|
]);
|
|
47
|
+
const uniqueConditions = [
|
|
48
|
+
.../* @__PURE__ */ new Set([...args.conditions ?? [], ...customConditions])
|
|
49
|
+
];
|
|
45
50
|
args.entryPoint ??= await (0, import_manifest.getEntryPointFromManifest)();
|
|
46
51
|
const execProcess = (0, import_exec.createExec)({
|
|
47
52
|
env: {
|
|
@@ -54,6 +59,7 @@ const start = async () => {
|
|
|
54
59
|
"watch",
|
|
55
60
|
"--clear-screen=false",
|
|
56
61
|
...args.node,
|
|
62
|
+
...uniqueConditions.map((condition) => `--conditions=${condition}`),
|
|
57
63
|
"--env-file-if-exists",
|
|
58
64
|
".env",
|
|
59
65
|
"--require",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/start/index.ts"],
|
|
4
|
-
"sourcesContent": ["import path from 'path';\n\nimport getPort from 'get-port';\n\nimport { parseRunArgs } from '../../utils/args.js';\nimport { createExec } from '../../utils/exec.js';\nimport { getEntryPointFromManifest } from '../../utils/manifest.js';\nimport { isIpPort } from '../../utils/validation.js';\n\nexport const start = async () => {\n const [args, availablePort] = await Promise.all([\n parseRunArgs(process.argv.slice(2)),\n getPort(),\n ]);\n\n args.entryPoint ??= await getEntryPointFromManifest();\n\n const execProcess = createExec({\n env: {\n __SKUBA_ENTRY_POINT: args.entryPoint,\n __SKUBA_PORT: String(isIpPort(args.port) ? args.port : availablePort),\n },\n });\n\n return execProcess(\n 'tsx',\n 'watch',\n '--clear-screen=false',\n ...args.node,\n '--env-file-if-exists',\n '.env',\n '--require',\n 'tsconfig-paths/register',\n path.join(__dirname, '..', '..', 'wrapper', 'index.js'),\n ...args.script,\n );\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,sBAAoB;AAEpB,kBAA6B;AAC7B,kBAA2B;AAC3B,sBAA0C;AAC1C,wBAAyB;AAElB,MAAM,QAAQ,YAAY;AAC/B,QAAM,CAAC,MAAM,aAAa,IAAI,MAAM,QAAQ,IAAI;AAAA,QAC9C,0BAAa,QAAQ,KAAK,MAAM,CAAC,CAAC;AAAA,QAClC,gBAAAA,SAAQ;AAAA,EACV,CAAC;AAED,OAAK,eAAe,UAAM,2CAA0B;AAEpD,QAAM,kBAAc,wBAAW;AAAA,IAC7B,KAAK;AAAA,MACH,qBAAqB,KAAK;AAAA,MAC1B,cAAc,WAAO,4BAAS,KAAK,IAAI,IAAI,KAAK,OAAO,aAAa;AAAA,IACtE;AAAA,EACF,CAAC;AAED,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG,KAAK;AAAA,IACR;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,YAAAC,QAAK,KAAK,WAAW,MAAM,MAAM,WAAW,UAAU;AAAA,IACtD,GAAG,KAAK;AAAA,EACV;AACF;",
|
|
4
|
+
"sourcesContent": ["import path from 'path';\n\nimport getPort from 'get-port';\n\nimport { parseRunArgs } from '../../utils/args.js';\nimport { createExec } from '../../utils/exec.js';\nimport { getEntryPointFromManifest } from '../../utils/manifest.js';\nimport { getCustomConditions } from '../../utils/tsconfig.js';\nimport { isIpPort } from '../../utils/validation.js';\n\nexport const start = async () => {\n const customConditions = getCustomConditions();\n const [args, availablePort] = await Promise.all([\n parseRunArgs(process.argv.slice(2)),\n getPort(),\n ]);\n\n const uniqueConditions = [\n ...new Set([...(args.conditions ?? []), ...customConditions]),\n ];\n\n args.entryPoint ??= await getEntryPointFromManifest();\n\n const execProcess = createExec({\n env: {\n __SKUBA_ENTRY_POINT: args.entryPoint,\n __SKUBA_PORT: String(isIpPort(args.port) ? args.port : availablePort),\n },\n });\n\n return execProcess(\n 'tsx',\n 'watch',\n '--clear-screen=false',\n ...args.node,\n ...uniqueConditions.map((condition) => `--conditions=${condition}`),\n '--env-file-if-exists',\n '.env',\n '--require',\n 'tsconfig-paths/register',\n path.join(__dirname, '..', '..', 'wrapper', 'index.js'),\n ...args.script,\n );\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,sBAAoB;AAEpB,kBAA6B;AAC7B,kBAA2B;AAC3B,sBAA0C;AAC1C,sBAAoC;AACpC,wBAAyB;AAElB,MAAM,QAAQ,YAAY;AAC/B,QAAM,uBAAmB,qCAAoB;AAC7C,QAAM,CAAC,MAAM,aAAa,IAAI,MAAM,QAAQ,IAAI;AAAA,QAC9C,0BAAa,QAAQ,KAAK,MAAM,CAAC,CAAC;AAAA,QAClC,gBAAAA,SAAQ;AAAA,EACV,CAAC;AAED,QAAM,mBAAmB;AAAA,IACvB,GAAG,oBAAI,IAAI,CAAC,GAAI,KAAK,cAAc,CAAC,GAAI,GAAG,gBAAgB,CAAC;AAAA,EAC9D;AAEA,OAAK,eAAe,UAAM,2CAA0B;AAEpD,QAAM,kBAAc,wBAAW;AAAA,IAC7B,KAAK;AAAA,MACH,qBAAqB,KAAK;AAAA,MAC1B,cAAc,WAAO,4BAAS,KAAK,IAAI,IAAI,KAAK,OAAO,aAAa;AAAA,IACtE;AAAA,EACF,CAAC;AAED,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG,KAAK;AAAA,IACR,GAAG,iBAAiB,IAAI,CAAC,cAAc,gBAAgB,SAAS,EAAE;AAAA,IAClE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,YAAAC,QAAK,KAAK,WAAW,MAAM,MAAM,WAAW,UAAU;AAAA,IACtD,GAAG,KAAK;AAAA,EACV;AACF;",
|
|
6
6
|
"names": ["getPort", "path"]
|
|
7
7
|
}
|
package/lib/utils/args.d.ts
CHANGED
|
@@ -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 [];
|
package/lib/utils/args.js.map
CHANGED
|
@@ -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,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;
|
|
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,QAAQ;AAClB,WAAO,sBAAsB,OAAO,IAAI;AAAA,EAC1C;AAEA,SAAO;AACT;AAEA,MAAM,WAAW,CAAC,QAChB,OAAO,QAAQ,YAAY,QAAQ,KAAK,GAAG;AAE7C,MAAM,wBAAwB,CAAC,OAAgB,SAA6B;AAC1E,QAAM,CAAC,MAAM,IAAI,IAAI;AAErB,MAAI,CAAC,MAAM;AACT,WAAO,CAAC;AAAA,EACV;AAEA,MAAI,yBAAyB,KAAK,IAAI,GAAG;AACvC,UAAM,KAAK,KAAK,IAAI;AACpB,WAAO,KAAK,MAAM,CAAC;AAAA,EACrB;AAGA,MAAI,CAAC,aAAa,eAAe,EAAE,SAAS,IAAI,GAAG;AACjD,QAAI,SAAS,IAAI,GAAG;AAClB,YAAM,KAAK,KAAK,GAAG,IAAI,IAAI,IAAI,EAAE;AACjC,aAAO,KAAK,MAAM,CAAC;AAAA,IACrB;AAEA,UAAM,KAAK,KAAK,IAAI;AAEpB,QAAI,MAAM;AAGR,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,MAAI,KAAK,WAAW,eAAe,GAAG;AACpC,UAAM,eAAe,CAAC;AACtB,UAAM,WAAW,KAAK,KAAK,MAAM,EAAE,CAAC;AACpC,WAAO,KAAK,MAAM,CAAC;AAAA,EACrB;AAEA,QAAM,aAAa;AACnB,QAAM,OAAO,KAAK,GAAG,KAAK,MAAM,CAAC,CAAC;AAClC,SAAO,CAAC;AACV;",
|
|
6
6
|
"names": ["assert"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
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 tsconfig_exports = {};
|
|
20
|
+
__export(tsconfig_exports, {
|
|
21
|
+
getCustomConditions: () => getCustomConditions
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(tsconfig_exports);
|
|
24
|
+
var import_tsc = require("../cli/build/tsc.js");
|
|
25
|
+
var import_logging = require("./logging.js");
|
|
26
|
+
const getCustomConditions = () => {
|
|
27
|
+
try {
|
|
28
|
+
const parsedConfig = (0, import_tsc.readTsconfig)([], import_logging.log);
|
|
29
|
+
const customConditions = parsedConfig?.options.customConditions;
|
|
30
|
+
return Array.isArray(customConditions) ? customConditions : [];
|
|
31
|
+
} catch {
|
|
32
|
+
return [];
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
36
|
+
0 && (module.exports = {
|
|
37
|
+
getCustomConditions
|
|
38
|
+
});
|
|
39
|
+
//# sourceMappingURL=tsconfig.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/utils/tsconfig.ts"],
|
|
4
|
+
"sourcesContent": ["import { readTsconfig } from '../cli/build/tsc.js';\n\nimport { log } from './logging.js';\n\n/**\n * Extract custom conditions from tsconfig that should be passed to tsx\n */\nexport const getCustomConditions = (): string[] => {\n try {\n const parsedConfig = readTsconfig([], log);\n const customConditions = parsedConfig?.options.customConditions;\n return Array.isArray(customConditions) ? customConditions : [];\n } catch {\n return [];\n }\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAA6B;AAE7B,qBAAoB;AAKb,MAAM,sBAAsB,MAAgB;AACjD,MAAI;AACF,UAAM,mBAAe,yBAAa,CAAC,GAAG,kBAAG;AACzC,UAAM,mBAAmB,cAAc,QAAQ;AAC/C,WAAO,MAAM,QAAQ,gBAAgB,IAAI,mBAAmB,CAAC;AAAA,EAC/D,QAAQ;AACN,WAAO,CAAC;AAAA,EACV;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "skuba",
|
|
3
|
-
"version": "12.1.0-
|
|
3
|
+
"version": "12.1.0-conditions-20250808085844",
|
|
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",
|
|
@@ -95,15 +95,15 @@
|
|
|
95
95
|
"tsconfig-paths": "^4.0.0",
|
|
96
96
|
"tsconfig-seek": "2.0.0",
|
|
97
97
|
"tsx": "^4.16.2",
|
|
98
|
-
"typescript": "~5.
|
|
98
|
+
"typescript": "~5.9.0",
|
|
99
99
|
"zod": "^4.0.0",
|
|
100
|
-
"eslint-config-skuba": "7.1.0-
|
|
100
|
+
"eslint-config-skuba": "7.1.0-conditions-20250808085844"
|
|
101
101
|
},
|
|
102
102
|
"devDependencies": {
|
|
103
103
|
"@changesets/cli": "2.29.5",
|
|
104
104
|
"@changesets/get-github-info": "0.6.0",
|
|
105
|
-
"@jest/reporters": "30.0.
|
|
106
|
-
"@jest/test-result": "30.0.
|
|
105
|
+
"@jest/reporters": "30.0.5",
|
|
106
|
+
"@jest/test-result": "30.0.5",
|
|
107
107
|
"@types/ejs": "3.1.5",
|
|
108
108
|
"@types/express": "5.0.3",
|
|
109
109
|
"@types/fs-extra": "11.0.4",
|
|
@@ -113,20 +113,20 @@
|
|
|
113
113
|
"@types/module-alias": "2.0.4",
|
|
114
114
|
"@types/npm-registry-fetch": "8.0.8",
|
|
115
115
|
"@types/npm-which": "3.0.4",
|
|
116
|
-
"@types/picomatch": "4.0.
|
|
116
|
+
"@types/picomatch": "4.0.2",
|
|
117
117
|
"@types/semver": "7.7.0",
|
|
118
118
|
"@types/supertest": "6.0.3",
|
|
119
119
|
"enhanced-resolve": "5.18.2",
|
|
120
120
|
"express": "5.1.0",
|
|
121
121
|
"fastify": "5.4.0",
|
|
122
|
-
"jest-diff": "30.0.
|
|
122
|
+
"jest-diff": "30.0.5",
|
|
123
123
|
"jsonfile": "6.1.0",
|
|
124
124
|
"koa": "3.0.1",
|
|
125
|
-
"memfs": "4.
|
|
125
|
+
"memfs": "4.36.0",
|
|
126
126
|
"remark-cli": "12.0.1",
|
|
127
127
|
"remark-preset-lint-recommended": "7.0.1",
|
|
128
128
|
"semver": "7.7.2",
|
|
129
|
-
"supertest": "7.1.
|
|
129
|
+
"supertest": "7.1.4",
|
|
130
130
|
"type-fest": "2.19.0"
|
|
131
131
|
},
|
|
132
132
|
"peerDependencies": {
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
"test:watch": "skuba test --watch"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@seek/logger": "
|
|
16
|
+
"@seek/logger": "master",
|
|
17
17
|
"express": "^5.0.0",
|
|
18
|
-
"hot-shots": "^
|
|
19
|
-
"seek-datadog-custom-metrics": "^
|
|
18
|
+
"hot-shots": "^11.0.0",
|
|
19
|
+
"seek-datadog-custom-metrics": "^5.0.0",
|
|
20
20
|
"skuba-dive": "^2.0.0"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@koa/bodyparser": "^6.0.0",
|
|
17
|
-
"@koa/router": "^
|
|
17
|
+
"@koa/router": "^14.0.0",
|
|
18
18
|
"@opentelemetry/api": "^1.9.0",
|
|
19
19
|
"@opentelemetry/core": "^2.0.0",
|
|
20
20
|
"@opentelemetry/exporter-trace-otlp-grpc": "^0.203.0",
|
|
@@ -22,11 +22,11 @@
|
|
|
22
22
|
"@opentelemetry/instrumentation-http": "^0.203.0",
|
|
23
23
|
"@opentelemetry/propagator-b3": "^2.0.0",
|
|
24
24
|
"@opentelemetry/sdk-node": "^0.203.0",
|
|
25
|
-
"@seek/logger": "
|
|
26
|
-
"hot-shots": "^
|
|
25
|
+
"@seek/logger": "master",
|
|
26
|
+
"hot-shots": "^11.0.0",
|
|
27
27
|
"koa": "^3.0.1",
|
|
28
28
|
"koa-compose": "^4.1.0",
|
|
29
|
-
"seek-datadog-custom-metrics": "^
|
|
29
|
+
"seek-datadog-custom-metrics": "^5.0.0",
|
|
30
30
|
"seek-koala": "^7.1.0",
|
|
31
31
|
"skuba-dive": "^2.0.0",
|
|
32
32
|
"zod": "^4.0.0"
|
|
@@ -222,7 +222,7 @@ exports[`returns expected CloudFormation stack for dev 1`] = `
|
|
|
222
222
|
],
|
|
223
223
|
},
|
|
224
224
|
],
|
|
225
|
-
"ReservedConcurrentExecutions":
|
|
225
|
+
"ReservedConcurrentExecutions": 3,
|
|
226
226
|
"Role": {
|
|
227
227
|
"Fn::GetAtt": [
|
|
228
228
|
"workerServiceRole2130CC7F",
|
|
@@ -1104,7 +1104,7 @@ exports[`returns expected CloudFormation stack for prod 1`] = `
|
|
|
1104
1104
|
"ReportBatchItemFailures",
|
|
1105
1105
|
],
|
|
1106
1106
|
"ScalingConfig": {
|
|
1107
|
-
"MaximumConcurrency":
|
|
1107
|
+
"MaximumConcurrency": 19,
|
|
1108
1108
|
},
|
|
1109
1109
|
"Tags": [
|
|
1110
1110
|
{
|
|
@@ -142,7 +142,7 @@ export class AppStack extends Stack {
|
|
|
142
142
|
|
|
143
143
|
workerDeployment.alias.addEventSource(
|
|
144
144
|
new aws_lambda_event_sources.SqsEventSource(queue, {
|
|
145
|
-
maxConcurrency: config.workerLambda.reservedConcurrency,
|
|
145
|
+
maxConcurrency: config.workerLambda.reservedConcurrency - 1, // Ensure we have capacity reserved for our blue/green deployment
|
|
146
146
|
batchSize: config.workerLambda.batchSize,
|
|
147
147
|
reportBatchItemFailures: true,
|
|
148
148
|
}),
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"@aws-sdk/client-lambda": "^3.363.0",
|
|
19
19
|
"@aws-sdk/client-sns": "^3.363.0",
|
|
20
20
|
"@seek/aws-codedeploy-hooks": "^2.0.0",
|
|
21
|
-
"@seek/logger": "
|
|
21
|
+
"@seek/logger": "master",
|
|
22
22
|
"datadog-lambda-js": "^12.0.0",
|
|
23
23
|
"dd-trace": "^5.0.0",
|
|
24
24
|
"skuba-dive": "^2.0.0",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"constructs": "^10.0.17",
|
|
38
38
|
"datadog-cdk-constructs-v2": "^2.0.0",
|
|
39
39
|
"pino-pretty": "^13.0.0",
|
|
40
|
-
"skuba": "12.1.0-
|
|
40
|
+
"skuba": "12.1.0-conditions-20250808085844"
|
|
41
41
|
},
|
|
42
42
|
"packageManager": "pnpm@10.14.0",
|
|
43
43
|
"engines": {
|