Skip to content

Commit

Permalink
feat: add support for Node.js 22
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanmanning committed Apr 26, 2024
1 parent 6716eca commit e083794
Show file tree
Hide file tree
Showing 17 changed files with 56 additions and 51 deletions.
36 changes: 18 additions & 18 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ references:
- image: cimg/node:<< parameters.node-version >>
parameters:
node-version:
default: "18.19" # We default to the highest active LTS
default: "20.12" # We default to the highest active LTS
type: string

workspace_root: &workspace_root ~/project
Expand Down Expand Up @@ -157,29 +157,29 @@ workflows:
name: build-v<< matrix.node-version >>
matrix:
parameters:
node-version: [ "20.10", "18.19" ]
node-version: [ "22.0", "20.12", "18.20" ]
- test:
requires:
- build-v<< matrix.node-version >>
name: test-v<< matrix.node-version >>
matrix:
parameters:
node-version: [ "20.10", "18.19" ]
node-version: [ "22.0", "20.12", "18.20" ]
- lint:
requires:
- build-v<< matrix.node-version >>
name: lint-v<< matrix.node-version >>
matrix:
parameters:
node-version: [ "20.10", "18.19" ]
node-version: [ "22.0", "20.12", "18.20" ]
- release-please:
filters:
<<: *filters_only_main
requires:
# We release on the highest active LTS version of
# Node.js that we support
- test-v20.10
- lint-v20.10
- test-v20.12
- lint-v20.12

build-test-publish:
jobs:
Expand All @@ -189,7 +189,7 @@ workflows:
name: build-v<< matrix.node-version >>
matrix:
parameters:
node-version: [ "20.10", "18.19" ]
node-version: [ "22.0", "20.12", "18.20" ]
- test:
filters:
<<: *filters_release_build
Expand All @@ -198,7 +198,7 @@ workflows:
name: test-v<< matrix.node-version >>
matrix:
parameters:
node-version: [ "20.10", "18.19" ]
node-version: [ "22.0", "20.12", "18.20" ]
- lint:
filters:
<<: *filters_release_build
Expand All @@ -207,16 +207,16 @@ workflows:
name: lint-v<< matrix.node-version >>
matrix:
parameters:
node-version: [ "20.10", "18.19" ]
node-version: [ "22.0", "20.12", "18.20" ]
- publish:
context: npm-publish-token
filters:
<<: *filters_release_build
requires:
# We release on the highest active LTS version of
# Node.js that we support
- lint-v20.10
- test-v20.10
- lint-v20.12
- test-v20.12

build-test-prepublish:
jobs:
Expand All @@ -226,7 +226,7 @@ workflows:
name: build-v<< matrix.node-version >>
matrix:
parameters:
node-version: [ "20.10", "18.19" ]
node-version: [ "22.0", "20.12", "18.20" ]
- test:
filters:
<<: *filters_prerelease_build
Expand All @@ -235,7 +235,7 @@ workflows:
name: test-v<< matrix.node-version >>
matrix:
parameters:
node-version: [ "20.10", "18.19" ]
node-version: [ "22.0", "20.12", "18.20" ]
- lint:
filters:
<<: *filters_prerelease_build
Expand All @@ -244,16 +244,16 @@ workflows:
name: lint-v<< matrix.node-version >>
matrix:
parameters:
node-version: [ "20.10", "18.19" ]
node-version: [ "22.0", "20.12", "18.20" ]
- prepublish:
context: npm-publish-token
filters:
<<: *filters_prerelease_build
requires:
# We release on the highest active LTS version of
# Node.js that we support
- lint-v20.10
- test-v20.10
- lint-v20.12
- test-v20.12

