Skip to content

Commit

Permalink
feat(@angular/cli): add support for Node.js version 18
Browse files Browse the repository at this point in the history
Pacote version 14 does requires `14.17.x` or `16.13.x`.

BREAKING CHANGE: The Angular CLI  no longer supports `16.10.x`, `16.11.x` and `16.12.x`. Current supported versions of Node.js are `14.20.x`, `16.13.x` and `18.10.x`.
  • Loading branch information
alan-agius4 authored and clydin committed Oct 7, 2022
1 parent 93adeeb commit 4827d1b
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 18 deletions.
10 changes: 5 additions & 5 deletions .circleci/dynamic_config.yml
Expand Up @@ -24,7 +24,7 @@ parameters:
# Windows needs its own cache key because binaries in node_modules are different.
# See https://circleci.com/docs/2.0/caching/#restoring-cache for how prefixes work in CircleCI.
var_1: &cache_key v1-angular_devkit-14.20-{{ checksum "yarn.lock" }}
var_1_win: &cache_key_win v1-angular_devkit-win-16.10-{{ checksum "yarn.lock" }}
var_1_win: &cache_key_win v1-angular_devkit-win-16.13-{{ checksum "yarn.lock" }}
var_3: &default_nodeversion '14.20'
var_3_major: &default_nodeversion_major '14'
# The major version of node toolchains. See tools/toolchain_info.bzl
Expand Down Expand Up @@ -114,8 +114,8 @@ commands:
setup_windows:
steps:
- initialize_env
- run: nvm install 16.10
- run: nvm use 16.10
- run: nvm install 16.13
- run: nvm use 16.13
- run: npm install -g yarn@1.22.10
- run: node --version
- run: yarn --version
Expand Down Expand Up @@ -421,15 +421,15 @@ workflows:
matrix:
alias: e2e-cli
parameters:
nodeversion: ['14.20', '16.10']
nodeversion: ['14.20', '16.13', '18.10']

This comment has been minimized.

Copy link
@minijus

minijus Oct 12, 2022

Contributor

There is known issue on 16.10+ versions for Jest with memory consumption.
See: jestjs/jest#11956

And with slow adoption of Jest v29 (nrwl/nx does not support it yet), this could potentially be a problem for many projects with bigger codebases.

This comment has been minimized.

Copy link
@alan-agius4

alan-agius4 Oct 12, 2022

Author Collaborator

There is a discussion about this in the PR

See: #24026

subset: *all_e2e_subsets
requires:
- build
<<: *only_release_branches

- e2e-tests:
name: e2e-snapshots-<< matrix.subset >>
nodeversion: '16.10'
nodeversion: '16.13'
matrix:
parameters:
subset: *all_e2e_subsets
Expand Down
2 changes: 1 addition & 1 deletion constants.bzl
@@ -1,5 +1,5 @@
# Engine versions to stamp in a release package.json
RELEASE_ENGINES_NODE = "^14.20.0 || >=16.10.0"
RELEASE_ENGINES_NODE = "^14.20.0 || ^16.13.0 || >=18.10.0"
RELEASE_ENGINES_NPM = "^6.11.0 || ^7.5.6 || >=8.0.0"
RELEASE_ENGINES_YARN = ">= 1.13.0"

Expand Down
2 changes: 1 addition & 1 deletion docs/DEVELOPER.md
Expand Up @@ -6,7 +6,7 @@ To get started locally, follow these instructions:

