-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
123 changed files
with
2,139 additions
and
1,711 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Simplify maintenance of ESLint config by using the `"latest"` parser version | ||
|
||
Previously, ESLint required the developer to specify which ECMAScript version to use for parsing. When using newer JavaScript features, this setting had to be changed for ESLint to work. | ||
It is now possible to set the field to `"latest"`, which will make further changes unnecessary. | ||
|
||
To do this, edit the ESLint config as follows (2022 can be a diffent number currently): | ||
|
||
**If you have a file `.eslintrc.json`:** | ||
|
||
```diff | ||
"parserOptions": { | ||
- "ecmaVersion": 2022, | ||
+ "ecmaVersion": "latest", | ||
``` | ||
|
||
**If you have a file `.eslintrc.js`:** | ||
|
||
```diff | ||
parserOptions: { | ||
- ecmaVersion: 2022, | ||
+ ecmaVersion: "latest", | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
# Update package configuration to reflect minimum Node.js version required | ||
|
||
As Node.js 16 is EOL and Node.js 20 is already available, new adapters should support either Node.js 18 or 20 as the minimum version. There are a few changes necessary in `package.json` to reflect this when upgrading an existing adapter. | ||
|
||
The `engines` field must specify the minimum version: | ||
|
||
```diff | ||
"engines": { | ||
- "node": ">= 16" | ||
+ "node": ">= 18" | ||
}, | ||
``` | ||
|
||
```diff | ||
"engines": { | ||
- "node": ">= 16" | ||
+ "node": ">= 20" | ||
}, | ||
``` | ||
|
||
In addition, the testing workflow also needs to be updated. To do this, edit `.github/workflows/test-and-release.yml` as follows: | ||
|
||
```diff | ||
steps: | ||
- uses: ioBroker/testing-action-check@v1 | ||
with: | ||
- node-version: '16.x' | ||
+ node-version: '18.x' | ||
# Uncomment the following line if your adapter cannot be installed using 'npm ci' | ||
# install-command: 'npm install' | ||
lint: true | ||
... | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
- node-version: [16.x, 18.x, 20.x] | ||
+ node-version: [18.x, 20.x] | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
|
||
steps: | ||
... | ||
# steps: | ||
# - uses: ioBroker/testing-action-deploy@v1 | ||
# with: | ||
-# node-version: '16.x' | ||
+# node-version: '18.x' | ||
# # Uncomment the following line if your adapter cannot be installed using 'npm ci' | ||
# # install-command: 'npm install' | ||
# npm-token: ${{ secrets.NPM_TOKEN }} | ||
``` | ||
|
||
--- | ||
|
||
When using TypeScript or when type-checking is enabled, the type definitions and `tsconfig.json` need to be updated aswell. | ||
First, update TypeScript itself: | ||
|
||
```bash | ||
npm i -D "typescript@~5.3.3" | ||
``` | ||
|
||
To update the Node.js type definitions, run **one** of the following commands depending on the desired Node.js version: | ||
|
||
```bash | ||
npm i -D @types/node@18 | ||
npm i -D @types/node@20 | ||
``` | ||
|
||
Next, uninstall the old tsconfig base: | ||
|
||
```bash | ||
npm uninstall -D @tsconfig/node16 | ||
``` | ||
|
||
(or an even older version if you still use that). | ||
|
||
Then, run **one** of the following commands depending on the desired Node.js version: | ||
|
||
```bash | ||
npm i -D @tsconfig/node18 | ||
npm i -D @tsconfig/node20 | ||
``` | ||
|
||
Last, reference this new base in your `tsconfig.json` by replacing `node16` with the version you just installed the tsconfig for, e.g. `node18` for Node.js 18: | ||
|
||
```diff | ||
{ | ||
- "extends": "@tsconfig/node16/tsconfig.json", | ||
+ "extends": "@tsconfig/node18/tsconfig.json", | ||
// ... | ||
} | ||
``` |
Oops, something went wrong.