skuba 8.2.1 → 9.0.0-main-20240918063050

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 (51) hide show
  1. package/lib/api/buildkite/annotate.d.ts +2 -0
  2. package/lib/api/buildkite/annotate.js +14 -1
  3. package/lib/api/buildkite/annotate.js.map +2 -2
  4. package/lib/api/github/issueComment.js.map +2 -2
  5. package/lib/cli/configure/analyseDependencies.js +0 -2
  6. package/lib/cli/configure/analyseDependencies.js.map +2 -2
  7. package/lib/cli/configure/analysis/package.d.ts +1 -2
  8. package/lib/cli/configure/analysis/package.js +0 -27
  9. package/lib/cli/configure/analysis/package.js.map +2 -2
  10. package/lib/cli/configure/dependencies/skubaDeps.js +4 -3
  11. package/lib/cli/configure/dependencies/skubaDeps.js.map +2 -2
  12. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/index.d.ts +2 -0
  13. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/index.js +35 -0
  14. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/index.js.map +7 -0
  15. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerCompose.d.ts +2 -0
  16. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerCompose.js +99 -0
  17. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerCompose.js.map +7 -0
  18. package/lib/cli/node.d.ts +2 -1
  19. package/lib/cli/node.js +23 -18
  20. package/lib/cli/node.js.map +3 -3
  21. package/lib/cli/start.js +3 -3
  22. package/lib/cli/start.js.map +2 -2
  23. package/lib/utils/template.d.ts +4 -4
  24. package/lib/wrapper/requestListener.js.map +2 -2
  25. package/package.json +13 -12
  26. package/template/express-rest-api/.buildkite/pipeline.yml +1 -1
  27. package/template/express-rest-api/Dockerfile.dev-deps +1 -1
  28. package/template/express-rest-api/package.json +2 -2
  29. package/template/greeter/.buildkite/pipeline.yml +1 -1
  30. package/template/greeter/Dockerfile +1 -1
  31. package/template/greeter/package.json +2 -2
  32. package/template/koa-rest-api/.buildkite/pipeline.yml +1 -1
  33. package/template/koa-rest-api/Dockerfile.dev-deps +1 -1
  34. package/template/koa-rest-api/package.json +6 -6
  35. package/template/koa-rest-api/src/framework/server.ts +3 -5
  36. package/template/lambda-sqs-worker/.buildkite/pipeline.yml +3 -3
  37. package/template/lambda-sqs-worker/Dockerfile +1 -1
  38. package/template/lambda-sqs-worker/package.json +2 -2
  39. package/template/lambda-sqs-worker-cdk/.buildkite/pipeline.yml +2 -2
  40. package/template/lambda-sqs-worker-cdk/Dockerfile +1 -1
  41. package/template/lambda-sqs-worker-cdk/infra/__snapshots__/appStack.test.ts.snap +435 -891
  42. package/template/lambda-sqs-worker-cdk/infra/appStack.test.ts +4 -1
  43. package/template/lambda-sqs-worker-cdk/infra/appStack.ts +5 -84
  44. package/template/lambda-sqs-worker-cdk/infra/config.ts +1 -1
  45. package/template/lambda-sqs-worker-cdk/infra/index.ts +20 -3
  46. package/template/lambda-sqs-worker-cdk/package.json +4 -3
  47. package/template/oss-npm-package/.github/workflows/release.yml +1 -1
  48. package/template/oss-npm-package/_package.json +1 -1
  49. package/template/private-npm-package/_package.json +1 -1
  50. package/template/lambda-sqs-worker-cdk/src/postHook.ts +0 -154
  51. package/template/lambda-sqs-worker-cdk/src/preHook.ts +0 -95
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/wrapper/requestListener.ts"],
4
- "sourcesContent": ["import http from 'http';\n\nimport { isFunction, isIpPort, isObject } from '../utils/validation';\n\nimport { serveRequestListener, startServer } from './http';\n\n// Express compatibility\ninterface FunctionConfig extends http.RequestListener {\n port?: number;\n}\n\ninterface ObjectConfig {\n // Koa compatibility\n callback?: () => http.RequestListener;\n\n requestListener?: http.RequestListener;\n\n // Fastify compatibility\n server?: http.Server;\n\n default?: Promise<unknown>;\n port?: unknown;\n}\n\nconst isConfig = (\n data: unknown,\n): data is Promise<FunctionConfig> | Promise<ObjectConfig> =>\n isFunction(data) || isObject(data);\n\ninterface Args {\n availablePort?: number;\n entryPoint: unknown;\n}\n\n/**\n * Create an HTTP server that calls into an exported `http.RequestListener`.\n *\n * This supports Express and Koa applications out of the box.\n */\nexport const runRequestListener = async ({\n availablePort,\n entryPoint,\n}: Args): Promise<void> => {\n if (!isConfig(entryPoint)) {\n // Assume an executable script with weird exports\n return;\n }\n\n let config: FunctionConfig | ObjectConfig = await entryPoint;\n\n if (typeof config === 'object' && isConfig(config.default)) {\n // Prefer `export default` over `export =`\n config = await config.default;\n }\n\n if (Object.keys(config).length === 0) {\n // Assume an executable script with no exports\n return;\n }\n\n const port = isIpPort(config.port) ? config.port : availablePort;\n\n // http.Server support\n if (typeof config !== 'function' && config instanceof http.Server) {\n return startServer(config, port);\n }\n\n // Fastify workaround\n if (\n typeof config !== 'function' &&\n config.server &&\n config.server instanceof http.Server\n ) {\n return startServer(config.server, port);\n }\n\n const requestListener =\n typeof config === 'function'\n ? config\n : (config.requestListener ?? config.callback?.());\n\n if (typeof requestListener !== 'function') {\n // Assume an executable script with non-request listener exports\n return;\n }\n\n return serveRequestListener(requestListener, port);\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,wBAA+C;AAE/C,IAAAA,eAAkD;AAoBlD,MAAM,WAAW,CACf,aAEA,8BAAW,IAAI,SAAK,4BAAS,IAAI;AAY5B,MAAM,qBAAqB,OAAO;AAAA,EACvC;AAAA,EACA;AACF,MAA2B;AACzB,MAAI,CAAC,SAAS,UAAU,GAAG;AAEzB;AAAA,EACF;AAEA,MAAI,SAAwC,MAAM;AAElD,MAAI,OAAO,WAAW,YAAY,SAAS,OAAO,OAAO,GAAG;AAE1D,aAAS,MAAM,OAAO;AAAA,EACxB;AAEA,MAAI,OAAO,KAAK,MAAM,EAAE,WAAW,GAAG;AAEpC;AAAA,EACF;AAEA,QAAM,WAAO,4BAAS,OAAO,IAAI,IAAI,OAAO,OAAO;AAGnD,MAAI,OAAO,WAAW,cAAc,kBAAkB,YAAAC,QAAK,QAAQ;AACjE,eAAO,0BAAY,QAAQ,IAAI;AAAA,EACjC;AAGA,MACE,OAAO,WAAW,cAClB,OAAO,UACP,OAAO,kBAAkB,YAAAA,QAAK,QAC9B;AACA,eAAO,0BAAY,OAAO,QAAQ,IAAI;AAAA,EACxC;AAEA,QAAM,kBACJ,OAAO,WAAW,aACd,SACC,OAAO,mBAAmB,OAAO,WAAW;AAEnD,MAAI,OAAO,oBAAoB,YAAY;AAEzC;AAAA,EACF;AAEA,aAAO,mCAAqB,iBAAiB,IAAI;AACnD;",
4
+ "sourcesContent": ["import http from 'http';\n\nimport { isFunction, isIpPort, isObject } from '../utils/validation';\n\nimport { serveRequestListener, startServer } from './http';\n\n// Express compatibility\ninterface FunctionConfig extends http.RequestListener {\n port?: number;\n}\n\ninterface ObjectConfig {\n // Koa compatibility\n callback?: () => http.RequestListener;\n\n requestListener?: http.RequestListener;\n\n // Fastify compatibility\n server?: http.Server;\n\n default?: Promise<unknown>;\n port?: unknown;\n}\n\nconst isConfig = (\n data: unknown,\n): data is Promise<FunctionConfig> | Promise<ObjectConfig> =>\n isFunction(data) || isObject(data);\n\ninterface Args {\n availablePort?: number;\n entryPoint: unknown;\n}\n\n/**\n * Create an HTTP server that calls into an exported `http.RequestListener`.\n *\n * This supports Express and Koa applications out of the box.\n */\nexport const runRequestListener = async ({\n availablePort,\n entryPoint,\n}: Args): Promise<void> => {\n if (!isConfig(entryPoint)) {\n // Assume an executable script with weird exports\n return;\n }\n\n let config: FunctionConfig | ObjectConfig = await entryPoint;\n\n if (typeof config === 'object' && isConfig(config.default)) {\n // Prefer `export default` over `export =`\n config = await config.default;\n }\n\n if (Object.keys(config).length === 0) {\n // Assume an executable script with no exports\n return;\n }\n\n const port = isIpPort(config.port) ? config.port : availablePort;\n\n // http.Server support\n if (typeof config !== 'function' && config instanceof http.Server) {\n return startServer(config, port);\n }\n\n // Fastify workaround\n if (\n typeof config !== 'function' &&\n config.server &&\n config.server instanceof http.Server\n ) {\n return startServer(config.server, port);\n }\n\n const requestListener =\n typeof config === 'function'\n ? config\n : config.requestListener ?? config.callback?.();\n\n if (typeof requestListener !== 'function') {\n // Assume an executable script with non-request listener exports\n return;\n }\n\n return serveRequestListener(requestListener, port);\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,wBAA+C;AAE/C,IAAAA,eAAkD;AAoBlD,MAAM,WAAW,CACf,aAEA,8BAAW,IAAI,SAAK,4BAAS,IAAI;AAY5B,MAAM,qBAAqB,OAAO;AAAA,EACvC;AAAA,EACA;AACF,MAA2B;AACzB,MAAI,CAAC,SAAS,UAAU,GAAG;AAEzB;AAAA,EACF;AAEA,MAAI,SAAwC,MAAM;AAElD,MAAI,OAAO,WAAW,YAAY,SAAS,OAAO,OAAO,GAAG;AAE1D,aAAS,MAAM,OAAO;AAAA,EACxB;AAEA,MAAI,OAAO,KAAK,MAAM,EAAE,WAAW,GAAG;AAEpC;AAAA,EACF;AAEA,QAAM,WAAO,4BAAS,OAAO,IAAI,IAAI,OAAO,OAAO;AAGnD,MAAI,OAAO,WAAW,cAAc,kBAAkB,YAAAC,QAAK,QAAQ;AACjE,eAAO,0BAAY,QAAQ,IAAI;AAAA,EACjC;AAGA,MACE,OAAO,WAAW,cAClB,OAAO,UACP,OAAO,kBAAkB,YAAAA,QAAK,QAC9B;AACA,eAAO,0BAAY,OAAO,QAAQ,IAAI;AAAA,EACxC;AAEA,QAAM,kBACJ,OAAO,WAAW,aACd,SACA,OAAO,mBAAmB,OAAO,WAAW;AAElD,MAAI,OAAO,oBAAoB,YAAY;AAEzC;AAAA,EACF;AAEA,aAAO,mCAAqB,iBAAiB,IAAI;AACnD;",
6
6
  "names": ["import_http", "http"]
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skuba",
3
- "version": "8.2.1",
3
+ "version": "9.0.0-main-20240918063050",
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",
@@ -57,7 +57,7 @@
57
57
  "@octokit/rest": "^21.0.0",
58
58
  "@octokit/types": "^13.0.0",
59
59
  "@types/jest": "^29.0.0",
60
- "@types/node": ">=18.12",
60
+ "@types/node": "^20.16.5",
61
61
  "chalk": "^4.1.0",
62
62
  "concurrently": "^8.0.0",
63
63
  "dotenv": "^16.0.0",
@@ -94,16 +94,16 @@
94
94
  "ts-dedent": "^2.2.0",
95
95
  "ts-jest": "^29.1.0",
96
96
  "ts-node": "^10.9.2",
97
- "ts-node-dev": "^2.0.0",
98
97
  "tsconfig-paths": "^4.0.0",
99
98
  "tsconfig-seek": "2.0.0",
100
- "typescript": "~5.5.0",
99
+ "tsx": "^4.16.2",
100
+ "typescript": "~5.6.0",
101
101
  "validate-npm-package-name": "^5.0.0",
102
102
  "zod": "^3.22.4",
103
103
  "eslint-config-skuba": "4.1.0"
104
104
  },
105
105
  "devDependencies": {
106
- "@changesets/cli": "2.27.6",
106
+ "@changesets/cli": "2.27.8",
107
107
  "@changesets/get-github-info": "0.6.0",
108
108
  "@jest/reporters": "29.7.0",
109
109
  "@jest/test-result": "29.7.0",
@@ -116,19 +116,19 @@
116
116
  "@types/minimist": "1.2.5",
117
117
  "@types/module-alias": "2.0.4",
118
118
  "@types/npm-which": "3.0.3",
119
- "@types/picomatch": "2.3.3",
119
+ "@types/picomatch": "3.0.1",
120
120
  "@types/supertest": "6.0.2",
121
121
  "@types/validate-npm-package-name": "4.0.2",
122
- "enhanced-resolve": "5.17.0",
123
- "express": "4.19.2",
124
- "fastify": "4.28.0",
122
+ "enhanced-resolve": "5.17.1",
123
+ "express": "4.20.0",
124
+ "fastify": "4.28.1",
125
125
  "jest-diff": "29.7.0",
126
126
  "jsonfile": "6.1.0",
127
127
  "koa": "2.15.3",
128
- "memfs": "4.9.3",
128
+ "memfs": "4.11.1",
129
129
  "remark-cli": "12.0.1",
130
130
  "remark-preset-lint-recommended": "7.0.0",
131
- "semver": "7.6.2",
131
+ "semver": "7.6.3",
132
132
  "supertest": "7.0.0",
133
133
  "type-fest": "2.19.0"
134
134
  },
@@ -151,7 +151,7 @@
151
151
  "entryPoint": "src/index.ts",
152
152
  "template": null,
153
153
  "type": "package",
154
- "version": "8.1.0"
154
+ "version": "8.2.1"
155
155
  },
