Skip to content

Commit

Permalink
Add option for Node.js 22, use 20 as default (#1112)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlCalzone authored Sep 13, 2024
1 parent 221e474 commit 327ff60
Show file tree
Hide file tree
Showing 40 changed files with 213 additions and 70 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
(at the beginning of a new line)
-->
## __WORK IN PROGRESS__
* (AlCalzone) Add Node.js 22 as a supported version, set 20 as the default choice (#1112)
* (AlCalzone) Update CI workflows for the adapter creator (#1111)

## 2.6.4 (2024-09-13)
Expand Down
10 changes: 6 additions & 4 deletions src/lib/core/questions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -555,15 +555,17 @@ export const questionGroups: QuestionGroup[] = [
optional: true,
message:
"What's the minimum Node.js version you want to support?",
initial: "18",
choices: ["18", "20"],
initial: "20",
choices: ["18", "20", "22"],
migrate: (ctx) => {
if (ctx.hasDevDependency("@tsconfig/node18")) {
return "18";
} else if (ctx.hasDevDependency("@tsconfig/node20")) {
return "20";
} else if (ctx.hasDevDependency("@tsconfig/node22")) {
return "22";
} else {
return "18";
return "20";
}
},
},
Expand Down Expand Up @@ -979,7 +981,7 @@ export interface Answers {
| "code coverage"
| "devcontainer"
)[];
nodeVersion?: "18" | "20";
nodeVersion?: "18" | "20" | "22";
title?: string;
license?: string;
licenseInformation?: LicenseInformation;
Expand Down
4 changes: 2 additions & 2 deletions templates/_github/workflows/test-and-release.yml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ const templateFunction: TemplateFunction = answers => {
const useReleaseScript = answers.releaseScript === "yes";
const isGitHub = answers.target === "github";

const ltsNodeVersion = "18.x";
const adapterTestVersions = ["18.x", "20.x"];
const ltsNodeVersion = "20.x";
const adapterTestVersions = ["18.x", "20.x", "22.x"];
const adapterTestOS = ["ubuntu-latest", "windows-latest", "macos-latest"];

const adapterName = answers.adapterName;
Expand Down
2 changes: 1 addition & 1 deletion templates/package.json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const templateFunction: TemplateFunction = async answers => {
const useNyc = answers.tools && answers.tools.indexOf("code coverage") > -1;
const useReleaseScript = answers.releaseScript === "yes";

const minNodeVersion = answers.nodeVersion ?? "18";
const minNodeVersion = answers.nodeVersion ?? "20";

const dependencyPromises = [
...(isAdapter ? ["@iobroker/adapter-core"] : [])
Expand Down
2 changes: 1 addition & 1 deletion templates/tsconfig.json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export = (answers => {
const useTypeChecking = answers.tools && answers.tools.indexOf("type checking") > -1;
if (!useTypeScript && !useTypeChecking) return;

const minNodeVersion = answers.nodeVersion ?? "18";
const minNodeVersion = answers.nodeVersion ?? "20";

let include: string;
let exclude: string;
Expand Down
2 changes: 1 addition & 1 deletion test/baselines/ReleaseScript_JS/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"url": "https://github.com/AlCalzone/ioBroker.test-adapter.git"
},
"engines": {
"node": ">= 18"
"node": ">= 20"
},
"dependencies": {
"@iobroker/adapter-core": "^3.1.6"
Expand Down
6 changes: 3 additions & 3 deletions test/baselines/ReleaseScript_TS/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"url": "https://github.com/AlCalzone/ioBroker.test-adapter.git"
},
"engines": {
"node": ">= 18"
"node": ">= 20"
},
"dependencies": {
"@iobroker/adapter-core": "^3.1.6"
Expand All @@ -31,11 +31,11 @@
"@alcalzone/release-script-plugin-manual-review": "^3.7.0",
"@iobroker/adapter-dev": "^1.3.0",
"@iobroker/testing": "^4.1.3",
"@tsconfig/node18": "^18.2.4",
"@tsconfig/node20": "^20.1.4",
"@types/chai-as-promised": "^7.1.8",
"@types/chai": "^4.3.19",
"@types/mocha": "^10.0.8",
"@types/node": "^18.19.50",
"@types/node": "^20.16.5",
"@types/proxyquire": "^1.3.31",
"@types/sinon": "^17.0.3",
"@types/sinon-chai": "^3.2.12",
Expand Down
6 changes: 3 additions & 3 deletions test/baselines/TS_Prettier/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@
"url": "https://github.com/AlCalzone/ioBroker.test-adapter.git"
},
"engines": {
"node": ">= 18"
"node": ">= 20"
},
"dependencies": {
"@iobroker/adapter-core": "^3.1.6"
},
"devDependencies": {
"@iobroker/adapter-dev": "^1.3.0",
"@iobroker/testing": "^4.1.3",
"@tsconfig/node18": "^18.2.4",
"@tsconfig/node20": "^20.1.4",
"@types/chai-as-promised": "^7.1.8",
"@types/chai": "^4.3.19",
"@types/mocha": "^10.0.8",
"@types/node": "^18.19.50",
"@types/node": "^20.16.5",
"@types/proxyquire": "^1.3.31",
"@types/sinon": "^17.0.3",
"@types/sinon-chai": "^3.2.12",
Expand Down
2 changes: 1 addition & 1 deletion test/baselines/TS_SingleQuotes/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Created with @iobroker/create-adapter v2.6.3
* Created with @iobroker/create-adapter v2.6.4
*/

// The adapter-core module gives you access to the core ioBroker functions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@
"type": "free",
"license": "MIT"
},
"creatorVersion": "2.6.3"
"creatorVersion": "2.6.4"
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
steps:
- uses: ioBroker/testing-action-check@v1
with:
node-version: '18.x'
node-version: '20.x'
# Uncomment the following line if your adapter cannot be installed using 'npm ci'
# install-command: 'npm install'
lint: true
Expand All @@ -40,7 +40,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [18.x, 20.x]
node-version: [18.x, 20.x, 22.x]
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
Expand Down Expand Up @@ -74,7 +74,7 @@ jobs:
# steps:
# - uses: ioBroker/testing-action-deploy@v1
# with:
# node-version: '18.x'
# node-version: '20.x'
# # Uncomment the following line if your adapter cannot be installed using 'npm ci'
# # install-command: 'npm install'
# npm-token: ${{ secrets.NPM_TOKEN }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

/*
* Created with @iobroker/create-adapter v2.6.3
* Created with @iobroker/create-adapter v2.6.4
*/

// The adapter-core module gives you access to the core ioBroker functions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@
"url": "https://github.com/AlCalzone/ioBroker.test-adapter.git"
},
"engines": {
"node": ">= 18"
"node": ">= 20"
},
"dependencies": {
"@iobroker/adapter-core": "^3.1.6"
},
"devDependencies": {
"@iobroker/adapter-dev": "^1.3.0",
"@iobroker/testing": "^4.1.3",
"@tsconfig/node18": "^18.2.4",
"@tsconfig/node20": "^20.1.4",
"@types/chai-as-promised": "^7.1.8",
"@types/chai": "^4.3.19",
"@types/mocha": "^10.0.8",
"@types/node": "^18.19.50",
"@types/node": "^20.16.5",
"@types/proxyquire": "^1.3.31",
"@types/sinon": "^17.0.3",
"@types/sinon-chai": "^3.2.12",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Root tsconfig to set the settings and power editor support for all TS files
{
// To update the compilation target, install a different version of @tsconfig/node... and reference it here
// https://github.com/tsconfig/bases#node-18-tsconfigjson
"extends": "@tsconfig/node18/tsconfig.json",
// https://github.com/tsconfig/bases#node-20-tsconfigjson
"extends": "@tsconfig/node20/tsconfig.json",
"compilerOptions": {
// do not compile anything, this file is just to configure type checking
"noEmit": true,
Expand Down
2 changes: 1 addition & 1 deletion test/baselines/adapter_JS_React/.create-adapter.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@
"type": "free",
"license": "MIT"
},
"creatorVersion": "2.6.3"
"creatorVersion": "2.6.4"
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
steps:
- uses: ioBroker/testing-action-check@v1
with:
node-version: '18.x'
node-version: '20.x'
# Uncomment the following line if your adapter cannot be installed using 'npm ci'
# install-command: 'npm install'
lint: true
Expand All @@ -40,7 +40,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [18.x, 20.x]
node-version: [18.x, 20.x, 22.x]
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
Expand Down Expand Up @@ -75,7 +75,7 @@ jobs:
# steps:
# - uses: ioBroker/testing-action-deploy@v1
# with:
# node-version: '18.x'
# node-version: '20.x'
# # Uncomment the following line if your adapter cannot be installed using 'npm ci'
# # install-command: 'npm install'
# build: true
Expand Down
2 changes: 1 addition & 1 deletion test/baselines/adapter_JS_React/main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use strict";

/*
* Created with @iobroker/create-adapter v2.6.3
* Created with @iobroker/create-adapter v2.6.4
*/

// The adapter-core module gives you access to the core ioBroker functions
Expand Down
2 changes: 1 addition & 1 deletion test/baselines/adapter_JS_React/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"url": "https://github.com/AlCalzone/ioBroker.test-adapter.git"
},
"engines": {
"node": ">= 18"
"node": ">= 20"
},
"dependencies": {
"@iobroker/adapter-core": "^3.1.6"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@
"licenseInformation": {
"type": "free"
},
"creatorVersion": "2.6.3"
"creatorVersion": "2.6.4"
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
steps:
- uses: ioBroker/testing-action-check@v1
with:
node-version: '18.x'
node-version: '20.x'
# Uncomment the following line if your adapter cannot be installed using 'npm ci'
# install-command: 'npm install'
type-checking: true
Expand All @@ -41,7 +41,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [18.x, 20.x]
node-version: [18.x, 20.x, 22.x]
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
Expand Down Expand Up @@ -76,7 +76,7 @@ jobs:
# steps:
# - uses: ioBroker/testing-action-deploy@v1
# with:
# node-version: '18.x'
# node-version: '20.x'
# # Uncomment the following line if your adapter cannot be installed using 'npm ci'
# # install-command: 'npm install'
# build: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@
"url": "https://github.com/AlCalzone/ioBroker.test-adapter.git"
},
"engines": {
"node": ">= 18"
"node": ">= 20"
},
"dependencies": {
"@iobroker/adapter-core": "^3.1.6"
},
"devDependencies": {
"@iobroker/adapter-dev": "^1.3.0",
"@iobroker/testing": "^4.1.3",
"@tsconfig/node18": "^18.2.4",
"@tsconfig/node20": "^20.1.4",
"@types/chai-as-promised": "^7.1.8",
"@types/chai": "^4.3.19",
"@types/mocha": "^10.0.8",
"@types/node": "^18.19.50",
"@types/node": "^20.16.5",
"@types/proxyquire": "^1.3.31",
"@types/sinon": "^17.0.3",
"@types/sinon-chai": "^3.2.12",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Created with @iobroker/create-adapter v2.6.3
* Created with @iobroker/create-adapter v2.6.4
*/

// The adapter-core module gives you access to the core ioBroker functions
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Root tsconfig to set the settings and power editor support for all TS files
{
// To update the compilation target, install a different version of @tsconfig/node... and reference it here
// https://github.com/tsconfig/bases#node-18-tsconfigjson
"extends": "@tsconfig/node18/tsconfig.json",
// https://github.com/tsconfig/bases#node-20-tsconfigjson
"extends": "@tsconfig/node20/tsconfig.json",
"compilerOptions": {
// do not compile anything, this file is just to configure type checking
// the compilation is configured in tsconfig.build.json
Expand Down
2 changes: 1 addition & 1 deletion test/baselines/adapter_TS_React/.create-adapter.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@
"type": "free",
"license": "MIT"
},
"creatorVersion": "2.6.3"
"creatorVersion": "2.6.4"
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
steps:
- uses: ioBroker/testing-action-check@v1
with:
node-version: '18.x'
node-version: '20.x'
# Uncomment the following line if your adapter cannot be installed using 'npm ci'
# install-command: 'npm install'
type-checking: true
Expand All @@ -41,7 +41,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [18.x, 20.x]
node-version: [18.x, 20.x, 22.x]
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
Expand Down Expand Up @@ -76,7 +76,7 @@ jobs:
# steps:
# - uses: ioBroker/testing-action-deploy@v1
# with:
# node-version: '18.x'
# node-version: '20.x'
# # Uncomment the following line if your adapter cannot be installed using 'npm ci'
# # install-command: 'npm install'
# build: true
Expand Down
6 changes: 3 additions & 3 deletions test/baselines/adapter_TS_React/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"url": "https://github.com/AlCalzone/ioBroker.test-adapter.git"
},
"engines": {
"node": ">= 18"
"node": ">= 20"
},
"dependencies": {
"@iobroker/adapter-core": "^3.1.6"
Expand All @@ -29,11 +29,11 @@
"@iobroker/adapter-react": "2.0.22",
"@iobroker/testing": "^4.1.3",
"@material-ui/core": "^4.12.4",
"@tsconfig/node18": "^18.2.4",
"@tsconfig/node20": "^20.1.4",
"@types/chai-as-promised": "^7.1.8",
"@types/chai": "^4.3.19",
"@types/mocha": "^10.0.8",
"@types/node": "^18.19.50",
"@types/node": "^20.16.5",
"@types/proxyquire": "^1.3.31",
"@types/react-dom": "^17.0.25",
"@types/react": "^17.0.80",
Expand Down
Loading

0 comments on commit 327ff60

Please sign in to comment.