skuba 3.17.2 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/jest/moduleNameMapper.js +4 -7
- package/package.json +6 -6
- package/template/express-rest-api/.buildkite/pipeline.yml +3 -3
- package/template/express-rest-api/Dockerfile +3 -0
- package/template/koa-rest-api/.buildkite/pipeline.yml +3 -3
- package/template/koa-rest-api/Dockerfile +3 -0
- package/template/koa-rest-api/README.md +1 -1
- package/template/koa-rest-api/package.json +1 -1
- package/template/lambda-sqs-worker/.buildkite/pipeline.yml +1 -0
- package/template/lambda-sqs-worker/package.json +1 -1
- package/template/lambda-sqs-worker/serverless.yml +18 -14
- package/template/lambda-sqs-worker-cdk/infra/__snapshots__/appStack.test.ts.snap +2 -0
- package/template/lambda-sqs-worker-cdk/infra/appStack.ts +3 -0
package/jest/moduleNameMapper.js
CHANGED
|
@@ -11,7 +11,7 @@ const {
|
|
|
11
11
|
/**
|
|
12
12
|
* Set a default `src` module alias for backward compatibility.
|
|
13
13
|
*
|
|
14
|
-
* TODO: drop this default in skuba
|
|
14
|
+
* TODO: drop this default in skuba v5.
|
|
15
15
|
*/
|
|
16
16
|
const DEFAULT_PATHS = { src: ['src'], 'src/*': ['src/*'] };
|
|
17
17
|
|
|
@@ -20,8 +20,7 @@ const DEFAULT_PATHS = { src: ['src'], 'src/*': ['src/*'] };
|
|
|
20
20
|
*/
|
|
21
21
|
const getConfigFromDisk = () => {
|
|
22
22
|
const filename =
|
|
23
|
-
|
|
24
|
-
findConfigFile('.', sys.fileExists.bind(this)) || 'tsconfig.json';
|
|
23
|
+
findConfigFile('.', sys.fileExists.bind(this)) ?? 'tsconfig.json';
|
|
25
24
|
|
|
26
25
|
return readConfigFile(filename, sys.readFile.bind(this)).config;
|
|
27
26
|
};
|
|
@@ -33,8 +32,7 @@ module.exports.createModuleNameMapper = (getConfig = getConfigFromDisk) => {
|
|
|
33
32
|
const parsedConfig = parseJsonConfigFileContent(json, sys, '.');
|
|
34
33
|
|
|
35
34
|
const paths = Object.fromEntries(
|
|
36
|
-
|
|
37
|
-
Object.entries(parsedConfig.options.paths || DEFAULT_PATHS).flatMap(
|
|
35
|
+
Object.entries(parsedConfig.options.paths ?? DEFAULT_PATHS).flatMap(
|
|
38
36
|
([key, values]) => [
|
|
39
37
|
// Pass through the input path entry almost verbatim.
|
|
40
38
|
// We trim a trailing slash because TypeScript allows `import 'src'`
|
|
@@ -66,8 +64,7 @@ module.exports.createModuleNameMapper = (getConfig = getConfigFromDisk) => {
|
|
|
66
64
|
),
|
|
67
65
|
);
|
|
68
66
|
|
|
69
|
-
|
|
70
|
-
const prefix = path.join('<rootDir>', parsedConfig.options.baseUrl || '.');
|
|
67
|
+
const prefix = path.join('<rootDir>', parsedConfig.options.baseUrl ?? '.');
|
|
71
68
|
|
|
72
69
|
const moduleNameMapper = pathsToModuleNameMapper(paths, { prefix });
|
|
73
70
|
|
package/package.json
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
"skuba": "lib/skuba.js"
|
|
6
6
|
},
|
|
7
7
|
"engines": {
|
|
8
|
-
"node": ">=
|
|
8
|
+
"node": ">=14.18"
|
|
9
9
|
},
|
|
10
|
-
"version": "
|
|
10
|
+
"version": "4.0.0",
|
|
11
11
|
"main": "lib/index.js",
|
|
12
12
|
"typings": "lib/index.d.ts",
|
|
13
13
|
"files": [
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"ejs": "^3.1.6",
|
|
71
71
|
"enquirer": "^2.3.6",
|
|
72
72
|
"eslint": "^7.27.0",
|
|
73
|
-
"eslint-config-skuba": "1.0.
|
|
73
|
+
"eslint-config-skuba": "1.0.14",
|
|
74
74
|
"execa": "^5.0.0",
|
|
75
75
|
"fdir": "^5.0.0",
|
|
76
76
|
"fs-extra": "^10.0.0",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"get-port": "^5.1.1",
|
|
79
79
|
"ignore": "^5.1.8",
|
|
80
80
|
"is-installed-globally": "^0.4.0",
|
|
81
|
-
"isomorphic-git": "^1.
|
|
81
|
+
"isomorphic-git": "^1.11.1",
|
|
82
82
|
"jest": "^27.4.5",
|
|
83
83
|
"latest-version": "^5.1.0",
|
|
84
84
|
"lodash.mergewith": "^4.6.2",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"prettier": "~2.5.0",
|
|
90
90
|
"read-pkg-up": "^7.0.1",
|
|
91
91
|
"runtypes": "^6.0.0",
|
|
92
|
-
"semantic-release": "^
|
|
92
|
+
"semantic-release": "^19.0.0",
|
|
93
93
|
"serialize-error": "^8.0.1",
|
|
94
94
|
"simple-git": "^3.0.0",
|
|
95
95
|
"strip-ansi": "^6.0.1",
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
"typescript": "~4.4.4"
|
|
102
102
|
},
|
|
103
103
|
"peerDependencies": {
|
|
104
|
-
"skuba-dive": "1"
|
|
104
|
+
"skuba-dive": "1 || 2"
|
|
105
105
|
},
|
|
106
106
|
"peerDependenciesMeta": {
|
|
107
107
|
"skuba-dive": {
|
|
@@ -69,7 +69,7 @@ steps:
|
|
|
69
69
|
- *aws-sm
|
|
70
70
|
- *private-npm
|
|
71
71
|
- *docker-ecr-cache
|
|
72
|
-
- seek-jobs/gantry#v1.
|
|
72
|
+
- seek-jobs/gantry#v1.6.1:
|
|
73
73
|
command: build
|
|
74
74
|
file: gantry.build.yml
|
|
75
75
|
region: <%- region %>
|
|
@@ -85,7 +85,7 @@ steps:
|
|
|
85
85
|
concurrency_group: <%- teamName %>/deploy/gantry/<%- devGantryEnvironmentName %>
|
|
86
86
|
key: deploy-dev
|
|
87
87
|
plugins:
|
|
88
|
-
- seek-jobs/gantry#v1.
|
|
88
|
+
- seek-jobs/gantry#v1.6.1:
|
|
89
89
|
command: apply
|
|
90
90
|
environment: <%- devGantryEnvironmentName %>
|
|
91
91
|
file: gantry.apply.yml
|
|
@@ -101,7 +101,7 @@ steps:
|
|
|
101
101
|
concurrency_group: <%- teamName %>/deploy/gantry/<%- prodGantryEnvironmentName %>
|
|
102
102
|
depends_on: deploy-dev
|
|
103
103
|
plugins:
|
|
104
|
-
- seek-jobs/gantry#v1.
|
|
104
|
+
- seek-jobs/gantry#v1.6.1:
|
|
105
105
|
command: apply
|
|
106
106
|
environment: <%- prodGantryEnvironmentName %>
|
|
107
107
|
file: gantry.apply.yml
|
|
@@ -69,7 +69,7 @@ steps:
|
|
|
69
69
|
- *aws-sm
|
|
70
70
|
- *private-npm
|
|
71
71
|
- *docker-ecr-cache
|
|
72
|
-
- seek-jobs/gantry#v1.
|
|
72
|
+
- seek-jobs/gantry#v1.6.1:
|
|
73
73
|
command: build
|
|
74
74
|
file: gantry.build.yml
|
|
75
75
|
region: <%- region %>
|
|
@@ -85,7 +85,7 @@ steps:
|
|
|
85
85
|
concurrency_group: <%- teamName %>/deploy/gantry/<%- devGantryEnvironmentName %>
|
|
86
86
|
key: deploy-dev
|
|
87
87
|
plugins:
|
|
88
|
-
- seek-jobs/gantry#v1.
|
|
88
|
+
- seek-jobs/gantry#v1.6.1:
|
|
89
89
|
command: apply
|
|
90
90
|
environment: <%- devGantryEnvironmentName %>
|
|
91
91
|
file: gantry.apply.yml
|
|
@@ -101,7 +101,7 @@ steps:
|
|
|
101
101
|
concurrency_group: <%- teamName %>/deploy/gantry/<%- prodGantryEnvironmentName %>
|
|
102
102
|
depends_on: deploy-dev
|
|
103
103
|
plugins:
|
|
104
|
-
- seek-jobs/gantry#v1.
|
|
104
|
+
- seek-jobs/gantry#v1.6.1:
|
|
105
105
|
command: apply
|
|
106
106
|
environment: <%- prodGantryEnvironmentName %>
|
|
107
107
|
file: gantry.apply.yml
|
|
@@ -36,7 +36,7 @@ This would be replaced with an external data store in production.
|
|
|
36
36
|
|
|
37
37
|
This project is deployed as a containerised application with [Gantry].
|
|
38
38
|
A typical resource API instance does not require more than 1 vCPU,
|
|
39
|
-
so we
|
|
39
|
+
so we eschew clustering configurations in favour of a single Node.js process per container.
|
|
40
40
|
Under load, we autoscale horizontally in terms of container count up to `autoScaling.maxCount`.
|
|
41
41
|
|
|
42
42
|
Gantry configures [CodeDeploy] for a blue-green deployment approach.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"@koa/router": "^10.1.1",
|
|
4
4
|
"@opentelemetry/api": "^1.0.4",
|
|
5
5
|
"@opentelemetry/exporter-collector-grpc": "^0.25.0",
|
|
6
|
-
"@opentelemetry/instrumentation-aws-sdk": "^0.
|
|
6
|
+
"@opentelemetry/instrumentation-aws-sdk": "^0.5.0",
|
|
7
7
|
"@opentelemetry/instrumentation-http": "^0.27.0",
|
|
8
8
|
"@opentelemetry/sdk-node": "^0.27.0",
|
|
9
9
|
"@seek/logger": "^5.0.1",
|
|
@@ -3,16 +3,17 @@ service: <%- serviceName %>
|
|
|
3
3
|
configValidationMode: error
|
|
4
4
|
variablesResolutionMode: 20210326
|
|
5
5
|
|
|
6
|
+
params:
|
|
7
|
+
default:
|
|
8
|
+
description: <%- description %>
|
|
9
|
+
dev:
|
|
10
|
+
deploymentBucket: 'TODO: deploymentBucketName'
|
|
11
|
+
isProduction: false
|
|
12
|
+
prod:
|
|
13
|
+
deploymentBucket: 'TODO: deploymentBucketName'
|
|
14
|
+
isProduction: true
|
|
15
|
+
|
|
6
16
|
custom:
|
|
7
|
-
description: <%- description %>
|
|
8
|
-
env: ${self:custom.envs.${env:ENVIRONMENT}}
|
|
9
|
-
envs:
|
|
10
|
-
dev:
|
|
11
|
-
deploymentBucket: 'TODO: deploymentBucketName'
|
|
12
|
-
isProduction: false
|
|
13
|
-
prod:
|
|
14
|
-
deploymentBucket: 'TODO: deploymentBucketName'
|
|
15
|
-
isProduction: true
|
|
16
17
|
prune:
|
|
17
18
|
automatic: true
|
|
18
19
|
number: 3
|
|
@@ -22,7 +23,6 @@ plugins:
|
|
|
22
23
|
- serverless-prune-plugin
|
|
23
24
|
|
|
24
25
|
provider:
|
|
25
|
-
lambdaHashingVersion: 20201221
|
|
26
26
|
logRetentionInDays: 30
|
|
27
27
|
name: aws
|
|
28
28
|
region: ap-southeast-2
|
|
@@ -34,7 +34,7 @@ provider:
|
|
|
34
34
|
deploymentBucket:
|
|
35
35
|
# Use a shared account-level bucket for Lambda bundles and other artefacts.
|
|
36
36
|
# This is easier to manage in terms of access, deployment, and tagging.
|
|
37
|
-
name: ${
|
|
37
|
+
name: ${param:deploymentBucket}
|
|
38
38
|
iam:
|
|
39
39
|
role:
|
|
40
40
|
statements:
|
|
@@ -59,7 +59,7 @@ provider:
|
|
|
59
59
|
# https://rfc.skinfra.xyz/RFC019-AWS-Tagging-Standard.html#seekdatatypes
|
|
60
60
|
# seek:data:types:restricted: job-ads
|
|
61
61
|
seek:env:label: ${env:ENVIRONMENT}
|
|
62
|
-
seek:env:production: ${
|
|
62
|
+
seek:env:production: ${param:isProduction}
|
|
63
63
|
seek:owner:team: '<%- teamName %>'
|
|
64
64
|
seek:source:sha: ${env:BUILDKITE_COMMIT, 'na'}
|
|
65
65
|
seek:source:url: 'https://github.com/SEEK-Jobs/<%- repoName %>'
|
|
@@ -74,7 +74,7 @@ functions:
|
|
|
74
74
|
Worker:
|
|
75
75
|
name: ${self:service}
|
|
76
76
|
handler: lib/app.handler
|
|
77
|
-
description: ${
|
|
77
|
+
description: ${param:description}
|
|
78
78
|
memorySize: 128
|
|
79
79
|
reservedConcurrency: 20
|
|
80
80
|
timeout: 30
|
|
@@ -85,6 +85,8 @@ functions:
|
|
|
85
85
|
environment:
|
|
86
86
|
# https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/node-reusing-connections.html
|
|
87
87
|
AWS_NODEJS_CONNECTION_REUSE_ENABLED: 1
|
|
88
|
+
# https://nodejs.org/api/cli.html#cli_node_options_options
|
|
89
|
+
NODE_OPTIONS: --enable-source-maps
|
|
88
90
|
|
|
89
91
|
ENVIRONMENT: ${env:ENVIRONMENT}
|
|
90
92
|
SERVICE: ${self:service}
|
|
@@ -104,12 +106,14 @@ functions:
|
|
|
104
106
|
environment:
|
|
105
107
|
# https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/node-reusing-connections.html
|
|
106
108
|
AWS_NODEJS_CONNECTION_REUSE_ENABLED: 1
|
|
109
|
+
# https://nodejs.org/api/cli.html#cli_node_options_options
|
|
110
|
+
NODE_OPTIONS: --enable-source-maps
|
|
107
111
|
|
|
108
112
|
FUNCTION_NAME_TO_INVOKE: ${self:functions.Worker.name}
|
|
109
113
|
|
|
110
114
|
resources:
|
|
111
115
|
# This becomes the Lambda application's description
|
|
112
|
-
Description: ${
|
|
116
|
+
Description: ${param:description}
|
|
113
117
|
|
|
114
118
|
Resources:
|
|
115
119
|
DeadLetterQueue:
|
|
@@ -155,6 +155,7 @@ Object {
|
|
|
155
155
|
"Environment": Object {
|
|
156
156
|
"Variables": Object {
|
|
157
157
|
"AWS_NODEJS_CONNECTION_REUSE_ENABLED": "1",
|
|
158
|
+
"NODE_OPTIONS": "--enable-source-maps",
|
|
158
159
|
"SOMETHING": "dev",
|
|
159
160
|
},
|
|
160
161
|
},
|
|
@@ -509,6 +510,7 @@ Object {
|
|
|
509
510
|
"Environment": Object {
|
|
510
511
|
"Variables": Object {
|
|
511
512
|
"AWS_NODEJS_CONNECTION_REUSE_ENABLED": "1",
|
|
513
|
+
"NODE_OPTIONS": "--enable-source-maps",
|
|
512
514
|
"SOMETHING": "prod",
|
|
513
515
|
},
|
|
514
516
|
},
|
|
@@ -57,7 +57,10 @@ export class AppStack extends Stack {
|
|
|
57
57
|
functionName: '<%- serviceName %>',
|
|
58
58
|
environmentEncryption: kmsKey,
|
|
59
59
|
environment: {
|
|
60
|
+
// https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/node-reusing-connections.html
|
|
60
61
|
AWS_NODEJS_CONNECTION_REUSE_ENABLED: '1',
|
|
62
|
+
// https://nodejs.org/api/cli.html#cli_node_options_options
|
|
63
|
+
NODE_OPTIONS: '--enable-source-maps',
|
|
61
64
|
...context.workerLambda.environment,
|
|
62
65
|
},
|
|
63
66
|
});
|