1. If you haven't done it already, [make a fork of this repo](https://github.com/angular/angular-cli/fork).
1. Clone to your local computer using `git`.
1. Make sure that you have Node `v14.20`, or `v16.10` installed. See instructions [here](https://nodejs.org/en/download/).
1. Make sure that you have Node `v14.20`, `v16.13` or `v18.10` installed. See instructions [here](https://nodejs.org/en/download/).
1. Make sure that you have `yarn` installed; see instructions [here](https://yarnpkg.com/lang/en/docs/install/).
1. Run `yarn` (no arguments) from the root of your clone of this project to install dependencies.

Expand Down
2 changes: 1 addition & 1 deletion lib/packages.ts
Expand Up @@ -85,7 +85,7 @@ function loadPackageJson(p: string) {
// Overwrite engines to a common default.
case 'engines':
pkg['engines'] = {
'node': '^14.20.0 || >=16.10.0',
'node': '^14.20.0 || ^16.13.0 || >=18.10.0',
'npm': '^6.11.0 || ^7.5.6 || >=8.0.0',
'yarn': '>= 1.13.0',
};
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -41,7 +41,7 @@
"url": "https://github.com/angular/angular-cli.git"
},
"engines": {
"node": "^14.20.0 || ^16.10.0",
"node": "^14.20.0 || ^16.13.0 || ^18.10.0",
"yarn": ">=1.21.1 <2",
"npm": "Please use yarn instead of NPM to install dependencies"
},
Expand Down
12 changes: 6 additions & 6 deletions packages/angular/cli/bin/ng.js
Expand Up @@ -24,7 +24,7 @@ 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.
var version = process.versions.node.split('.').map((part) => Number(part));
if (version[0] % 2 === 1 && version[0] > 16) {
if (version[0] % 2 === 1) {
// Allow new odd numbered releases with a warning (currently v17+)
console.warn(
'Node.js version ' +
Expand All @@ -37,16 +37,16 @@ if (version[0] % 2 === 1 && version[0] > 16) {
require('./bootstrap');
} else if (
version[0] < 14 ||
version[0] === 15 ||
(version[0] === 14 && version[1] < 15) ||
(version[0] === 16 && version[1] < 10)
(version[0] === 14 && version[1] < 20) ||
(version[0] === 16 && version[1] < 13) ||
(version[0] === 18 && version[1] < 10)
) {
// Error and exit if less than 14.20 or 15.x or less than 16.10
// Error and exit if less than 14.20, 16.13 or 18.10
console.error(
'Node.js version ' +
process.version +
' detected.\n' +
'The Angular CLI requires a minimum Node.js version of either v14.20, or v16.10.\n\n' +
'The Angular CLI requires a minimum Node.js version of either v14.20, v16.13 or v18.10.\n\n' +
'Please update your Node.js version or visit https://nodejs.org/ for additional instructions.\n',
);

Expand Down
4 changes: 2 additions & 2 deletions packages/angular/cli/src/commands/version/cli.ts
Expand Up @@ -22,7 +22,7 @@ interface PartialPackageInfo {
/**
* Major versions of Node.js that are officially supported by Angular.
*/
const SUPPORTED_NODE_MAJORS = [14, 16];
const SUPPORTED_NODE_MAJORS = [14, 16, 18];

const PACKAGE_PATTERNS = [
/^@angular\/.*/,
Expand Down Expand Up @@ -118,7 +118,7 @@ export class VersionCommandModule extends CommandModule implements CommandModule
`
Angular CLI: ${ngCliVersion}
Node: ${process.versions.node}${unsupportedNodeVersion ? ' (Unsupported)' : ''}
Package Manager: ${packageManager.name} ${packageManager.version ?? '<error>'}
Package Manager: ${packageManager.name} ${packageManager.version ?? '<error>'}
OS: ${process.platform} ${process.arch}
Angular: ${angularCoreVersion}
Expand Down
2 changes: 1 addition & 1 deletion tools/test/expected_package.json
Expand Up @@ -35,7 +35,7 @@
}
},
"engines": {
"node": "^14.20.0 || >=16.10.0",
"node": "^14.20.0 || ^16.13.0 || >=18.10.0",
"npm": "^6.11.0 || ^7.5.6 || >=8.0.0",
"yarn": ">= 1.13.0"
}
Expand Down

0 comments on commit 4827d1b

Please sign in to comment.