Skip to content
This repository was archived by the owner on Apr 13, 2025. It is now read-only.

Commit ff8808a

Browse files
committed
feat: Bump minimum node.js version from 12 to 14.14.0
With nodecg-io 0.3.0 node.js 14 or higher is required for development installations. This minimum version is required by the husky dependency but I think some other dependencies also want node.js 14+. I think it is reasonable to bump the minimum supported node.js version to 14 now. Most people should be able to upgrade to node.js 14 without any problems. Updates the check at cli startup to require node.js 14 and also updates node.js version in the GitHub Actions CI configuration.
1 parent 255238e commit ff8808a

File tree

3 files changed

+19
-14
lines changed

3 files changed

+19
-14
lines changed

.github/workflows/ci.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
fail-fast: false
88
matrix:
99
os: [ubuntu-latest, windows-2019]
10-
node: [12, 14, 16, 17]
10+
node: [14, 16, 18]
1111

1212
runs-on: ${{ matrix.os }}
1313
steps:
@@ -31,7 +31,7 @@ jobs:
3131
matrix:
3232
os: [ubuntu-latest, windows-2019]
3333
version: ['0.1', '0.2', 'development']
34-
node: [14, 16]
34+
node: [14, 18]
3535

3636
runs-on: ${{ matrix.os }}
3737
steps:
@@ -77,7 +77,7 @@ jobs:
7777
- name: Setup Node.js
7878
uses: actions/setup-node@v3
7979
with:
80-
node-version: 16
80+
node-version: 18
8181

8282
- name: Install dependencies
8383
run: npm ci

src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import yargs from "yargs";
22
import { installModule } from "./install";
33
import { uninstallModule } from "./uninstall";
44
import { version } from "../package.json";
5-
import { checkForCliUpdate, ensureNode12 } from "./utils/cli";
5+
import { checkForCliUpdate, ensureMinimumNodeVersion } from "./utils/cli";
66
import { generateModule } from "./generate";
77

88
// This file gets imported by the index.js file of the repository root.
@@ -22,7 +22,7 @@ const args = yargs(process.argv.slice(2))
2222
})
2323
.parse();
2424

25-
ensureNode12();
25+
ensureMinimumNodeVersion();
2626
(async () => {
2727
const opts = await args;
2828
if (!opts["disable-updates"]) {

src/utils/cli.ts

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,25 @@ import * as semver from "semver";
66
import { SemVer } from "semver";
77

88
/**
9-
* Ensures that the cli is executed with at least node 12. This is the minimum version that is required
10-
* and if it is older the cli will exit.
9+
* Minimum node.js version that is required to use nodecg-io and this cli.
1110
*/
12-
export function ensureNode12(): void {
11+
const minimumNodeVersion = "14.14.0";
12+
13+
/**
14+
* Ensures that the node.js installation that is used to execute the cli
15+
* meets the required minimum node.js version for nodecg-io,
16+
* If it is older the cli will log an error about it and exit.
17+
*/
18+
export function ensureMinimumNodeVersion(): void {
1319
const nodeVersion = process.versions.node;
14-
const range = new semver.Range(">=12");
20+
const range = new semver.Range(`>=${minimumNodeVersion}`);
1521

1622
if (!semver.satisfies(nodeVersion, range)) {
1723
logger.error("Please update your node installation.");
18-
logger.error(
19-
`nodecg-io-cli requires at least node ${chalk.yellowBright("12")}. You have ${chalk.yellowBright(
20-
nodeVersion,
21-
)}`,
22-
);
24+
25+
const minVer = chalk.yellowBright(minimumNodeVersion);
26+
const curVer = chalk.yellowBright(nodeVersion);
27+
logger.error(`nodecg-io-cli requires at least node ${minVer}. You have ${curVer}`);
2328
process.exit(1);
2429
}
2530
}

0 commit comments

Comments
 (0)