156
156
  "scripts": {
157
157
  "build": "scripts/build.sh",
@@ -168,6 +168,7 @@
168
168
  "test:ci": "pnpm --silent skuba test --runInBand",
169
169
  "test:int": "pnpm --silent skuba test --selectProjects integration --runInBand",
170
170
  "test:template": "scripts/test-template.sh",
171
+ "test:template:updateSnapshot": "scripts/test-template.sh -u",
171
172
  "test:watch": "pnpm --silent skuba test --runInBand --watch"
172
173
  }
173
174
  }
@@ -57,7 +57,7 @@ steps:
57
57
  - *aws-sm
58
58
  - *private-npm
59
59
  - *docker-ecr-cache
60
- - docker-compose#v5.3.0:
60
+ - docker-compose#v5.4.0:
61
61
  run: app
62
62
  environment:
63
63
  - GITHUB_API_TOKEN
@@ -1,4 +1,4 @@
1
- # syntax=docker/dockerfile:1.8
1
+ # syntax=docker/dockerfile:1.10
2
2
 
3
3
  FROM --platform=<%- platformName %> node:20-alpine AS dev-deps
4
4
 
@@ -21,14 +21,14 @@
21
21
  },
22
22
  "devDependencies": {
23
23
  "@types/express": "^4.17.13",
24
- "@types/node": "^20.9.0",
24
+ "@types/node": "^20.16.5",
25
25
  "@types/supertest": "^6.0.0",
26
26
  "mime": "^4.0.1",
27
27
  "pino-pretty": "^11.0.0",
28
28
  "skuba": "*",
29
29
  "supertest": "^7.0.0"
30
30
  },
