Skip to content

Commit

Permalink
build: set minimum Node.js version to 12.13
Browse files Browse the repository at this point in the history
This change provides an improved performance baseline as well as access to newer Node.js APIs and Javascript language features which the Angular CLI will now be able to leverage.

BREAKING CHANGE:
Node.js version 10 will become EOL on 2021-04-30.
Angular CLI 12 will require Node.js 12.13+ or 14.15+. Node.js 12.13 and 14.15 are the first LTS releases for their respective majors.
  • Loading branch information
clydin committed Feb 8, 2021
1 parent e00f6c9 commit d1f6169
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 14 deletions.
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ commands:
at: *workspace_location
setup_windows:
steps:
- run: nvm install 12.1.0
- run: nvm use 12.1.0
- run: npm install -g yarn@1.17.3
- run: nvm install 12.13
- run: nvm use 12.13
- run: npm install -g yarn@1.22.10
- run: node --version
- run: yarn --version

Expand Down
2 changes: 1 addition & 1 deletion lib/packages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function loadPackageJson(p: string) {
// Overwrite engines to a common default.
case 'engines':
pkg['engines'] = {
'node': '>= 10.13.0',
'node': '>= 12.13.0',
'npm': '^6.11.0',
'yarn': '>= 1.13.0',
};
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"url": "https://github.com/angular/angular-cli.git"
},
"engines": {
"node": ">=10.13.0 <13.0.0",
"node": ">=12.13.0 <15.0.0",
"yarn": ">=1.22.4"
},
"author": "Angular Authors",
Expand Down
26 changes: 21 additions & 5 deletions packages/angular/cli/bin/ng
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,28 @@ try {
// These may not support ES2015 features such as const/let/async/await/etc.
// These would then crash with a hard to diagnose error message.
// tslint:disable-next-line: no-var-keyword
var version = process.versions.node.split('.').map(part => Number(part));
if (version[0] < 10 || version[0] === 11 || (version[0] === 10 && version[1] < 13)) {
var version = process.versions.node.split('.').map((part) => Number(part));
if (version[0] % 2 === 1 && version[0] > 14) {
// Allow new odd numbered releases with a warning (currently v15+)
console.warn(
'Node.js version ' +
process.version +
' detected.\n' +
'Odd numbered Node.js versions will not enter LTS status and should not be used for production.' +
' For more information, please see https://nodejs.org/en/about/releases/.',
);
} else if (
version[0] < 12 ||
version[0] === 13 ||
(version[0] === 12 && version[1] < 13) ||
(version[0] === 14 && version[1] < 15)
) {
console.error(
'Node.js version ' + process.version + ' detected.\n' +
'The Angular CLI requires a minimum Node.js version of either v10.13 or v12.0.\n\n' +
'Please update your Node.js version or visit https://nodejs.org/ for additional instructions.\n'
'Node.js version ' +
process.version +
' detected.\n' +
'The Angular CLI requires a minimum Node.js version of either v12.13 or v14.15.\n\n' +
'Please update your Node.js version or visit https://nodejs.org/ for additional instructions.\n',
);

process.exitCode = 3;
Expand Down
4 changes: 0 additions & 4 deletions packages/angular_devkit/benchmark/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
"keywords": [
"benchmark"
],
"engines": {
"node": ">= 10.13.0",
"npm": ">= 6.2.0"
},
"dependencies": {
"@angular-devkit/core": "0.0.0",
"ansi-colors": "4.1.1",
Expand Down

0 comments on commit d1f6169

Please sign in to comment.