skuba 3.15.0-beta.0 → 3.15.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/README.md +61 -2
  2. package/lib/api/buildkite/annotate.d.ts +26 -0
  3. package/lib/api/buildkite/annotate.js +47 -0
  4. package/lib/api/buildkite/annotate.js.map +1 -0
  5. package/lib/api/buildkite/index.d.ts +3 -32
  6. package/lib/api/buildkite/index.js +4 -49
  7. package/lib/api/buildkite/index.js.map +1 -1
  8. package/lib/api/buildkite/md.d.ts +6 -0
  9. package/lib/api/buildkite/md.js +10 -0
  10. package/lib/api/buildkite/md.js.map +1 -0
  11. package/lib/api/jest/index.d.ts +1 -1
  12. package/lib/api/jest/index.js.map +1 -1
  13. package/lib/cli/adapter/prettier.d.ts +2 -5
  14. package/lib/cli/adapter/prettier.js +12 -14
  15. package/lib/cli/adapter/prettier.js.map +1 -1
  16. package/lib/cli/configure/analysis/files.js.map +1 -1
  17. package/lib/cli/configure/analysis/git.d.ts +1 -1
  18. package/lib/cli/configure/analysis/git.js +11 -17
  19. package/lib/cli/configure/analysis/git.js.map +1 -1
  20. package/lib/cli/configure/analysis/project.js.map +1 -1
  21. package/lib/cli/configure/index.js +2 -2
  22. package/lib/cli/configure/index.js.map +1 -1
  23. package/lib/cli/configure/modules/tsconfig.js +1 -1
  24. package/lib/cli/configure/modules/tsconfig.js.map +1 -1
  25. package/lib/cli/configure/processing/record.d.ts +2 -2
  26. package/lib/cli/configure/processing/record.js +2 -2
  27. package/lib/cli/configure/processing/record.js.map +1 -1
  28. package/lib/cli/format.js +3 -7
  29. package/lib/cli/format.js.map +1 -1
  30. package/lib/cli/init/getConfig.js.map +1 -1
  31. package/lib/cli/init/git.d.ts +2 -3
  32. package/lib/cli/init/git.js +41 -10
  33. package/lib/cli/init/git.js.map +1 -1
  34. package/lib/cli/init/index.js +3 -3
  35. package/lib/cli/init/index.js.map +1 -1
  36. package/lib/cli/lint/eslint.js +3 -4
  37. package/lib/cli/lint/eslint.js.map +1 -1
  38. package/lib/cli/lint/external.js +75 -14
  39. package/lib/cli/lint/external.js.map +1 -1
  40. package/lib/cli/lint/index.d.ts +1 -1
  41. package/lib/cli/lint/index.js +2 -1
  42. package/lib/cli/lint/index.js.map +1 -1
  43. package/lib/cli/lint/prettier.js +3 -4
  44. package/lib/cli/lint/prettier.js.map +1 -1
  45. package/lib/cli/lint/types.d.ts +9 -0
  46. package/lib/cli/node.js +1 -1
  47. package/lib/cli/node.js.map +1 -1
  48. package/lib/cli/start.js +1 -1
  49. package/lib/cli/start.js.map +1 -1
  50. package/lib/utils/copy.js.map +1 -1
  51. package/lib/utils/dir.js.map +1 -1
  52. package/lib/utils/exec.d.ts +2 -1
  53. package/lib/utils/exec.js +4 -8
  54. package/lib/utils/exec.js.map +1 -1
  55. package/lib/utils/worker.d.ts +13 -1
  56. package/lib/utils/worker.js +25 -8
  57. package/lib/utils/worker.js.map +1 -1
  58. package/lib/wrapper/functionHandler.js +5 -0
  59. package/lib/wrapper/functionHandler.js.map +1 -1
  60. package/lib/wrapper/http.js +11 -7
  61. package/lib/wrapper/http.js.map +1 -1
  62. package/package.json +7 -6
  63. package/template/express-rest-api/.buildkite/pipeline.yml +3 -3
  64. package/template/express-rest-api/README.md +0 -12
  65. package/template/express-rest-api/package.json +1 -1
  66. package/template/express-rest-api/src/app.ts +2 -0
  67. package/template/greeter/README.md +0 -12
  68. package/template/koa-rest-api/.buildkite/pipeline.yml +3 -3
  69. package/template/koa-rest-api/README.md +0 -12
  70. package/template/koa-rest-api/package.json +1 -1
  71. package/template/koa-rest-api/src/framework/server.ts +5 -0
  72. package/template/koa-rest-api/src/framework/validation.ts +1 -1
  73. package/template/lambda-sqs-worker/README.md +0 -12
  74. package/template/lambda-sqs-worker/package.json +1 -1
  75. package/template/lambda-sqs-worker/serverless.yml +5 -2
  76. package/template/lambda-sqs-worker/src/framework/handler.ts +1 -1
  77. package/template/oss-npm-package/README.md +0 -14
  78. package/template/private-npm-package/README.md +0 -14