31
- "packageManager": "pnpm@9.4.0",
31
+ "packageManager": "pnpm@9.10.0",
32
32
  "engines": {
33
33
  "node": ">=20"
34
34
  }
@@ -38,7 +38,7 @@ steps:
38
38
  - *aws-sm
39
39
  - *private-npm
40
40
  - *docker-ecr-cache
41
- - docker-compose#v5.3.0:
41
+ - docker-compose#v5.4.0:
42
42
  run: app
43
43
  environment:
44
44
  - GITHUB_API_TOKEN
@@ -1,4 +1,4 @@
1
- # syntax=docker/dockerfile:1.8
1
+ # syntax=docker/dockerfile:1.10
2
2
 
3
3
  FROM --platform=<%- platformName %> node:20-alpine AS dev-deps
4
4
 
@@ -17,9 +17,9 @@
17
17
  },
18
18
  "devDependencies": {
19
19
  "@types/node": "^20.9.0",
20
- "skuba": "*"
20
+ "skuba": "9.0.0-main-20240918063050"
21
21
  },
22
- "packageManager": "pnpm@9.4.0",
22
+ "packageManager": "pnpm@9.10.0",
23
23
  "engines": {
24
24
  "node": ">=20"
25
25
  }
@@ -57,7 +57,7 @@ steps:
57
57
  - *aws-sm
