Skip to content

Commit

Permalink
refactor(@angular/cli): remove Node.js v14 support
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Node.js v14 support has been removed

Node.js v14 is planned to be End-of-Life on 2023-04-30. Angular will stop supporting Node.js v14 in Angular v16.
Angular v16 will continue to officially support Node.js versions v16 and v18.
  • Loading branch information
clydin authored and angular-robot[bot] committed Feb 16, 2023
1 parent a8968b6 commit c29c8e1
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 39 deletions.
12 changes: 6 additions & 6 deletions .circleci/dynamic_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ parameters:
## IMPORTANT
# 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: &cache_key v1-angular_devkit-16.13-{{ 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'
var_3: &default_nodeversion '16.13'
var_3_major: &default_nodeversion_major '16'
# The major version of node toolchains. See tools/toolchain_info.bzl
# NOTE: entries in this array may be repeated elsewhere in the file, find them before adding more
var_3_all_major: &all_nodeversion_major ['14', '16', '18']
var_3_all_major: &all_nodeversion_major ['16', '18']
# Workspace initially persisted by the `setup` job, and then enhanced by `setup-and-build-win`.
# https://circleci.com/docs/2.0/workflows/#using-workspaces-to-share-data-among-jobs
# https://circleci.com/blog/deep-diving-into-circleci-workspaces/
Expand Down Expand Up @@ -236,7 +236,7 @@ jobs:
equal: [*default_nodeversion_major, << parameters.nodeversion >>]
steps:
- run:
command: yarn bazel test --test_tag_filters=-node16,-node18,-node<< parameters.nodeversion >>-broken //packages/...
command: yarn bazel test --test_tag_filters=-node18,-node<< parameters.nodeversion >>-broken //packages/...
# This timeout provides time for the actual tests to timeout and report status
# instead of CircleCI stopping the job without test failure information.
no_output_timeout: 40m
Expand Down Expand Up @@ -402,7 +402,7 @@ workflows:
# Disable running this on Node.js 18 for now. This causes failures when using RBE.
# Example: `GLIBC_2.28' not found.
# Likely this is caused by outdated Ubuntu image https://github.com/angular/dev-infra/blob/main/bazel/remote-execution/BUILD.bazel#L21
nodeversion: ['14', '16']
nodeversion: ['16']
requires:
- build

Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14.20.0
18.10.0
24 changes: 7 additions & 17 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,13 @@ rules_pkg_dependencies()
load("@rules_nodejs//nodejs:repositories.bzl", "nodejs_register_toolchains")

nodejs_register_toolchains(
name = "nodejs",
node_version = "14.20.0",
name = "node16",
node_version = "16.13.1",
)

nodejs_register_toolchains(
name = "node18",
node_version = "18.10.0",
)

load("@build_bazel_rules_nodejs//:index.bzl", "yarn_install")
Expand Down Expand Up @@ -89,21 +94,6 @@ aspect_bazel_lib_dependencies()

register_jq_toolchains(version = "1.6")

nodejs_register_toolchains(
name = "node14",
node_version = "14.20.0",
)

nodejs_register_toolchains(
name = "node16",
node_version = "16.13.1",
)

nodejs_register_toolchains(
name = "node18",
node_version = "18.10.0",
)

register_toolchains(
"@npm//@angular/build-tooling/bazel/git-toolchain:git_linux_toolchain",
"@npm//@angular/build-tooling/bazel/git-toolchain:git_macos_x86_toolchain",
Expand Down
2 changes: 1 addition & 1 deletion constants.bzl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Engine versions to stamp in a release package.json
RELEASE_ENGINES_NODE = "^14.20.0 || ^16.13.0 || >=18.10.0"
RELEASE_ENGINES_NODE = "^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 lib/packages.ts
Original file line number Diff line number Diff line change
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.13.0 || >=18.10.0',
'node': '^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
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"url": "https://github.com/angular/angular-cli.git"
},
"engines": {
"node": "^14.20.0 || ^16.13.0 || ^18.10.0",
"node": "^16.13.0 || ^18.10.0",
"yarn": ">=1.21.1 <2",
"npm": "Please use yarn instead of NPM to install dependencies"
},
Expand Down
8 changes: 4 additions & 4 deletions packages/angular/cli/lib/cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@ import { writeErrorToLogFile } from '../../src/utilities/log-file';

export { VERSION } from '../../src/utilities/version';

const MIN_NODEJS_VERISON = [14, 15] as const;
const MIN_NODEJS_VERSION = [16, 13] as const;

/* eslint-disable no-console */
export default async function (options: { cliArgs: string[] }) {
// This node version check ensures that the requirements of the project instance of the CLI are met
const [major, minor] = process.versions.node.split('.').map((part) => Number(part));
if (
major < MIN_NODEJS_VERISON[0] ||
(major === MIN_NODEJS_VERISON[0] && minor < MIN_NODEJS_VERISON[1])
major < MIN_NODEJS_VERSION[0] ||
(major === MIN_NODEJS_VERSION[0] && minor < MIN_NODEJS_VERSION[1])
) {
process.stderr.write(
`Node.js version ${process.version} detected.\n` +
`The Angular CLI requires a minimum of v${MIN_NODEJS_VERISON[0]}.${MIN_NODEJS_VERISON[1]}.\n\n` +
`The Angular CLI requires a minimum of v${MIN_NODEJS_VERSION[0]}.${MIN_NODEJS_VERSION[1]}.\n\n` +
'Please update your Node.js version or visit https://nodejs.org/ for additional instructions.\n',
);

Expand Down
2 changes: 1 addition & 1 deletion packages/angular/cli/src/commands/version/cli.ts
Original file line number Diff line number Diff line change
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, 18];
const SUPPORTED_NODE_MAJORS = [16, 18];

const PACKAGE_PATTERNS = [
/^@angular\/.*/,
Expand Down
2 changes: 1 addition & 1 deletion tools/test/expected_package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
}
},
"engines": {
"node": "^14.20.0 || ^16.13.0 || >=18.10.0",
"node": "^16.13.0 || >=18.10.0",
"npm": "^6.11.0 || ^7.5.6 || >=8.0.0",
"yarn": ">= 1.13.0"
}
Expand Down
6 changes: 0 additions & 6 deletions tools/toolchain_info.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,12 @@
# the name can be anything the user wants this is just added to the target to create unique names
# the order will match against the order in the TOOLCHAIN_VERSION list.
TOOLCHAINS_NAMES = [
"node14",
"node16",
"node18",
]

# this is the list of toolchains that should be used and are registered with nodejs_register_toolchains in the WORKSPACE file
TOOLCHAINS_VERSIONS = [
select({
"@bazel_tools//src/conditions:linux_x86_64": "@node14_linux_amd64//:node_toolchain",
"@bazel_tools//src/conditions:darwin": "@node14_darwin_amd64//:node_toolchain",
"@bazel_tools//src/conditions:windows": "@node14_windows_amd64//:node_toolchain",
}),
select({
"@bazel_tools//src/conditions:linux_x86_64": "@node16_linux_amd64//:node_toolchain",
"@bazel_tools//src/conditions:darwin": "@node16_darwin_amd64//:node_toolchain",
Expand Down

0 comments on commit c29c8e1

Please sign in to comment.