@@ -11,16 +11,27 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.postWorkerOutput = exports.execWorkerThread = void 0;
13
13
  const worker_threads_1 = require("worker_threads");
14
+ const logging_1 = require("./logging");
14
15
  /**
15
16
  * Executes a script at `filepath` in a Node.js worker thread.
16
17
  */
17
18
  const execWorkerThread = (filepath, input) => __awaiter(void 0, void 0, void 0, function* () {
19
+ let output;
20
+ let messageReceived = false;
18
21
  return new Promise((resolve, reject) => new worker_threads_1.Worker(filepath, {
19
22
  workerData: input,
20
23
  })
21
24
  .on('error', reject)
22
- .on('exit', (code) => reject(new Error(`Worker exited with code: ${code}`)))
23
- .on('message', (message) => resolve(message))
25
+ .on('exit', (code) => messageReceived
26
+ ? resolve(output)
27
+ : reject(new Error(code
28
+ ? `Worker thread failed with exit code ${code}`
29
+ : 'Worker thread exited without posting a message')))
30
+ .on('message', (message) => {
31
+ // Defer promise resolution to `exit` so stdio can settle.
32
+ output = message;
33
+ messageReceived = true;
34
+ })
24
35
  .on('messageerror', (err) => reject(err)));
25
36
  });
26
37
  exports.execWorkerThread = execWorkerThread;
@@ -28,12 +39,18 @@ exports.execWorkerThread = execWorkerThread;
28
39
  * Runs a function in a Node.js worker thread context, forwarding the result
29
40
  * to the parent thread.
30
41
  */