nightly:
triggers:
Expand All @@ -267,12 +267,12 @@ workflows:
name: build-v<< matrix.node-version >>
matrix:
parameters:
node-version: [ "20.10", "18.19" ]
node-version: [ "22.0", "20.12", "18.20" ]
- test:
requires:
- build-v<< matrix.node-version >>
context: next-nightly-build
name: test-v<< matrix.node-version >>
matrix:
parameters:
node-version: [ "20.10", "18.19" ]
node-version: [ "22.0", "20.12", "18.20" ]
28 changes: 14 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"typescript": "^5.3.3"
},
"engines": {
"node": "18.x || 20.x",
"node": "18.x || 20.x || 22.x",
"npm": "8.x || 9.x || 10.x"
},
"volta": {
Expand Down
2 changes: 1 addition & 1 deletion packages/app-info/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"bugs": "https://github.com/Financial-Times/dotcom-reliability-kit/issues?q=label:\"package: app-info\"",
"license": "MIT",
"engines": {
"node": "18.x || 20.x",
"node": "18.x || 20.x || 22.x",
"npm": "8.x || 9.x || 10.x"
},
"main": "lib/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/crash-handler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"bugs": "https://github.com/Financial-Times/dotcom-reliability-kit/issues?q=label:\"package: crash-handler\"",
"license": "MIT",
"engines": {
"node": "18.x || 20.x",
"node": "18.x || 20.x || 22.x",
"npm": "8.x || 9.x || 10.x"
},
"main": "lib",
Expand Down
2 changes: 1 addition & 1 deletion packages/errors/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"bugs": "https://github.com/Financial-Times/dotcom-reliability-kit/issues?q=label:\"package: errors\"",
"license": "MIT",
"engines": {
"node": "18.x || 20.x",
"node": "18.x || 20.x || 22.x",
"npm": "8.x || 9.x || 10.x"
},
"main": "lib"
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"bugs": "https://github.com/Financial-Times/dotcom-reliability-kit/issues?q=label:\"package: eslint-config\"",
"license": "MIT",
"engines": {
"node": "18.x || 20.x",
"node": "18.x || 20.x || 22.x",
"npm": "8.x || 9.x || 10.x"
},
"main": "lib/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/fetch-error-handler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"bugs": "https://github.com/Financial-Times/dotcom-reliability-kit/issues?q=label:\"package: fetch-error-handler\"",
"license": "MIT",
"engines": {
"node": "18.x || 20.x",
"node": "18.x || 20.x || 22.x",
"npm": "8.x || 9.x || 10.x"
},
"main": "lib",
Expand Down
2 changes: 1 addition & 1 deletion packages/log-error/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"bugs": "https://github.com/Financial-Times/dotcom-reliability-kit/issues?q=label:\"package: log-error\"",
"license": "MIT",
"engines": {
"node": "18.x || 20.x",
"node": "18.x || 20.x || 22.x",
"npm": "8.x || 9.x || 10.x"
},
"main": "lib",
Expand Down
2 changes: 1 addition & 1 deletion packages/logger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"bugs": "https://github.com/Financial-Times/dotcom-reliability-kit/issues?q=label:\"package: logger\"",
"license": "MIT",
"engines": {
"node": "18.x || 20.x",
"node": "18.x || 20.x || 22.x",
"npm": "8.x || 9.x || 10.x"
},
"main": "lib",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@
* Returns the parsed JSON logs as an array of log objects.
*/
function splitAndParseJsonLogs(logString) {
return logString
.trim()
.split(/\n+/g)
.filter((log) => log.trim())
.map((log) => JSON.parse(log));
return (
logString
.trim()
.split(/\n+/g)
.filter((log) => log.trim())
// Node.js sometimes logs deprecation warnings which are not valid JSON.
// We need to filter these out so we don't error in our JSON.parse map
.filter((log) => !log.toLowerCase().includes('deprecation'))
.map((log) => JSON.parse(log))
);
}

module.exports = splitAndParseJsonLogs;
2 changes: 1 addition & 1 deletion packages/middleware-log-errors/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"bugs": "https://github.com/Financial-Times/dotcom-reliability-kit/issues?q=label:\"package: middleware-log-errors\"",
"license": "MIT",
"engines": {
"node": "18.x || 20.x",
"node": "18.x || 20.x || 22.x",
"npm": "8.x || 9.x || 10.x"
},
"main": "lib",
Expand Down
2 changes: 1 addition & 1 deletion packages/middleware-render-error-info/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"bugs": "https://github.com/Financial-Times/dotcom-reliability-kit/issues?q=label:\"package: middleware-render-error-info\"",
"license": "MIT",
"engines": {
"node": "18.x || 20.x",
"node": "18.x || 20.x || 22.x",
"npm": "8.x || 9.x || 10.x"
},
"main": "lib",
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"bugs": "https://github.com/Financial-Times/dotcom-reliability-kit/issues?q=label:\"package: opentelemetry\"",
"license": "MIT",
"engines": {
"node": "18.x || 20.x",
"node": "18.x || 20.x || 22.x",
"npm": "8.x || 9.x || 10.x"
},
"main": "lib",
Expand Down
2 changes: 1 addition & 1 deletion packages/serialize-error/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"bugs": "https://github.com/Financial-Times/dotcom-reliability-kit/issues?q=label:\"package: serialize-error\"",
"license": "MIT",
"engines": {
"node": "18.x || 20.x",
"node": "18.x || 20.x || 22.x",
"npm": "8.x || 9.x || 10.x"
},
"main": "lib/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/serialize-request/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"bugs": "https://github.com/Financial-Times/dotcom-reliability-kit/issues?q=label:\"package: serialize-request\"",
"license": "MIT",
"engines": {
"node": "18.x || 20.x",
"node": "18.x || 20.x || 22.x",
"npm": "8.x || 9.x || 10.x"
},
"main": "lib/index.js",
Expand Down
Loading

0 comments on commit e083794

Please sign in to comment.