skuba 12.1.0-no-sync-in-promise-iterable-20250801120322 → 12.1.1
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/build/assets.js +1 -1
- package/lib/cli/build/assets.js.map +2 -2
- package/lib/cli/configure/analyseDependencies.d.ts +2 -2
- package/lib/cli/configure/analyseDependencies.js.map +1 -1
- package/lib/cli/configure/analysis/package.d.ts +1 -1
- package/lib/cli/configure/analysis/package.js +1 -1
- package/lib/cli/configure/analysis/package.js.map +2 -2
- package/lib/cli/configure/ensureTemplateCompletion.d.ts +2 -2
- package/lib/cli/configure/ensureTemplateCompletion.js.map +1 -1
- package/lib/cli/configure/getEntryPoint.d.ts +2 -2
- package/lib/cli/configure/getEntryPoint.js.map +1 -1
- package/lib/cli/configure/getProjectType.d.ts +2 -2
- package/lib/cli/configure/getProjectType.js.map +1 -1
- package/lib/cli/configure/processing/package.js +8 -2
- package/lib/cli/configure/processing/package.js.map +2 -2
- package/lib/cli/init/getConfig.js +1 -1
- package/lib/cli/init/getConfig.js.map +2 -2
- package/lib/cli/lint/internal.js +1 -1
- package/lib/cli/lint/internal.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/index.d.ts +2 -2
- package/lib/cli/lint/internalLints/upgrade/index.js.map +1 -1
- 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/lint/internalLints/upgrade/patches/8.2.1/upgradeESLint.js +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/upgradeESLint.js.map +2 -2
- package/lib/cli/test/index.d.ts +1 -1
- package/lib/cli/test/index.js +18 -4
- package/lib/cli/test/index.js.map +2 -2
- package/lib/utils/manifest.d.ts +1 -1
- package/lib/utils/manifest.js +1 -1
- package/lib/utils/manifest.js.map +2 -2
- package/package.json +13 -13
- package/template/base/_pnpm-workspace.yaml +1 -0
- package/template/base/jest.setup.ts +1 -1
- package/template/express-rest-api/.buildkite/pipeline.yml +6 -0
- package/template/express-rest-api/.env +1 -1
- package/template/express-rest-api/.gantry/dev.yml +5 -1
- package/template/express-rest-api/.gantry/prod.yml +5 -1
- package/template/express-rest-api/Dockerfile +1 -1
- package/template/express-rest-api/README.md +5 -5
- package/template/express-rest-api/gantry.apply.yml +17 -1
- package/template/express-rest-api/package.json +11 -5
- package/template/express-rest-api/src/api/healthCheck.ts +2 -2
- package/template/express-rest-api/src/config.ts +7 -7
- package/template/express-rest-api/src/framework/logging.ts +11 -7
- package/template/express-rest-api/src/framework/metrics.ts +1 -1
- package/template/express-rest-api/src/tracing.ts +56 -0
- package/template/greeter/README.md +2 -2
- package/template/greeter/package.json +2 -2
- package/template/koa-rest-api/.buildkite/pipeline.yml +6 -0
- package/template/koa-rest-api/.env +1 -1
- package/template/koa-rest-api/.gantry/dev.yml +3 -3
- package/template/koa-rest-api/.gantry/prod.yml +3 -3
- package/template/koa-rest-api/README.md +6 -6
- package/template/koa-rest-api/gantry.apply.yml +15 -3
- package/template/koa-rest-api/package.json +5 -6
- package/template/koa-rest-api/src/api/healthCheck.ts +2 -2
- package/template/koa-rest-api/src/config.ts +7 -7
- package/template/koa-rest-api/src/framework/logging.ts +12 -8
- package/template/koa-rest-api/src/framework/metrics.ts +1 -1
- package/template/koa-rest-api/src/framework/server.test.ts +7 -8
- package/template/koa-rest-api/src/framework/server.ts +1 -4
- package/template/lambda-sqs-worker-cdk/.buildkite/pipeline.yml +6 -2
- package/template/lambda-sqs-worker-cdk/.env +1 -1
- package/template/lambda-sqs-worker-cdk/README.md +8 -8
- package/template/lambda-sqs-worker-cdk/infra/__snapshots__/appStack.test.ts.snap +36 -10
- package/template/lambda-sqs-worker-cdk/infra/appStack.test.ts +5 -8
- package/template/lambda-sqs-worker-cdk/infra/appStack.ts +11 -5
- package/template/lambda-sqs-worker-cdk/infra/config.ts +27 -18
- package/template/lambda-sqs-worker-cdk/infra/index.ts +1 -1
- package/template/lambda-sqs-worker-cdk/package.json +6 -6
- package/template/lambda-sqs-worker-cdk/src/app.test.ts +4 -4
- package/template/lambda-sqs-worker-cdk/src/config.ts +11 -16
- package/template/lambda-sqs-worker-cdk/src/framework/handler.test.ts +2 -2
- package/template/lambda-sqs-worker-cdk/src/framework/handler.ts +8 -21
- package/template/lambda-sqs-worker-cdk/src/framework/logging.ts +12 -8
- package/template/lambda-sqs-worker-cdk/src/framework/metrics.ts +1 -4
- package/template/oss-npm-package/.github/workflows/release.yml +1 -1
- package/template/oss-npm-package/.github/workflows/validate.yml +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../src/cli/lint/internalLints/upgrade/patches/8.2.1/upgradeESLint.ts"],
|
|
4
|
-
"sourcesContent": ["// eslint-disable-next-line no-restricted-imports -- fs-extra is mocked\nimport * as fsp from 'fs/promises';\nimport path from 'path';\nimport { inspect } from 'util';\n\nimport fs from 'fs-extra';\n\nimport { createExec } from '../../../../../../utils/exec.js';\nimport { log } from '../../../../../../utils/logging.js';\nimport { createDestinationFileReader } from '../../../../../configure/analysis/project.js';\nimport { mergeWithConfigFile } from '../../../../../configure/processing/configFile.js';\nimport { formatPrettier } from '../../../../../configure/processing/prettier.js';\nimport type { PatchFunction, PatchReturnType } from '../../index.js';\n\nconst IGNORE_FILE = '.eslintignore';\nconst OLD_CONFIG_FILE = '.eslintrc.js';\nconst NEW_CONFIG_FILE_CJS = 'eslint.config.cjs';\nconst NEW_CONFIG_FILE_JS = 'eslint.config.js';\n\nconst upgradeESLint: PatchFunction = async ({\n mode,\n dir: cwd = process.cwd(),\n}): Promise<PatchReturnType> => {\n const readFile = createDestinationFileReader(cwd);\n const [ignoreFileContents, oldConfig] = await Promise.all([\n readFile(IGNORE_FILE),\n readFile(OLD_CONFIG_FILE),\n ]);\n\n if (oldConfig === undefined) {\n return {\n result: 'skip',\n reason: `no ${OLD_CONFIG_FILE} - have you already migrated?`,\n };\n }\n\n if (mode === 'lint') {\n return { result: 'apply' };\n }\n\n const ignoreContentsWithoutSkubaManaged = mergeWithConfigFile(\n '',\n 'ignore',\n )(ignoreFileContents);\n\n const exec = createExec({\n cwd: process.cwd(),\n stdio: 'ignore',\n });\n\n // eslint-migrate-config require()s the file, so for testability, put it in a temporary location\n const dir = await writeTemporaryFiles({\n [OLD_CONFIG_FILE]: oldConfig,\n ...(ignoreContentsWithoutSkubaManaged.trim().length > 0\n ? { [IGNORE_FILE]: ignoreContentsWithoutSkubaManaged }\n : {}),\n });\n try {\n await exec(\n 'eslint-migrate-config',\n path.join(dir, OLD_CONFIG_FILE),\n '--commonjs',\n );\n\n const output = fiddleWithOutput(\n await fsp.readFile(path.join(dir, NEW_CONFIG_FILE_CJS), 'utf-8'),\n );\n await fs.promises.writeFile(\n NEW_CONFIG_FILE_JS,\n await formatPrettier(output, { filepath: NEW_CONFIG_FILE_JS }),\n );\n\n await Promise.all([\n ignoreFileContents === undefined\n ? Promise.resolve()\n : fs.promises.rm(IGNORE_FILE),\n fs.promises.rm(OLD_CONFIG_FILE),\n ]);\n\n return { result: 'apply' };\n } finally {\n await fsp.rm(dir, { recursive: true });\n }\n};\n\nconst writeTemporaryFiles = async (contents: Record<string, string>) => {\n const dir = await fsp.mkdtemp('eslint-migrate-config');\n\n await Promise.all(\n Object.entries(contents).map(([file, content]) =>\n fsp.writeFile(path.join(dir, file), content),\n ),\n );\n\n return dir;\n};\n\nconst fiddleWithOutput = (input: string) => {\n let output = input.replace(/compat.extends\\([\"']skuba[\"']\\)/, 'skuba');\n\n if (!output.includes('eslint-config-skuba')) {\n output = `const skuba = require('eslint-config-skuba');\\n\\n${output}`;\n }\n\n if (!output.includes('compat.')) {\n output = output.replace(/const compat = new FlatCompat\\(\\{[^}]+\\}\\);/m, '');\n output = output.replace(\n /const \\{\\s*FlatCompat,?\\s*\\}\\s*=\\s*require\\([\"']@eslint\\/eslintrc[\"']\\);/m,\n '',\n );\n }\n\n if (!output.includes('js.')) {\n output = output.replace(/const js = require\\(['\"]@eslint\\/js['\"]\\);/, '');\n }\n\n output = output.replace(\n /^const skuba = require\\('eslint-config-skuba'\\);\\s*module.exports = \\[...skuba\\];$/m,\n \"module.exports = require('eslint-config-skuba');\",\n );\n\n return output;\n};\n\nexport const tryUpgradeESLint: PatchFunction = async (config) => {\n try {\n return await upgradeESLint(config);\n } catch (err) {\n log.warn('Failed to upgrade ESLint to flat config.');\n log.subtle(inspect(err));\n return { result: 'skip', reason: 'due to an error' };\n }\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,UAAqB;AACrB,kBAAiB;AACjB,kBAAwB;AAExB,sBAAe;AAEf,kBAA2B;AAC3B,qBAAoB;AACpB,qBAA4C;AAC5C,wBAAoC;AACpC,sBAA+B;AAG/B,MAAM,cAAc;AACpB,MAAM,kBAAkB;AACxB,MAAM,sBAAsB;AAC5B,MAAM,qBAAqB;AAE3B,MAAM,gBAA+B,OAAO;AAAA,EAC1C;AAAA,EACA,KAAK,MAAM,QAAQ,IAAI;AACzB,MAAgC;AAC9B,QAAM,eAAW,4CAA4B,GAAG;AAChD,QAAM,CAAC,oBAAoB,SAAS,IAAI,MAAM,QAAQ,IAAI;AAAA,IACxD,SAAS,WAAW;AAAA,IACpB,SAAS,eAAe;AAAA,EAC1B,CAAC;AAED,MAAI,cAAc,QAAW;AAC3B,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,QAAQ,MAAM,eAAe;AAAA,IAC/B;AAAA,EACF;AAEA,MAAI,SAAS,QAAQ;AACnB,WAAO,EAAE,QAAQ,QAAQ;AAAA,EAC3B;AAEA,QAAM,wCAAoC;AAAA,IACxC;AAAA,IACA;AAAA,EACF,EAAE,kBAAkB;AAEpB,QAAM,WAAO,wBAAW;AAAA,IACtB,KAAK,QAAQ,IAAI;AAAA,IACjB,OAAO;AAAA,EACT,CAAC;AAGD,QAAM,MAAM,MAAM,oBAAoB;AAAA,IACpC,CAAC,eAAe,GAAG;AAAA,IACnB,GAAI,kCAAkC,KAAK,EAAE,SAAS,IAClD,EAAE,CAAC,WAAW,GAAG,kCAAkC,IACnD,CAAC;AAAA,EACP,CAAC;AACD,MAAI;AACF,UAAM;AAAA,MACJ;AAAA,MACA,YAAAA,QAAK,KAAK,KAAK,eAAe;AAAA,MAC9B;AAAA,IACF;AAEA,UAAM,SAAS;AAAA,MACb,MAAM,IAAI,SAAS,YAAAA,QAAK,KAAK,KAAK,mBAAmB,GAAG,OAAO;AAAA,IACjE;AACA,UAAM,gBAAAC,QAAG,SAAS;AAAA,MAChB;AAAA,MACA,UAAM,gCAAe,QAAQ,EAAE,UAAU,mBAAmB,CAAC;AAAA,IAC/D;AAEA,UAAM,QAAQ,IAAI;AAAA,MAChB,uBAAuB,SACnB,QAAQ,QAAQ,IAChB,gBAAAA,QAAG,SAAS,GAAG,WAAW;AAAA,MAC9B,gBAAAA,QAAG,SAAS,GAAG,eAAe;AAAA,IAChC,CAAC;AAED,WAAO,EAAE,QAAQ,QAAQ;AAAA,EAC3B,UAAE;AACA,UAAM,IAAI,GAAG,KAAK,EAAE,WAAW,KAAK,CAAC;AAAA,EACvC;AACF;AAEA,MAAM,sBAAsB,OAAO,aAAqC;AACtE,QAAM,MAAM,MAAM,IAAI,QAAQ,uBAAuB;AAErD,QAAM,QAAQ;AAAA,IACZ,OAAO,QAAQ,QAAQ,EAAE;AAAA,MAAI,
|
|
4
|
+
"sourcesContent": ["// eslint-disable-next-line no-restricted-imports -- fs-extra is mocked\nimport * as fsp from 'fs/promises';\nimport path from 'path';\nimport { inspect } from 'util';\n\nimport fs from 'fs-extra';\n\nimport { createExec } from '../../../../../../utils/exec.js';\nimport { log } from '../../../../../../utils/logging.js';\nimport { createDestinationFileReader } from '../../../../../configure/analysis/project.js';\nimport { mergeWithConfigFile } from '../../../../../configure/processing/configFile.js';\nimport { formatPrettier } from '../../../../../configure/processing/prettier.js';\nimport type { PatchFunction, PatchReturnType } from '../../index.js';\n\nconst IGNORE_FILE = '.eslintignore';\nconst OLD_CONFIG_FILE = '.eslintrc.js';\nconst NEW_CONFIG_FILE_CJS = 'eslint.config.cjs';\nconst NEW_CONFIG_FILE_JS = 'eslint.config.js';\n\nconst upgradeESLint: PatchFunction = async ({\n mode,\n dir: cwd = process.cwd(),\n}): Promise<PatchReturnType> => {\n const readFile = createDestinationFileReader(cwd);\n const [ignoreFileContents, oldConfig] = await Promise.all([\n readFile(IGNORE_FILE),\n readFile(OLD_CONFIG_FILE),\n ]);\n\n if (oldConfig === undefined) {\n return {\n result: 'skip',\n reason: `no ${OLD_CONFIG_FILE} - have you already migrated?`,\n };\n }\n\n if (mode === 'lint') {\n return { result: 'apply' };\n }\n\n const ignoreContentsWithoutSkubaManaged = mergeWithConfigFile(\n '',\n 'ignore',\n )(ignoreFileContents);\n\n const exec = createExec({\n cwd: process.cwd(),\n stdio: 'ignore',\n });\n\n // eslint-migrate-config require()s the file, so for testability, put it in a temporary location\n const dir = await writeTemporaryFiles({\n [OLD_CONFIG_FILE]: oldConfig,\n ...(ignoreContentsWithoutSkubaManaged.trim().length > 0\n ? { [IGNORE_FILE]: ignoreContentsWithoutSkubaManaged }\n : {}),\n });\n try {\n await exec(\n 'eslint-migrate-config',\n path.join(dir, OLD_CONFIG_FILE),\n '--commonjs',\n );\n\n const output = fiddleWithOutput(\n await fsp.readFile(path.join(dir, NEW_CONFIG_FILE_CJS), 'utf-8'),\n );\n await fs.promises.writeFile(\n NEW_CONFIG_FILE_JS,\n await formatPrettier(output, { filepath: NEW_CONFIG_FILE_JS }),\n );\n\n await Promise.all([\n ignoreFileContents === undefined\n ? Promise.resolve()\n : fs.promises.rm(IGNORE_FILE),\n fs.promises.rm(OLD_CONFIG_FILE),\n ]);\n\n return { result: 'apply' };\n } finally {\n await fsp.rm(dir, { recursive: true });\n }\n};\n\nconst writeTemporaryFiles = async (contents: Record<string, string>) => {\n const dir = await fsp.mkdtemp('eslint-migrate-config');\n\n await Promise.all(\n Object.entries(contents).map(async ([file, content]) =>\n fsp.writeFile(path.join(dir, file), content),\n ),\n );\n\n return dir;\n};\n\nconst fiddleWithOutput = (input: string) => {\n let output = input.replace(/compat.extends\\([\"']skuba[\"']\\)/, 'skuba');\n\n if (!output.includes('eslint-config-skuba')) {\n output = `const skuba = require('eslint-config-skuba');\\n\\n${output}`;\n }\n\n if (!output.includes('compat.')) {\n output = output.replace(/const compat = new FlatCompat\\(\\{[^}]+\\}\\);/m, '');\n output = output.replace(\n /const \\{\\s*FlatCompat,?\\s*\\}\\s*=\\s*require\\([\"']@eslint\\/eslintrc[\"']\\);/m,\n '',\n );\n }\n\n if (!output.includes('js.')) {\n output = output.replace(/const js = require\\(['\"]@eslint\\/js['\"]\\);/, '');\n }\n\n output = output.replace(\n /^const skuba = require\\('eslint-config-skuba'\\);\\s*module.exports = \\[...skuba\\];$/m,\n \"module.exports = require('eslint-config-skuba');\",\n );\n\n return output;\n};\n\nexport const tryUpgradeESLint: PatchFunction = async (config) => {\n try {\n return await upgradeESLint(config);\n } catch (err) {\n log.warn('Failed to upgrade ESLint to flat config.');\n log.subtle(inspect(err));\n return { result: 'skip', reason: 'due to an error' };\n }\n};\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
6
|
"names": ["path", "fs"]
|
|
7
7
|
}
|
package/lib/cli/test/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const test: () => Promise<
|
|
1
|
+
export declare const test: () => Promise<import("execa").ExecaReturnValue<string>>;
|
package/lib/cli/test/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,18 +17,30 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
var test_exports = {};
|
|
20
30
|
__export(test_exports, {
|
|
21
31
|
test: () => test
|
|
22
32
|
});
|
|
23
33
|
module.exports = __toCommonJS(test_exports);
|
|
24
|
-
var
|
|
34
|
+
var import_exec = require("../../utils/exec.js");
|
|
25
35
|
const test = async () => {
|
|
26
|
-
process.env.NODE_ENV ??= "test";
|
|
27
|
-
process.env.TS_JEST_LOG ??= "stdout:error";
|
|
28
36
|
const argv = process.argv.slice(2);
|
|
29
|
-
|
|
37
|
+
const nodeOptions = process.env.NODE_OPTIONS ?? "";
|
|
38
|
+
const execWithEnv = (0, import_exec.createExec)({
|
|
39
|
+
env: {
|
|
40
|
+
NODE_OPTIONS: !nodeOptions.includes("--experimental-vm-modules") ? `${nodeOptions} --experimental-vm-modules --no-warnings=ExperimentalWarning` : nodeOptions
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
return execWithEnv(require.resolve("jest/bin/jest"), ...argv);
|
|
30
44
|
};
|
|
31
45
|
// Annotate the CommonJS export names for ESM import in node:
|
|
32
46
|
0 && (module.exports = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/test/index.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import { createExec } from '../../utils/exec.js';\n\nexport const test = async () => {\n const argv = process.argv.slice(2);\n\n const nodeOptions = process.env.NODE_OPTIONS ?? '';\n\n const execWithEnv = createExec({\n env: {\n NODE_OPTIONS: !nodeOptions.includes('--experimental-vm-modules')\n ? `${nodeOptions} --experimental-vm-modules --no-warnings=ExperimentalWarning`\n : nodeOptions,\n },\n });\n\n // Run Jest in a child process with proper environment\n return execWithEnv(require.resolve('jest/bin/jest'), ...argv);\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA2B;AAEpB,MAAM,OAAO,YAAY;AAC9B,QAAM,OAAO,QAAQ,KAAK,MAAM,CAAC;AAEjC,QAAM,cAAc,QAAQ,IAAI,gBAAgB;AAEhD,QAAM,kBAAc,wBAAW;AAAA,IAC7B,KAAK;AAAA,MACH,cAAc,CAAC,YAAY,SAAS,2BAA2B,IAC3D,GAAG,WAAW,iEACd;AAAA,IACN;AAAA,EACF,CAAC;AAGD,SAAO,YAAY,gBAAgB,eAAe,GAAG,GAAG,IAAI;AAC9D;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/lib/utils/manifest.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export type ProjectType = z.infer<typeof projectTypeSchema>;
|
|
|
4
4
|
export declare const projectTypeSchema: z.ZodUnion<readonly [z.ZodLiteral<"application">, z.ZodLiteral<"package">]>;
|
|
5
5
|
export declare const PROJECT_TYPES: readonly ["application", "package"];
|
|
6
6
|
export declare const getSkubaManifest: () => Promise<NormalizedPackageJson>;
|
|
7
|
-
export declare const getConsumerManifest: (cwd?: string) => Promise<readPkgUp.
|
|
7
|
+
export declare const getConsumerManifest: (cwd?: string) => Promise<readPkgUp.ReadResult | undefined>;
|
|
8
8
|
export declare const getPropFromConsumerManifest: <T extends string, V = unknown>(prop: T) => Promise<V | undefined>;
|
|
9
9
|
export declare const getStringPropFromConsumerManifest: <T extends string>(prop: T) => Promise<string | undefined>;
|
|
10
10
|
export declare const getEntryPointFromManifest: () => Promise<string>;
|
package/lib/utils/manifest.js
CHANGED
|
@@ -57,7 +57,7 @@ const getSkubaManifest = async () => {
|
|
|
57
57
|
}
|
|
58
58
|
return skubaManifest = result.packageJson;
|
|
59
59
|
};
|
|
60
|
-
const getConsumerManifest = (cwd) => (0, import_read_pkg_up.default)({ cwd });
|
|
60
|
+
const getConsumerManifest = (cwd) => (0, import_read_pkg_up.default)({ cwd, normalize: false });
|
|
61
61
|
const getPropFromConsumerManifest = async (prop) => {
|
|
62
62
|
const result = await getConsumerManifest();
|
|
63
63
|
return result !== void 0 && (0, import_validation.hasProp)(result.packageJson.skuba, prop) ? result.packageJson.skuba[prop] : void 0;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/manifest.ts"],
|
|
4
|
-
"sourcesContent": ["import readPkgUp, { type NormalizedPackageJson } from 'read-pkg-up';\nimport * as z from 'zod/v4';\n\nimport { hasProp } from './validation.js';\n\nexport type ProjectType = z.infer<typeof projectTypeSchema>;\n\nexport const projectTypeSchema = z.union([\n z.literal('application'),\n z.literal('package'),\n]);\n\nexport const PROJECT_TYPES = ['application', 'package'] as const;\n\nconst DEFAULT_ENTRY_POINT = 'src/app.ts';\n\nlet skubaManifest: NormalizedPackageJson | undefined;\n\nexport const getSkubaManifest = async (): Promise<NormalizedPackageJson> => {\n if (skubaManifest !== undefined) {\n return skubaManifest;\n }\n\n const result = await readPkgUp({ cwd: __dirname });\n\n if (result === undefined) {\n throw Error('skuba could not find its own manifest');\n }\n\n return (skubaManifest = result.packageJson);\n};\n\nexport const getConsumerManifest = (cwd?: string)
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAAsD;AACtD,QAAmB;AAEnB,wBAAwB;AAIjB,MAAM,oBAAoB,EAAE,MAAM;AAAA,EACvC,EAAE,QAAQ,aAAa;AAAA,EACvB,EAAE,QAAQ,SAAS;AACrB,CAAC;AAEM,MAAM,gBAAgB,CAAC,eAAe,SAAS;AAEtD,MAAM,sBAAsB;AAE5B,IAAI;AAEG,MAAM,mBAAmB,YAA4C;AAC1E,MAAI,kBAAkB,QAAW;AAC/B,WAAO;AAAA,EACT;AAEA,QAAM,SAAS,UAAM,mBAAAA,SAAU,EAAE,KAAK,UAAU,CAAC;AAEjD,MAAI,WAAW,QAAW;AACxB,UAAM,MAAM,uCAAuC;AAAA,EACrD;AAEA,SAAQ,gBAAgB,OAAO;AACjC;AAEO,MAAM,sBAAsB,CAAC,
|
|
4
|
+
"sourcesContent": ["import readPkgUp, { type NormalizedPackageJson } from 'read-pkg-up';\nimport * as z from 'zod/v4';\n\nimport { hasProp } from './validation.js';\n\nexport type ProjectType = z.infer<typeof projectTypeSchema>;\n\nexport const projectTypeSchema = z.union([\n z.literal('application'),\n z.literal('package'),\n]);\n\nexport const PROJECT_TYPES = ['application', 'package'] as const;\n\nconst DEFAULT_ENTRY_POINT = 'src/app.ts';\n\nlet skubaManifest: NormalizedPackageJson | undefined;\n\nexport const getSkubaManifest = async (): Promise<NormalizedPackageJson> => {\n if (skubaManifest !== undefined) {\n return skubaManifest;\n }\n\n const result = await readPkgUp({ cwd: __dirname });\n\n if (result === undefined) {\n throw Error('skuba could not find its own manifest');\n }\n\n return (skubaManifest = result.packageJson);\n};\n\nexport const getConsumerManifest = (cwd?: string) =>\n readPkgUp({ cwd, normalize: false });\n\nexport const getPropFromConsumerManifest = async <\n T extends string,\n V = unknown,\n>(\n prop: T,\n): Promise<V | undefined> => {\n const result = await getConsumerManifest();\n\n return result !== undefined && hasProp<T, V>(result.packageJson.skuba, prop)\n ? result.packageJson.skuba[prop]\n : undefined;\n};\n\nexport const getStringPropFromConsumerManifest = async <T extends string>(\n prop: T,\n): Promise<string | undefined> => {\n const result = await getPropFromConsumerManifest(prop);\n\n return typeof result === 'string' ? result : undefined;\n};\n\nexport const getEntryPointFromManifest = async (): Promise<string> => {\n const entryPoint = await getStringPropFromConsumerManifest('entryPoint');\n\n return entryPoint ?? DEFAULT_ENTRY_POINT;\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAAsD;AACtD,QAAmB;AAEnB,wBAAwB;AAIjB,MAAM,oBAAoB,EAAE,MAAM;AAAA,EACvC,EAAE,QAAQ,aAAa;AAAA,EACvB,EAAE,QAAQ,SAAS;AACrB,CAAC;AAEM,MAAM,gBAAgB,CAAC,eAAe,SAAS;AAEtD,MAAM,sBAAsB;AAE5B,IAAI;AAEG,MAAM,mBAAmB,YAA4C;AAC1E,MAAI,kBAAkB,QAAW;AAC/B,WAAO;AAAA,EACT;AAEA,QAAM,SAAS,UAAM,mBAAAA,SAAU,EAAE,KAAK,UAAU,CAAC;AAEjD,MAAI,WAAW,QAAW;AACxB,UAAM,MAAM,uCAAuC;AAAA,EACrD;AAEA,SAAQ,gBAAgB,OAAO;AACjC;AAEO,MAAM,sBAAsB,CAAC,YAClC,mBAAAA,SAAU,EAAE,KAAK,WAAW,MAAM,CAAC;AAE9B,MAAM,8BAA8B,OAIzC,SAC2B;AAC3B,QAAM,SAAS,MAAM,oBAAoB;AAEzC,SAAO,WAAW,cAAa,2BAAc,OAAO,YAAY,OAAO,IAAI,IACvE,OAAO,YAAY,MAAM,IAAI,IAC7B;AACN;AAEO,MAAM,oCAAoC,OAC/C,SACgC;AAChC,QAAM,SAAS,MAAM,4BAA4B,IAAI;AAErD,SAAO,OAAO,WAAW,WAAW,SAAS;AAC/C;AAEO,MAAM,4BAA4B,YAA6B;AACpE,QAAM,aAAa,MAAM,kCAAkC,YAAY;AAEvE,SAAO,cAAc;AACvB;",
|
|
6
6
|
"names": ["readPkgUp"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "skuba",
|
|
3
|
-
"version": "12.1.
|
|
3
|
+
"version": "12.1.1",
|
|
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"
|
|
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
|
-
"enhanced-resolve": "5.18.
|
|
119
|
+
"enhanced-resolve": "5.18.3",
|
|
120
120
|
"express": "5.1.0",
|
|
121
|
-
"fastify": "5.
|
|
122
|
-
"jest-diff": "30.0.
|
|
121
|
+
"fastify": "5.5.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": {
|
|
@@ -148,7 +148,7 @@
|
|
|
148
148
|
"entryPoint": "src/index.ts",
|
|
149
149
|
"template": null,
|
|
150
150
|
"type": "package",
|
|
151
|
-
"version": "12.0
|
|
151
|
+
"version": "12.1.0"
|
|
152
152
|
},
|
|
153
153
|
"scripts": {
|
|
154
154
|
"build": "scripts/build.sh",
|
|
@@ -162,7 +162,7 @@
|
|
|
162
162
|
"lint:packages": "pnpm --filter '!./template/**' lint",
|
|
163
163
|
"release": "pnpm --silent build && changeset publish",
|
|
164
164
|
"skuba": "pnpm --silent build && pnpm --silent skuba:exec",
|
|
165
|
-
"skuba:exec": "node
|
|
165
|
+
"skuba:exec": "node lib/skuba",
|
|
166
166
|
"stage": "changeset version && node ./.changeset/inject.js && pnpm format",
|
|
167
167
|
"test": "pnpm --silent skuba test --selectProjects unit",
|
|
168
168
|
"test:ci": "pnpm --silent skuba test --runInBand",
|
|
@@ -77,6 +77,9 @@ steps:
|
|
|
77
77
|
queue: <%- devBuildkiteQueueName %>
|
|
78
78
|
label: 🤞 Deploy Dev
|
|
79
79
|
concurrency_group: <%- teamName %>/deploy/gantry/<%- devGantryEnvironmentName %>
|
|
80
|
+
env:
|
|
81
|
+
DD_DEPLOYMENT_ENVIRONMENT: development
|
|
82
|
+
DD_DEPLOYMENT_SERVICE: <%- serviceName %>
|
|
80
83
|
key: deploy-dev
|
|
81
84
|
plugins:
|
|
82
85
|
- seek-jobs/gantry#v4.0.0:
|
|
@@ -93,6 +96,9 @@ steps:
|
|
|
93
96
|
branches: ${BUILDKITE_PIPELINE_DEFAULT_BRANCH}
|
|
94
97
|
concurrency_group: <%- teamName %>/deploy/gantry/<%- prodGantryEnvironmentName %>
|
|
95
98
|
depends_on: deploy-dev
|
|
99
|
+
env:
|
|
100
|
+
DD_DEPLOYMENT_ENVIRONMENT: production
|
|
101
|
+
DD_DEPLOYMENT_SERVICE: <%- serviceName %>
|
|
96
102
|
plugins:
|
|
97
103
|
- seek-jobs/gantry#v4.0.0:
|
|
98
104
|
command: apply
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
DEPLOYMENT=local
|
|
@@ -70,19 +70,19 @@ pnpm start:debug
|
|
|
70
70
|
|
|
71
71
|
This project is deployed through a [Buildkite pipeline](.buildkite/pipeline.yml).
|
|
72
72
|
|
|
73
|
-
- Commits to a feature branch can be deployed to the
|
|
74
|
-
- Commits to the default branch are automatically deployed to the
|
|
73
|
+
- Commits to a feature branch can be deployed to the development environment by unblocking a step in the Buildkite UI
|
|
74
|
+
- Commits to the default branch are automatically deployed to the development and production environments in sequence
|
|
75
75
|
|
|
76
76
|
To rapidly roll back a change,
|
|
77
77
|
retry an individual deployment step from the previous build in Buildkite.
|
|
78
|
-
Note that this will introduce drift between the head of the default Git branch and the live
|
|
78
|
+
Note that this will introduce drift between the head of the default Git branch and the live deployments;
|
|
79
79
|
use with caution and always follow up with a proper revert or fix in Git history.
|
|
80
80
|
|
|
81
81
|
## Support
|
|
82
82
|
|
|
83
83
|
### Dev
|
|
84
84
|
|
|
85
|
-
TODO: add support links for the dev
|
|
85
|
+
TODO: add support links for the dev deployment.
|
|
86
86
|
|
|
87
87
|
<!--
|
|
88
88
|
- CloudWatch dashboard
|
|
@@ -92,7 +92,7 @@ TODO: add support links for the dev environment.
|
|
|
92
92
|
|
|
93
93
|
### Prod
|
|
94
94
|
|
|
95
|
-
TODO: add support links for the prod
|
|
95
|
+
TODO: add support links for the prod deployment.
|
|
96
96
|
|
|
97
97
|
<!--
|
|
98
98
|
- CloudWatch dashboard
|
|
@@ -9,9 +9,14 @@ owner: '{{values "owner"}}'
|
|
|
9
9
|
image: '{{values "image"}}'
|
|
10
10
|
|
|
11
11
|
env:
|
|
12
|
-
|
|
12
|
+
DEPLOYMENT: '{{values "deployment"}}'
|
|
13
13
|
SERVICE: '{{values "service"}}'
|
|
14
14
|
|
|
15
|
+
DD_ENV: '{{values "env"}}'
|
|
16
|
+
DD_SERVICE: '{{values "service"}}'
|
|
17
|
+
|
|
18
|
+
OPENTELEMETRY_ENABLED: '{{values "openTelemetry.enabled"}}'
|
|
19
|
+
|
|
15
20
|
{{if .Values.cloudwatchDashboardDisabled}}
|
|
16
21
|
cloudwatchDashboardDisabled: {{values "cloudwatchDashboardDisabled"}}
|
|
17
22
|
{{end}}
|
|
@@ -20,6 +25,17 @@ cloudwatchDashboardDisabled: {{values "cloudwatchDashboardDisabled"}}
|
|
|
20
25
|
datadogSecretId: '{{values "datadogSecretId"}}'
|
|
21
26
|
{{end}}
|
|
22
27
|
|
|
28
|
+
# Uncomment if the `tin` tier is acceptable for your SEEK Auth Sidecar logs
|
|
29
|
+
# The eeeoh log forwarder bypasses Amazon CloudWatch for cost savings
|
|
30
|
+
# logSink:
|
|
31
|
+
# forwarder: eeeoh
|
|
32
|
+
# splunkIndex: '{{values "logSink.splunkIndex"}}'
|
|
33
|
+
|
|
34
|
+
openTelemetry:
|
|
35
|
+
datadogEnvironmentName: '{{values "env"}}'
|
|
36
|
+
enabled: {{values "openTelemetry.enabled"}}
|
|
37
|
+
useGantryServiceName: true
|
|
38
|
+
|
|
23
39
|
{{if .Values.pagerDutyEndpoint}}
|
|
24
40
|
pagerDutyEndpoint: '{{values "pagerDutyEndpoint"}}'
|
|
25
41
|
{{end}}
|
|
@@ -13,22 +13,28 @@
|
|
|
13
13
|
"test:watch": "skuba test --watch"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@
|
|
16
|
+
"@opentelemetry/api": "^1.9.0",
|
|
17
|
+
"@opentelemetry/core": "^2.0.0",
|
|
18
|
+
"@opentelemetry/exporter-trace-otlp-grpc": "^0.203.0",
|
|
19
|
+
"@opentelemetry/instrumentation-aws-sdk": "^0.56.0",
|
|
20
|
+
"@opentelemetry/instrumentation-http": "^0.203.0",
|
|
21
|
+
"@opentelemetry/propagator-b3": "^2.0.0",
|
|
22
|
+
"@opentelemetry/sdk-node": "^0.203.0",
|
|
23
|
+
"@seek/logger": "11.0.0",
|
|
17
24
|
"express": "^5.0.0",
|
|
18
|
-
"hot-shots": "^
|
|
19
|
-
"seek-datadog-custom-metrics": "^
|
|
25
|
+
"hot-shots": "^11.0.0",
|
|
26
|
+
"seek-datadog-custom-metrics": "^6.0.0",
|
|
20
27
|
"skuba-dive": "^2.0.0"
|
|
21
28
|
},
|
|
22
29
|
"devDependencies": {
|
|
23
30
|
"@types/express": "^5.0.0",
|
|
24
31
|
"@types/node": "^22.13.10",
|
|
25
32
|
"@types/supertest": "^6.0.0",
|
|
26
|
-
"mime": "^4.0.1",
|
|
27
33
|
"pino-pretty": "^13.0.0",
|
|
28
34
|
"skuba": "*",
|
|
29
35
|
"supertest": "^7.0.0"
|
|
30
36
|
},
|
|
31
|
-
"packageManager": "pnpm@10.
|
|
37
|
+
"packageManager": "pnpm@10.14.0",
|
|
32
38
|
"engines": {
|
|
33
39
|
"node": ">=22"
|
|
34
40
|
}
|
|
@@ -3,8 +3,8 @@ import type { Handler } from 'express';
|
|
|
3
3
|
/**
|
|
4
4
|
* Signifies that the API is available to serve requests.
|
|
5
5
|
*
|
|
6
|
-
* The
|
|
7
|
-
* unhealthy and needs to be recycled.
|
|
6
|
+
* The workload hosting environment calls this endpoint to see if the container
|
|
7
|
+
* is unhealthy and needs to be recycled.
|
|
8
8
|
*/
|
|
9
9
|
export const healthCheckHandler: Handler = (_req, res) => {
|
|
10
10
|
res.send('');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Env } from 'skuba-dive';
|
|
2
2
|
|
|
3
3
|
interface Config {
|
|
4
|
-
|
|
4
|
+
deployment: Deployment;
|
|
5
5
|
|
|
6
6
|
logLevel: string;
|
|
7
7
|
name: string;
|
|
@@ -11,17 +11,17 @@ interface Config {
|
|
|
11
11
|
port: number | null;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
type
|
|
14
|
+
type Deployment = (typeof deployments)[number];
|
|
15
15
|
|
|
16
16
|
const dev = '<%- devGantryEnvironmentName %>';
|
|
17
17
|
const prod = '<%- prodGantryEnvironmentName %>';
|
|
18
18
|
|
|
19
|
-
const
|
|
19
|
+
const deployments = ['local', 'test', dev, prod] as const;
|
|
20
20
|
|
|
21
|
-
const
|
|
21
|
+
const deployment = Env.oneOf(deployments)('DEPLOYMENT');
|
|
22
22
|
|
|
23
23
|
/* istanbul ignore next: config verification makes more sense in a smoke test */
|
|
24
|
-
const configs: Record<
|
|
24
|
+
const configs: Record<Deployment, () => Omit<Config, 'deployment'>> = {
|
|
25
25
|
local: () => ({
|
|
26
26
|
logLevel: 'debug',
|
|
27
27
|
name: '<%- serviceName %>',
|
|
@@ -60,6 +60,6 @@ const configs: Record<Environment, () => Omit<Config, 'environment'>> = {
|
|
|
60
60
|
};
|
|
61
61
|
|
|
62
62
|
export const config: Config = {
|
|
63
|
-
...configs[
|
|
64
|
-
|
|
63
|
+
...configs[deployment](),
|
|
64
|
+
deployment,
|
|
65
65
|
};
|
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
import createLogger from '@seek/logger';
|
|
1
|
+
import { createLogger } from '@seek/logger';
|
|
2
2
|
|
|
3
3
|
import { config } from 'src/config.js';
|
|
4
4
|
|
|
5
5
|
export const logger = createLogger({
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
eeeoh: {
|
|
7
|
+
/**
|
|
8
|
+
* TODO: choose an appropriate Datadog log tier.
|
|
9
|
+
*
|
|
10
|
+
* https://github.com/seek-oss/logger/blob/master/docs/eeeoh.md#datadog-log-tiers
|
|
11
|
+
*/
|
|
12
|
+
datadog: 'tin',
|
|
13
|
+
team: '<%- teamName %>',
|
|
14
|
+
use: 'environment',
|
|
9
15
|
},
|
|
10
16
|
|
|
11
17
|
level: config.logLevel,
|
|
12
18
|
|
|
13
|
-
name: config.name,
|
|
14
|
-
|
|
15
19
|
transport:
|
|
16
|
-
config.
|
|
20
|
+
config.deployment === 'local' ? { target: 'pino-pretty' } : undefined,
|
|
17
21
|
});
|
|
@@ -7,5 +7,5 @@ import { logger } from './logging.js';
|
|
|
7
7
|
|
|
8
8
|
/* istanbul ignore next: StatsD client is not our responsibility */
|
|
9
9
|
export const metricsClient = createStatsDClient(StatsD, config, (err) =>
|
|
10
|
-
logger.error(
|
|
10
|
+
logger.error(err, 'StatsD error'),
|
|
11
11
|
);
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenTelemetry tracing initialisation. This is a standalone TS/JS module that is not
|
|
3
|
+
* referenced by application source code directly. It is required at runtime using the
|
|
4
|
+
* node command's `--require` argument, see Dockerfile for details.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { propagation } from '@opentelemetry/api';
|
|
8
|
+
import { CompositePropagator } from '@opentelemetry/core';
|
|
9
|
+
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-grpc';
|
|
10
|
+
import { AwsInstrumentation } from '@opentelemetry/instrumentation-aws-sdk';
|
|
11
|
+
import { HttpInstrumentation } from '@opentelemetry/instrumentation-http';
|
|
12
|
+
import { B3InjectEncoding, B3Propagator } from '@opentelemetry/propagator-b3';
|
|
13
|
+
import { NodeSDK } from '@opentelemetry/sdk-node';
|
|
14
|
+
|
|
15
|
+
const app = 'opentelemetry';
|
|
16
|
+
const log = (level: string, msg: string, extra = {}) => {
|
|
17
|
+
const toLog = { msg, level, app, time: new Date().toISOString(), ...extra };
|
|
18
|
+
console.log(JSON.stringify(toLog)); // eslint-disable-line no-console
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const main = () => {
|
|
22
|
+
// Use B3 propagation to ensure proper propagation between systems that use
|
|
23
|
+
// OpenTelemetry and native Datadog APM, such as Istio/Envoy.
|
|
24
|
+
propagation.setGlobalPropagator(
|
|
25
|
+
new CompositePropagator({
|
|
26
|
+
propagators: [
|
|
27
|
+
new B3Propagator(),
|
|
28
|
+
new B3Propagator({ injectEncoding: B3InjectEncoding.MULTI_HEADER }),
|
|
29
|
+
],
|
|
30
|
+
}),
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
const sdk = new NodeSDK({
|
|
34
|
+
traceExporter: new OTLPTraceExporter(),
|
|
35
|
+
autoDetectResources: false,
|
|
36
|
+
instrumentations: [new HttpInstrumentation(), new AwsInstrumentation()],
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
sdk.start();
|
|
40
|
+
|
|
41
|
+
process.on('SIGTERM', () => {
|
|
42
|
+
sdk
|
|
43
|
+
.shutdown()
|
|
44
|
+
.then(() => log('info', 'OpenTelemetry successfully terminated'))
|
|
45
|
+
.catch((err: Error) =>
|
|
46
|
+
log('error', 'OpenTelemetry failed to terminate', { err }),
|
|
47
|
+
)
|
|
48
|
+
.finally(() => process.exit(0)); // eslint-disable-line no-process-exit
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
if (process.env.OPENTELEMETRY_ENABLED === 'true') {
|
|
53
|
+
main();
|
|
54
|
+
} else {
|
|
55
|
+
log('info', 'OpenTelemetry not enabled');
|
|
56
|
+
}
|
|
@@ -75,7 +75,7 @@ For inspiration in this space, check out:
|
|
|
75
75
|
|
|
76
76
|
### Dev
|
|
77
77
|
|
|
78
|
-
TODO: add support links for the dev
|
|
78
|
+
TODO: add support links for the dev deployment.
|
|
79
79
|
|
|
80
80
|
<!--
|
|
81
81
|
- CloudWatch dashboard
|
|
@@ -85,7 +85,7 @@ TODO: add support links for the dev environment.
|
|
|
85
85
|
|
|
86
86
|
### Prod
|
|
87
87
|
|
|
88
|
-
TODO: add support links for the prod
|
|
88
|
+
TODO: add support links for the prod deployment.
|
|
89
89
|
|
|
90
90
|
<!--
|
|
91
91
|
- CloudWatch dashboard
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@types/node": "^22.13.10",
|
|
20
|
-
"skuba": "
|
|
20
|
+
"skuba": "*"
|
|
21
21
|
},
|
|
22
|
-
"packageManager": "pnpm@10.
|
|
22
|
+
"packageManager": "pnpm@10.14.0",
|
|
23
23
|
"engines": {
|
|
24
24
|
"node": ">=22"
|
|
25
25
|
}
|
|
@@ -77,6 +77,9 @@ steps:
|
|
|
77
77
|
queue: <%- devBuildkiteQueueName %>
|
|
78
78
|
label: 🤞 Deploy Dev
|
|
79
79
|
concurrency_group: <%- teamName %>/deploy/gantry/<%- devGantryEnvironmentName %>
|
|
80
|
+
env:
|
|
81
|
+
DD_DEPLOYMENT_ENVIRONMENT: development
|
|
82
|
+
DD_DEPLOYMENT_SERVICE: <%- serviceName %>
|
|
80
83
|
key: deploy-dev
|
|
81
84
|
plugins:
|
|
82
85
|
- seek-jobs/gantry#v4.0.0:
|
|
@@ -93,6 +96,9 @@ steps:
|
|
|
93
96
|
branches: ${BUILDKITE_PIPELINE_DEFAULT_BRANCH}
|
|
94
97
|
concurrency_group: <%- teamName %>/deploy/gantry/<%- prodGantryEnvironmentName %>
|
|
95
98
|
depends_on: deploy-dev
|
|
99
|
+
env:
|
|
100
|
+
DD_DEPLOYMENT_ENVIRONMENT: production
|
|
101
|
+
DD_DEPLOYMENT_SERVICE: <%- serviceName %>
|
|
96
102
|
plugins:
|
|
97
103
|
- seek-jobs/gantry#v4.0.0:
|
|
98
104
|
command: apply
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
DEPLOYMENT=local
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
deployment: dev
|
|
2
|
+
env: development
|
|
2
3
|
|
|
3
4
|
maxInstanceCount: 1
|
|
4
5
|
minInstanceCount: 1
|
|
@@ -7,5 +8,4 @@ minInstanceCount: 1
|
|
|
7
8
|
cloudwatchDashboardDisabled: true
|
|
8
9
|
|
|
9
10
|
openTelemetry:
|
|
10
|
-
|
|
11
|
-
enabled: false
|
|
11
|
+
enabled: true
|