Skip to content

Commit cb1f5fc

Browse files
committed
feat(node): drop node 12 support (#3302)
this commit drops node 12 support from stencil by: - removing node 12 from main CI workflow - updating minimum, recommended versions for running stencil to v14.5 and 16.14, respectively - updating volta versions of node, npm for our karma tests - updating the 'engines' field of package.json - setting the minimum default version of node in compiler - adding todos to the codebase for future (Node 18+) work that will be caused by future deprecations STENCIL-176: Drop Node 12 Support BREAKING CHANGE: Node v14+ is now required by Stencil
1 parent 602b322 commit cb1f5fc

File tree

8 files changed

+16
-10
lines changed

8 files changed

+16
-10
lines changed

.github/workflows/test-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
strategy:
1212
fail-fast: false
1313
matrix:
14-
node: ['12', '14', '16']
14+
node: ['14', '16']
1515
os: ['ubuntu-20.04', 'windows-latest']
1616
runs-on: ${{ matrix.os }}
1717
steps:

.github/workflows/test-e2e.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
strategy:
1212
fail-fast: false
1313
matrix:
14-
node: ['12', '14', '16']
14+
node: ['14', '16']
1515
os: ['ubuntu-20.04', 'windows-latest']
1616
runs-on: ${{ matrix.os }}
1717
steps:

.github/workflows/test-unit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
strategy:
1212
fail-fast: false
1313
matrix:
14-
node: ['12', '14', '16']
14+
node: ['14', '16']
1515
os: ['ubuntu-20.04', 'windows-latest']
1616
runs-on: ${{ matrix.os }}
1717
steps:

bin/stencil

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#!/usr/bin/env node
22
'use strict';
33

4-
var minimumVersion = '12.10';
4+
var minimumVersion = '14.5';
55
var futureDeprecationMinVersion = '14.0';
6-
var recommendedVersion = '14.5';
6+
var recommendedVersion = '16.4';
77
var currentVersion = process.versions.node;
88

99
function isNodeLT(v) {
@@ -33,7 +33,7 @@ if (isNodeLT(futureDeprecationMinVersion)) {
3333
currentVersion +
3434
", however Stencil's recommendation is v" +
3535
recommendedVersion +
36-
'.0 or greater. Note that future versions of Stencil will eventually remove support for non-LTS Node versions and an Active LTS version is recommended (https://nodejs.org/en/about/releases/).\n'
36+
'.0 or greater. Note that future versions of Stencil will eventually remove support for older Node versions and an Active LTS version is recommended (https://nodejs.org/en/about/releases/).\n'
3737
);
3838
}
3939

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@
127127
"ws": "8.12.0"
128128
},
129129
"engines": {
130-
"node": ">=12.10.0",
130+
"node": ">=14.10.0",
131131
"npm": ">=6.0.0"
132132
},
133133
"repository": {

scripts/bundles/helpers/compiler-cjs-intro.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@ if (!process.platform) {
3131
process.platform = 'stencil';
3232
}
3333
if (!process.version) {
34-
process.version = 'v12.0.0';
34+
process.version = 'v14.0.0';
3535
}
3636
process.browser = !!globalThis.location;

src/sys/node/node-sys.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,9 @@ export function createNodeSys(c: { process?: any } = {}): CompilerSystem {
354354
return new Promise((resolve) => {
355355
const recursive = !!(opts && opts.recursive);
356356
if (recursive) {
357+
// TODO(STENCIL-410): In a future version of Node, `force: true` will be required in the options argument. At
358+
// the time of this writing, Stencil's Node typings do not support this option.
359+
// https://nodejs.org/docs/latest-v16.x/api/deprecations.html#dep0147-fsrmdirpath--recursive-true-
357360
fs.rmdir(p, { recursive: true }, (err) => {
358361
resolve({
359362
basename: path.basename(p),
@@ -382,6 +385,9 @@ export function createNodeSys(c: { process?: any } = {}): CompilerSystem {
382385
try {
383386
const recursive = !!(opts && opts.recursive);
384387
if (recursive) {
388+
// TODO(STENCIL-410): In a future version of Node, `force: true` will be required in the options argument. At
389+
// the time of this writing, Stencil's Node typings do not support this option.
390+
// https://nodejs.org/docs/latest-v16.x/api/deprecations.html#dep0147-fsrmdirpath--recursive-true-
385391
fs.rmdirSync(p, { recursive: true });
386392
} else {
387393
fs.rmdirSync(p);

test/karma/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"workbox-build": "4.3.1"
4545
},
4646
"volta": {
47-
"node": "12.22.7",
48-
"npm": "6.14.15"
47+
"node": "14.5.0",
48+
"npm": "6.14.16"
4949
}
5050
}

0 commit comments

Comments
 (0)