58
58
  - *private-npm
59
59
  - *docker-ecr-cache
60
- - docker-compose#v5.3.0:
60
+ - docker-compose#v5.4.0:
61
61
  run: app
62
62
  environment:
63
63
  - GITHUB_API_TOKEN
@@ -1,4 +1,4 @@
1
- # syntax=docker/dockerfile:1.8
1
+ # syntax=docker/dockerfile:1.10
2
2
 
3
3
  FROM --platform=<%- platformName %> node:20-alpine AS dev-deps
4
4
 
@@ -16,11 +16,11 @@
16
16
  "@koa/router": "^12.0.0",
17
17
  "@opentelemetry/api": "^1.9.0",
18
18
  "@opentelemetry/core": "^1.25.0",
19
- "@opentelemetry/exporter-trace-otlp-grpc": "^0.52.0",
20
- "@opentelemetry/instrumentation-aws-sdk": "^0.42.0",
21
- "@opentelemetry/instrumentation-http": "^0.52.0",
19
+ "@opentelemetry/exporter-trace-otlp-grpc": "^0.53.0",
20
+ "@opentelemetry/instrumentation-aws-sdk": "^0.44.0",
21
+ "@opentelemetry/instrumentation-http": "^0.53.0",
22
22
  "@opentelemetry/propagator-b3": "^1.25.0",