31
- const postWorkerOutput = (fn) => __awaiter(void 0, void 0, void 0, function* () {
32
- if (!worker_threads_1.parentPort) {
33
- throw new Error('startWorkerThread called outside of a worker context');
42
+ const postWorkerOutput = (fn, logger = logging_1.log) => {
43
+ const port = worker_threads_1.parentPort;
44
+ if (!port) {
45
+ logger.err('`postWorkerOutput` called outside of a worker thread context');
46
+ process.exit(1);
34
47
  }
35
- const output = yield fn(worker_threads_1.workerData);
36
- worker_threads_1.parentPort.postMessage(output);
37
- });
48
+ fn(worker_threads_1.workerData)
49
+ .then((output) => port.postMessage(output))
50
+ .catch((err) => {
51
+ logger.err(err);
52
+ process.exit(1);
53
+ });
54
+ };
38
55
  exports.postWorkerOutput = postWorkerOutput;
39
56
  //# sourceMappingURL=worker.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"worker.js","sourceRoot":"","sources":["../../src/utils/worker.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mDAAgE;AAEhE;;GAEG;AACI,MAAM,gBAAgB,GAAG,CAC9B,QAAgB,EAChB,KAAY,EACZ,EAAE;IACF,OAAA,IAAI,OAAO,CAAS,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,CACtC,IAAI,uBAAM,CAAC,QAAQ,EAAE;QACnB,UAAU,EAAE,KAAK;KAClB,CAAC;SACC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC;SACnB,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CACnB,MAAM,CAAC,IAAI,KAAK,CAAC,4BAA4B,IAAI,EAAE,CAAC,CAAC,CACtD;SACA,EAAE,CAAC,SAAS,EAAE,CAAC,OAAe,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;SACpD,EAAE,CAAC,cAAc,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAC5C,CAAA;EAAA,CAAC;AAdS,QAAA,gBAAgB,oBAczB;AAEJ;;;GAGG;AACI,MAAM,gBAAgB,GAAG,CAC9B,EAAqC,EACrC,EAAE;IACF,IAAI,CAAC,2BAAU,EAAE;QACf,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;KACzE;IAED,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,2BAAU,CAAC,CAAC;IAEpC,2BAAU,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;AACjC,CAAC,CAAA,CAAC;AAVW,QAAA,gBAAgB,oBAU3B"}
1
+ {"version":3,"file":"worker.js","sourceRoot":"","sources":["../../src/utils/worker.ts"],"names":[],"mappings":";;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E,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;SAC1C,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;QACb,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAEhB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACP,CAAC,CAAC;AAnBW,QAAA,gBAAgB,oBAmB3B"}
@@ -8,8 +8,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
11
14
  Object.defineProperty(exports, "__esModule", { value: true });
12
15
  exports.runFunctionHandler = void 0;
16
+ const function_arguments_1 = __importDefault(require("function-arguments"));
13
17
  const logging_1 = require("../utils/logging");
14
18
  const validation_1 = require("../utils/validation");
15
19
  const http_1 = require("./http");
@@ -26,6 +30,7 @@ const runFunctionHandler = ({ availablePort, entryPoint, functionName, }) => __a
26
30
  logging_1.log.subtle(logging_1.log.bold(functionName), 'is not a function');
27
31
  return;
28
32
  }
33
+ logging_1.log.warn(logging_1.log.bold(functionName), `(${(0, function_arguments_1.default)(fn).join(', ')})`);
29
34
  const requestListener = (0, http_1.createRequestListenerFromFunction)(fn);
30
35
  return (0, http_1.serveRequestListener)(requestListener, availablePort);
31
36
  });
