Skip to content

Commit

Permalink
feat(node): drop node 12 support (#3302)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
rwaskiewicz committed Dec 5, 2022
1 parent 2c77cc4 commit defffcd
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node: ['12', '14', '16']
node: ['14', '16']
os: ['ubuntu-latest', 'windows-latest']
runs-on: ${{ matrix.os }}
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node: ['12', '14', '16']
node: ['14', '16']
os: ['ubuntu-latest', 'windows-latest']
runs-on: ${{ matrix.os }}
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node: ['12', '14', '16']
node: ['14', '16']
os: ['ubuntu-latest', 'windows-latest']
runs-on: ${{ matrix.os }}
steps:
Expand Down
6 changes: 3 additions & 3 deletions bin/stencil
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env node
'use strict';

var minimumVersion = '12.10';
var minimumVersion = '14.5';
var futureDeprecationMinVersion = '14.0';
var recommendedVersion = '14.5';
var recommendedVersion = '16.4';
var currentVersion = process.versions.node;

function isNodeLT(v) {
Expand Down Expand Up @@ -33,7 +33,7 @@ if (isNodeLT(futureDeprecationMinVersion)) {
currentVersion +
", however Stencil's recommendation is v" +
recommendedVersion +
'.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'
'.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'
);
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
"ws": "7.4.6"
},
"engines": {
"node": ">=12.10.0",
"node": ">=14.10.0",
"npm": ">=6.0.0"
},
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion scripts/bundles/helpers/compiler-cjs-intro.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ if (!process.platform) {
process.platform = 'stencil';
}
if (!process.version) {
process.version = 'v12.0.0';
process.version = 'v14.0.0';
}
process.browser = !!globalThis.location;
6 changes: 6 additions & 0 deletions src/sys/node/node-sys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,9 @@ export function createNodeSys(c: { process?: any } = {}): CompilerSystem {
return new Promise((resolve) => {
const recursive = !!(opts && opts.recursive);
if (recursive) {
// TODO(STENCIL-410): In a future version of Node, `force: true` will be required in the options argument. At
// the time of this writing, Stencil's Node typings do not support this option.
// https://nodejs.org/docs/latest-v16.x/api/deprecations.html#dep0147-fsrmdirpath--recursive-true-
fs.rmdir(p, { recursive: true }, (err) => {
resolve({
basename: path.basename(p),
Expand Down Expand Up @@ -382,6 +385,9 @@ export function createNodeSys(c: { process?: any } = {}): CompilerSystem {
try {
const recursive = !!(opts && opts.recursive);
if (recursive) {
// TODO(STENCIL-410): In a future version of Node, `force: true` will be required in the options argument. At
// the time of this writing, Stencil's Node typings do not support this option.
// https://nodejs.org/docs/latest-v16.x/api/deprecations.html#dep0147-fsrmdirpath--recursive-true-
fs.rmdirSync(p, { recursive: true });
} else {
fs.rmdirSync(p);
Expand Down
4 changes: 2 additions & 2 deletions test/karma/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"workbox-build": "4.3.1"
},
"volta": {
"node": "12.22.7",
"npm": "6.14.15"
"node": "14.5.0",
"npm": "6.14.16"
}
}

0 comments on commit defffcd

Please sign in to comment.