23
- "@opentelemetry/sdk-node": "^0.52.0",
23
+ "@opentelemetry/sdk-node": "^0.53.0",
24
24
  "@seek/logger": "^6.0.0",
25
25
  "hot-shots": "^10.0.0",
26
26
  "koa": "^2.13.4",
@@ -36,7 +36,7 @@
36
36
  "@types/koa": "^2.13.4",
37
37
  "@types/koa-bodyparser": "^5.0.2",
38
38
  "@types/koa__router": "^12.0.0",
39
- "@types/node": "^20.9.0",
39
+ "@types/node": "^20.16.5",
40
40
  "@types/supertest": "^6.0.0",
41
41
  "chance": "^1.1.8",
42
42
  "mime": "^4.0.1",
@@ -44,7 +44,7 @@
44
44
  "skuba": "*",
45
45
  "supertest": "^7.0.0"
46
46
  },
47
- "packageManager": "pnpm@9.4.0",
47
+ "packageManager": "pnpm@9.10.0",
48
48
  "engines": {
49
49
  "node": ">=20"
50
50
  }
@@ -4,7 +4,7 @@ import {
4
4
  ErrorMiddleware,
5
5
  MetricsMiddleware,
6
6
  RequestLogging,
7
- // SecureHeaders,
7
+ SecureHeaders,
8
8
  VersionMiddleware,
9
9
  } from 'seek-koala';
