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 Apr 20, 2022
1 parent 28b7e85 commit 72779d9
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
build_and_test:
strategy:
matrix:
node: ['12', '14', '16']
node: ['14', '16']
os: ['ubuntu-latest', 'windows-latest']

name: Node ${{ matrix.node }} on ${{ matrix.os }}
Expand Down Expand Up @@ -59,7 +59,7 @@ jobs:

- name: Unload build artifacts
uses: actions/upload-artifact@v2
if: matrix.os == 'ubuntu-latest' && matrix.node == '12'
if: matrix.os == 'ubuntu-latest' && matrix.node == '14'
with:
name: stencil-build
path: stencil-build.tgz
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 @@ -130,7 +130,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 @@ -344,6 +344,9 @@ export function createNodeSys(c: { process?: any } = {}) {
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 @@ -372,6 +375,9 @@ export function createNodeSys(c: { process?: any } = {}) {
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 @@ -46,7 +46,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 72779d9

Please sign in to comment.