Skip to content

Commit

Permalink
Require Node 16+ while building/testing on Node 20 (#596)
Browse files Browse the repository at this point in the history
* Use canonical encoding/readFile command to take advantage of fast path in Node 20

Fast path doesn't appear to check encoding options case insensitive, 'utf8' seems more canonical.

Signed-off-by: Chad Wilson <[email protected]>

* Apply workaround for mock-fs Node 20 issue

See tschaub/mock-fs#377

Signed-off-by: Chad Wilson <[email protected]>

* Migrate build to Node 20

Node 16 is nearly EOL, and Node 20 is nearly LTS, so let's go straight there. This remove use of a deprecated npm flag, replacing with alternative compatible with npm 7/NodeJS 16 onwards (2021+, Node 16 recently went EOL in Sep 2023). The package-lock is also now only compatible with Node 16/npm 7 onwards.

Since this is technically a breaking change in npm/node compatibility, bumps the major version and updates the documentation as such.

Signed-off-by: Chad Wilson <[email protected]>

---------

Signed-off-by: Chad Wilson <[email protected]>
  • Loading branch information
chadlwilson authored Sep 26, 2023
1 parent b1151ab commit 4c4a021
Show file tree
Hide file tree
Showing 13 changed files with 313 additions and 1,934 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Set up Nodejs
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20

- name: Setup submodule
run: |
Expand Down Expand Up @@ -51,7 +51,7 @@ jobs:
- name: Set up Nodejs
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20

- name: Setup java
uses: actions/setup-java@v3
Expand Down Expand Up @@ -99,7 +99,7 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20

- name: Setup go 1.20.x
uses: actions/setup-go@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Set up Nodejs
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20

- name: Setup git
run: |
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ The plugin is authored in [Javascript](https://en.wikipedia.org/wiki/JavaScript)
Gauge is authored in golang. These are independent processes talking to each other over TCP on port GAUGE_INTERNAL_PORT (env variable) using [Protobuf](https://github.com/getgauge/gauge-proto).

##### Pre-Requisites
* [Node.js](https://nodejs.org/en/) - Version >= 12
* [Node.js](https://nodejs.org/en/) - Version >= 16
* [Npm](https://www.npmjs.com/get-npm)

##### Compiling
Expand Down
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#! /usr/bin/env node

var version = process.versions.node.split(".");
if (parseInt(version[0]) === 0 && parseInt(version[1]) < 12) {
throw new Error("gauge-js requires Node.js version 0.12+. Current version: " + process.versions.node);
if (parseInt(version[0]) < 16) {
throw new Error("gauge-js requires Node.js version 16+. Current version: " + process.versions.node);
}

var fs = require("fs"),
Expand Down
8 changes: 4 additions & 4 deletions js.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@
"windows": [
"npm",
"install",
"--production",
"--omit=dev",
"--silent"
],
"darwin": [
"npm",
"install",
"--production",
"--omit=dev",
"--silent"
],
"linux": [
"npm",
"install",
"--production",
"--omit=dev",
"--silent"
]
},
Expand All @@ -51,7 +51,7 @@
"--init"
]
},
"version": "3.0.1",
"version": "4.0.0",
"gaugeVersionSupport": {
"minimum": "1.0.7",
"maximum": ""
Expand Down
Loading

0 comments on commit 4c4a021

Please sign in to comment.