10
10
 
@@ -39,10 +39,8 @@ export const createApp = <State, Context>(
39
39
  ...middleware: Array<Koa.Middleware<State, Context>>
40
40
  ) =>
41
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)
42
+ // Read: https://github.com/seek-oss/koala/tree/master/src/secureHeaders
43
+ .use(SecureHeaders.middleware)
46
44
  .use(contextMiddleware)
47
45
  .use(requestLogging)
48
46
  .use(metrics)
@@ -30,13 +30,13 @@ configs:
30
30
  - pnpm run deploy
31
31
  concurrency: 1
32
32
  plugins:
33
- - artifacts#v1.9.3:
33
+ - artifacts#v1.9.4:
34
34
  build: ${BUILDKITE_BUILD_ID}
35
35
  download: lib/*
36
36
  - *aws-sm
37
37
  - *private-npm
38
38
  - *docker-ecr-cache
39
- - docker-compose#v5.3.0:
39
+ - docker-compose#v5.4.0:
40
40
  dependencies: false
41
41
  run: app
42
42
  propagate-environment: true
@@ -67,7 +67,7 @@ steps:
67
67
  - *aws-sm
68
68
  - *private-npm
69
69
  - *docker-ecr-cache
70
- - docker-compose#v5.3.0:
70
+ - docker-compose#v5.4.0:
71
71
  run: app
72
72
  environment:
73
73
  - GITHUB_API_TOKEN
@@ -1,4 +1,4 @@
1
- # syntax=docker/dockerfile:1.8
1
+ # syntax=docker/dockerfile:1.10
2
2
 
3
3
  FROM --platform=<%- platformName %> node:20-alpine AS dev-deps
4
4
 
@@ -27,7 +27,7 @@
27
27
  "devDependencies": {
28
28
  "@types/aws-lambda": "^8.10.84",
29
29
  "@types/chance": "^1.1.3",
30
- "@types/node": "^20.9.0",
30
+ "@types/node": "^20.16.5",
31
31
  "aws-sdk-client-mock": "^4.0.0",
32
32
  "aws-sdk-client-mock-jest": "^4.0.0",
33
33
  "chance": "^1.1.8",
@@ -38,7 +38,7 @@
38
38
  "serverless-prune-plugin": "^2.0.0",
39
39
  "skuba": "*"
40
40
  },
41
- "packageManager": "pnpm@9.4.0",
41
+ "packageManager": "pnpm@9.10.0",
42
42
  "engines": {
43
43
  "node": ">=20"
44
44
  }
@@ -33,7 +33,7 @@ configs:
33
33
  - *aws-sm
34
34
  - *private-npm
35
35
  - *docker-ecr-cache
36
- - docker-compose#v5.3.0:
36
+ - docker-compose#v5.4.0:
37
37
  dependencies: false
38
38
  run: app
39
39
  environment:
@@ -63,7 +63,7 @@ steps:
63
63
  - *aws-sm
64
64
  - *private-npm
65
65
  - *docker-ecr-cache
66
- - docker-compose#v5.3.0:
66
+ - docker-compose#v5.4.0:
67
67
  run: app
68
68
  environment:
69
69
  - GITHUB_API_TOKEN
@@ -1,4 +1,4 @@
1
- # syntax=docker/dockerfile:1.8
1
+ # syntax=docker/dockerfile:1.10
2
2
 
3
3
  FROM --platform=<%- platformName %> node:20-alpine AS dev-deps
4
4