@@ -1 +1 @@
1
- {"version":3,"file":"functionHandler.js","sourceRoot":"","sources":["../../src/wrapper/functionHandler.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8CAAuC;AACvC,oDAA2D;AAE3D,iCAGgB;AAQhB;;GAEG;AACI,MAAM,kBAAkB,GAAG,CAAO,EACvC,aAAa,EACb,UAAU,EACV,YAAY,GACP,EAAiB,EAAE;IACxB,IAAI,CAAC,IAAA,qBAAQ,EAAC,UAAU,CAAC,EAAE;QACzB,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EAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAE/D,MAAM,eAAe,GAAG,IAAA,wCAAiC,EAAC,EAAE,CAAC,CAAC;IAE9D,OAAO,IAAA,2BAAoB,EAAC,eAAe,EAAE,aAAa,CAAC,CAAC;AAC9D,CAAC,CAAA,CAAC;AAtBW,QAAA,kBAAkB,sBAsB7B"}
@@ -23,18 +23,22 @@ const logging_1 = require("../utils/logging");
23
23
  * - The function's return value is JSON stringified into the response body.
24
24
  */
25
25
  const createRequestListenerFromFunction = (fn) => (req, res) => __awaiter(void 0, void 0, void 0, function* () {
26
- const writeJsonResponse = (statusCode, jsonResponse) => new Promise((resolve, reject) => res
27
- .writeHead(statusCode, { 'Content-Type': 'application/json' })
28
- .write(JSON.stringify(jsonResponse, null, 2), 'utf8', (err) => err ? reject(err) : res.end(resolve)));
26
+ const writeJsonResponse = (statusCode, jsonResponse) => {
27
+ res.writeHead(statusCode, { 'Content-Type': 'application/json' });
28
+ return new Promise((resolve, reject) => jsonResponse === undefined
29
+ ? res.end(resolve)
30
+ : res.write(JSON.stringify(jsonResponse, null, 2), 'utf8', (err) => err ? reject(err) : res.end(resolve)));
31
+ };
29
32
  try {
30
33
  const requestBody = yield new Promise((resolve, reject) => {
31
- let data = '';
34
+ const data = [];
32
35
  req
33
- .on('data', (chunk) => (data += chunk))
34
- .on('end', () => resolve(data))
36
+ .on('data', (chunk) => data.push(chunk))
37
+ .on('end', () => resolve(Buffer.concat(data).toString()))
35
38
  .on('error', (err) => reject(err));
36
39
  });
37
- const jsonRequest = JSON.parse(requestBody);
40
+ // Treat an empty body as no arguments
41
+ const jsonRequest = requestBody ? JSON.parse(requestBody) : [];
38
42
  // Pass a non-array request body as the first parameter
39
43
  const args = Array.isArray(jsonRequest) ? jsonRequest : [jsonRequest];
40
44
  const response = yield fn(...args);
@@ -1 +1 @@
1
- {"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/wrapper/http.ts"],"names":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AG,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;QAEtE,MAAM,QAAQ,GAAY,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;QAE5C,MAAM,iBAAiB,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;KACxC;IAAC,OAAO,GAAG,EAAE;QACZ,MAAM,iBAAiB,CAAC,GAAG,EAAE,IAAA,gCAAc,EAAC,GAAG,CAAC,CAAC,CAAC;KACnD;AACH,CAAC,CAAA,CAAC;AAvCS,QAAA,iCAAiC,qCAuC1C;AAEJ;;;;GAIG;AACI,MAAM,oBAAoB,GAAG,CAClC,eAAqC,EACrC,IAAa,EACb,EAAE;IACF,MAAM,MAAM,GAAG,cAAI,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC;IAElD,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,CAC3C,MAAM;SACH,MAAM,CAAC,IAAI,CAAC;SACZ,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC;SACpB,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC;SACnB,EAAE,CAAC,WAAW,EAAE,GAAG,EAAE;QACpB,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,EAAiB,CAAC;QAEhD,aAAG,CAAC,EAAE,CAAC,mBAAmB,EAAE,aAAG,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IACtD,CAAC,CAAC,CACL,CAAC;AACJ,CAAC,CAAC;AAjBW,QAAA,oBAAoB,wBAiB/B"}
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "engines": {
8
8
  "node": ">=12"
9
9
  },
10
- "version": "3.15.0-beta.0",
10
+ "version": "3.15.2",
11
11
  "main": "lib/index.js",
12
12
  "typings": "lib/index.d.ts",
13
13
  "files": [
@@ -27,7 +27,7 @@
27
27
  "lint": "yarn skuba lint",
28
28
  "release": "yarn build && changeset publish",
29
29
  "stage": "changeset version && yarn format",
30
- "skuba": "ts-node --transpile-only src/skuba build && node lib/skuba",
30
+ "skuba": "yarn build && node lib/skuba",
31
31
  "test": "yarn skuba test",
32
32
  "test:ci": "yarn skuba test --config jest.config.int.ts --runInBand",
33
33
  "test:int": "yarn skuba test --config jest.config.int.ts --runInBand",
@@ -41,7 +41,7 @@
41
41
  "devDependencies": {
42
42
  "@changesets/cli": "2.17.0",
43
43
  "@changesets/get-github-info": "0.5.0",
44
- "@types/concurrently": "6.2.1",
44
+ "@types/concurrently": "6.3.0",
45
45
  "@types/ejs": "3.1.0",
46
46
  "@types/express": "4.17.13",
47
47
  "@types/fs-extra": "9.0.13",
@@ -49,13 +49,13 @@
49
49
  "@types/lodash.mergewith": "4.6.6",
50
50
  "@types/module-alias": "2.0.1",
51
51
  "@types/npm-which": "3.0.1",
52
- "@types/picomatch": "2.2.6",
52
+ "@types/picomatch": "2.3.0",
53
53
  "@types/supertest": "2.0.11",
54
54
  "express": "4.17.1",
55
- "koa": "2.13.1",
55
+ "koa": "2.13.3",
56
56
  "semver": "7.3.5",
57
57
  "supertest": "6.1.6",
58
- "type-fest": "2.3.2"
58
+ "type-fest": "2.3.4"
59
59
  },
60
60
  "dependencies": {
61
61
  "@types/jest": "^27.0.1",
@@ -68,6 +68,7 @@
68
68
  "execa": "^5.0.0",
69
69
  "fdir": "^5.0.0",
70
70
  "fs-extra": "^10.0.0",
71
+ "function-arguments": "^1.0.9",
71
72
  "get-port": "^5.1.1",
72
73
  "ignore": "^5.1.8",
73
74
  "is-installed-globally": "^0.4.0",
@@ -67,7 +67,7 @@ steps:
67
67
  - *aws-sm
68
68
  - *private-npm
69
69
  - *docker-ecr-cache
70
- - seek-jobs/gantry#v1.4.1:
70
+ - seek-jobs/gantry#v1.5.1:
71
71
  command: build
72
72
  file: gantry.build.yml
73
73
  region: <%- region %>
@@ -83,7 +83,7 @@ steps:
83
83
  concurrency_group: <%- teamName %>/deploy/gantry/<%- devGantryEnvironmentName %>
84
84
  key: deploy-dev
85
85
  plugins:
86
- - seek-jobs/gantry#v1.4.1:
86
+ - seek-jobs/gantry#v1.5.1:
87
87
  command: apply
88
88
  environment: <%- devGantryEnvironmentName %>
89
89
  file: gantry.apply.yml
@@ -99,7 +99,7 @@ steps:
99
99
  concurrency_group: <%- teamName %>/deploy/gantry/<%- prodGantryEnvironmentName %>
100
100
  depends_on: deploy-dev
101
101
  plugins:
102
- - seek-jobs/gantry#v1.4.1:
102
+ - seek-jobs/gantry#v1.5.1:
103
103
  command: apply
104
104
  environment: <%- prodGantryEnvironmentName %>
105
105
  file: gantry.apply.yml
@@ -23,18 +23,6 @@ Next steps:
23
23
  request installation in [SEEK-Jobs/renovate].
24
24
  9. [ ] Delete this checklist 😌.
25
25
 
26
- ## Table of contents
27
-
28
- - [Design](#design)
29
- - [Development](#development)
30
- - [Test](#test)
31
- - [Lint](#lint)
32
- - [Start](#start)
33
- - [Deploy](#deploy)
34
- - [Support](#support)
35
- - [Dev](#dev)
36
- - [Prod](#prod)
37
-
38
26
  ## Design
39
27
 
40
28
  <%-repoName %> is a Node.js HTTP server built in line with our [technology strategy].
@@ -8,7 +8,7 @@
8
8
  "@types/express": "^4.17.13",
9
9
  "@types/node": "^14.17.9",
10
10
  "@types/supertest": "^2.0.11",
11
- "pino-pretty": "^7.0.0",
11
+ "pino-pretty": "^6.0.0",
12
12
  "skuba": "*",
13
13
  "supertest": "^6.1.4"
14
14
  },
@@ -6,6 +6,8 @@ import { healthCheckHandler } from './api/healthCheck';
6
6
  import { smokeTestHandler } from './api/smokeTest';
7
7
 
8
8
  const app = express()
9
+ // TODO: consider using a middleware that adds secure HTTP headers.
10
+ // https://github.com/helmetjs/helmet
9
11
  .get('/health', healthCheckHandler)
10
12
  .get('/smoke', smokeTestHandler);
11
13
 
@@ -21,18 +21,6 @@ Next steps:
21
21
  request installation in [SEEK-Jobs/renovate].
22
22
  8. [ ] Delete this checklist 😌.
23
23
 
24
- ## Table of contents
25
-
26
- - [Design](#design)
27
- - [Development](#development)
28
- - [Test](#test)
29
- - [Lint](#lint)
30
- - [Start](#start)
31
- - [Deploy](#deploy)
32
- - [Support](#support)
33
- - [Dev](#dev)
34
- - [Prod](#prod)
35
-
36
24
  ## Design
37
25
 
38
26
  The `greeter` template is the prototypical _hello world_ project.
@@ -67,7 +67,7 @@ steps:
67
67
  - *aws-sm
68
68
  - *private-npm
69
69
  - *docker-ecr-cache
70
- - seek-jobs/gantry#v1.4.1:
70
+ - seek-jobs/gantry#v1.5.1:
71
71
  command: build
72
72
  file: gantry.build.yml
73
73
  region: <%- region %>
@@ -83,7 +83,7 @@ steps:
83
83
  concurrency_group: <%- teamName %>/deploy/gantry/<%- devGantryEnvironmentName %>
84
84
  key: deploy-dev
85
85
  plugins:
86
- - seek-jobs/gantry#v1.4.1:
86
+ - seek-jobs/gantry#v1.5.1:
87
87
  command: apply
88
88
  environment: <%- devGantryEnvironmentName %>
89
89
  file: gantry.apply.yml
@@ -99,7 +99,7 @@ steps:
99
99
  concurrency_group: <%- teamName %>/deploy/gantry/<%- prodGantryEnvironmentName %>
100
100
  depends_on: deploy-dev
101
101
  plugins:
102
- - seek-jobs/gantry#v1.4.1:
102
+ - seek-jobs/gantry#v1.5.1:
103
103
  command: apply
104
104
  environment: <%- prodGantryEnvironmentName %>
105
105
  file: gantry.apply.yml
@@ -23,18 +23,6 @@ Next steps:
23
23
  request installation in [SEEK-Jobs/renovate].
24
24
  9. [ ] Delete this checklist 😌.
25
25
 
26
- ## Table of contents
27
-
28
- - [Design](#design)
29
- - [Development](#development)
30
- - [Test](#test)
31
- - [Lint](#lint)
32
- - [Start](#start)
33
- - [Deploy](#deploy)
34
- - [Support](#support)
35
- - [Dev](#dev)
36
- - [Prod](#prod)
37
-
38
26
  ## Design
39
27
 
40
28
  <%-repoName %> is a Node.js HTTP server built in line with our [technology strategy].
@@ -22,7 +22,7 @@
22
22
  "@types/supertest": "^2.0.11",
23
23
  "@types/uuid": "^8.3.1",
24
24
  "chance": "^1.1.7",
25
- "pino-pretty": "^7.0.0",
25
+ "pino-pretty": "^6.0.0",
26
26
  "skuba": "*",
27
27
  "supertest": "^6.1.4"
28
28
  },
@@ -4,6 +4,7 @@ import {
4
4
  ErrorMiddleware,
5
5
  MetricsMiddleware,
6
6
  RequestLogging,
7
+ // SecureHeaders,
7
8
  VersionMiddleware,
8
9
  } from 'seek-koala';
9
10
 
@@ -38,6 +39,10 @@ export const createApp = <State, Context>(
38
39
  ...middleware: Koa.Middleware<State, Context>[]
39
40
  ) =>
40
41
  new Koa()
42
+ // TODO: consider using a middleware that adds secure HTTP headers.
43
+ // https://github.com/seek-oss/koala/tree/master/src/secureHeaders
44
+ // https://github.com/venables/koa-helmet
45
+ // .use(SecureHeaders.middleware)
41
46
  .use(requestLogging)
42
47
  .use(metrics)
43
48
  .use(ErrorMiddleware.handle)
@@ -11,7 +11,7 @@ export const validate = <T>({
11
11
  }) => {
12
12
  try {
13
13
  return filter(input);
14
- } catch (err: unknown) {
14
+ } catch (err) {
15
15
  // TODO: consider providing structured error messages for your consumers.
16
16
  return ctx.throw(422, err instanceof Error ? err.message : String(err));
17
17
  }
@@ -22,18 +22,6 @@ Next steps:
22
22
  request installation in [SEEK-Jobs/renovate].
23
23
  9. [ ] Delete this checklist 😌.
24
24
 
25
- ## Table of contents
26
-
27
- - [Design](#design)
28
- - [Development](#development)
29
- - [Test](#test)
30
- - [Lint](#lint)
31
- - [Start](#start)
32
- - [Deploy](#deploy)
33
- - [Support](#support)
34
- - [Dev](#dev)
35
- - [Prod](#prod)
36
-
37
25
  ## Design
38
26
 
39
27
  <%-repoName %> is a Node.js [Lambda] application built in line with our [technology strategy].
@@ -12,7 +12,7 @@
12
12
  "@types/chance": "^1.1.3",
13
13
  "@types/node": "^14.17.9",
14
14
  "chance": "^1.1.7",
15
- "pino-pretty": "^7.0.0",
15
+ "pino-pretty": "^6.0.0",
16
16
  "serverless": "^2.53.1",
17
17
  "serverless-plugin-canary-deployments": "^0.7.0",
18
18
  "serverless-prune-plugin": "^1.5.1",
@@ -1,15 +1,18 @@
1
1
  service: <%- serviceName %>
2
2
 
3
+ configValidationMode: error
4
+ variablesResolutionMode: 20210326
5
+
3
6
  custom:
4
7
  description: <%- description %>
5
8
  env: ${self:custom.envs.${env:ENVIRONMENT}}
6
9
  envs:
7
10
  dev:
8
11
  deploymentBucket: 'TODO: deploymentBucketName'
9
- isProduction: 'false'
12
+ isProduction: false
10
13
  prod:
11
14
  deploymentBucket: 'TODO: deploymentBucketName'
12
- isProduction: 'true'
15
+ isProduction: true
13
16
  prune:
14
17
  automatic: true
15
18
  number: 3
@@ -15,7 +15,7 @@ export const createHandler = <Event, Output = unknown>(
15
15
  logger.info('request');
16
16
 
17
17
  return output;
18
- } catch (err: unknown) {
18
+ } catch (err) {
19
19
  logger.error({ err }, 'request');
20
20
 
21
21
  throw new Error('invoke error');
@@ -18,20 +18,6 @@ Next steps:
18
18
  request installation in [#open-source].
19
19
  7. [ ] Delete this checklist 😌.
20
20
 
21
- ## Table of contents
22
-
23
- - [API](#api)
24
- - [`log`](#log)
25
- - [Development](#development)
26
- - [Prerequisites](#prerequisites)
27
- - [Test](#test)
28
- - [Lint](#lint)
29
- - [Package](#package)
30
- - [Release](#release)
31
- - [Commit messages](#commit-messages)
32
- - [Releasing latest](#releasing-latest)
33
- - [Releasing other dist-tags](#releasing-other-dist-tags)
34
-
35
21
  ## API
36
22
 
37
23
  ### `log`
@@ -18,20 +18,6 @@ Next steps:
18
18
  request installation in [SEEK-Jobs/renovate].
19
19
  7. [ ] Delete this checklist 😌.
20
20
 
21
- ## Table of contents
22
-
23
- - [API](#api)
24
- - [`log`](#log)
25
- - [Development](#development)
26
- - [Prerequisites](#prerequisites)
27
- - [Test](#test)
28
- - [Lint](#lint)
29
- - [Package](#package)
30
- - [Release](#release)
31
- - [Commit messages](#commit-messages)
32
- - [Releasing latest](#releasing-latest)
33
- - [Releasing other dist-tags](#releasing-other-dist-tags)
34
-
35
21
  ## API
36
22
 
37
23
  ### `log`