feat(@angular/cli): support for Node.js v22

Add support for Node.js v22
This commit is contained in:
Alan Agius 2024-04-25 10:44:09 +00:00 committed by Alan Agius
parent ffb5428565
commit 4087728c3e
6 changed files with 31 additions and 5 deletions

View File

@ -113,20 +113,25 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
node: [18, 20]
node: [18, 20, 22]
subset: [npm, yarn, esbuild]
shard: [0, 1, 2, 3, 4, 5]
exclude:
# Exclude Node.js v18 when running on a PR
- node: ${{ github.event_name != 'pull_request' && 'none' || '18' }}
# Exclude Node.js v20 when running on a PR
- node: ${{ github.event_name != 'pull_request' && 'none' || '20' }}
# Exclude Windows when running on a PR
- os: ${{ github.event_name != 'pull_request' && 'none' || 'windows-latest' }}
# Skip yarn subset on Windows
- os: windows-latest
subset: yarn
# Skip node 18 tests on Windows
# Skip Node.js v18 tests on Windows
- os: windows-latest
node: 18
# Skip Node.js v20 tests on Windows
- os: windows-latest
node: 20
runs-on: ${{ matrix.os }}
steps:
- name: Initialize environment

View File

@ -91,6 +91,21 @@ nodejs_register_toolchains(
node_version = "20.11.1",
)
nodejs_register_toolchains(
name = "node22",
# The below can be removed once @rules_nodejs/nodejs is updated to latest which contains https://github.com/bazelbuild/rules_nodejs/pull/3701
node_repositories = {
"22.0.0-darwin_arm64": ("node-v22.0.0-darwin-arm64.tar.gz", "node-v22.0.0-darwin-arm64", "ea96d349cfaa67aa87ceeaa3e5b52c9167f7ac302fd8d1ff162d0785e9dc0785"),
"22.0.0-darwin_amd64": ("node-v22.0.0-darwin-x64.tar.gz", "node-v22.0.0-darwin-x64", "422a3887ff5418f0a4552d89cf99346ab8ab51bb5d384660baa88b8444d2c111"),
"22.0.0-linux_arm64": ("node-v22.0.0-linux-arm64.tar.xz", "node-v22.0.0-linux-arm64", "83711d29cbe46375bdffab5419f3d831892e24294169272f6c39edc364556241"),
"22.0.0-linux_ppc64le": ("node-v22.0.0-linux-ppc64le.tar.xz", "node-v22.0.0-linux-ppc64le", "2b3fb8707a79243bfb3131312b86716ddc3855bce21bb168095b6b916798e5e9"),
"22.0.0-linux_s390x": ("node-v22.0.0-linux-s390x.tar.xz", "node-v22.0.0-linux-s390x", "89a8efeeb9f94ce9ea251b8109e079c14919f4c0dc2cbc9f545ec47ef0886737"),
"22.0.0-linux_amd64": ("node-v22.0.0-linux-x64.tar.xz", "node-v22.0.0-linux-x64", "9122e50f2642afd5f6078cafd1f52ede60fc464284384f05c18a04d13d07ae5a"),
"22.0.0-windows_amd64": ("node-v22.0.0-win-x64.zip", "node-v22.0.0-win-x64", "32d639b47d4c0a651ff8f8d7d41a454168a3d4045be37985f9a810cf8cef6174"),
},
node_version = "22.0.0",
)
load("@build_bazel_rules_nodejs//:index.bzl", "yarn_install")
yarn_install(

View File

@ -1,5 +1,5 @@
# Engine versions to stamp in a release package.json
RELEASE_ENGINES_NODE = "^18.19.1 || >=20.11.1"
RELEASE_ENGINES_NODE = "^18.19.1 || ^20.11.1 || >=22.0.0"
RELEASE_ENGINES_NPM = "^6.11.0 || ^7.5.6 || >=8.0.0"
RELEASE_ENGINES_YARN = ">= 1.13.0"

View File

@ -31,7 +31,7 @@
"url": "https://github.com/angular/angular-cli.git"
},
"engines": {
"node": "^18.19.1 || >=20.11.1",
"node": "^18.19.1 || ^20.11.1 || >=22.0.0",
"yarn": ">=1.21.1 <2",
"npm": "Please use yarn instead of NPM to install dependencies"
},

View File

@ -23,7 +23,7 @@ interface PartialPackageInfo {
/**
* Major versions of Node.js that are officially supported by Angular.
*/
const SUPPORTED_NODE_MAJORS = [18, 20];
const SUPPORTED_NODE_MAJORS = [18, 20, 22];
const PACKAGE_PATTERNS = [
/^@angular\/.*/,

View File

@ -5,6 +5,7 @@
TOOLCHAINS_NAMES = [
"node18",
"node20",
"node22",
]
# this is the list of toolchains that should be used and are registered with nodejs_register_toolchains in the WORKSPACE file
@ -19,6 +20,11 @@ TOOLCHAINS_VERSIONS = [
"@bazel_tools//src/conditions:darwin": "@node20_darwin_amd64//:node_toolchain",
"@bazel_tools//src/conditions:windows": "@node20_windows_amd64//:node_toolchain",
}),
select({
"@bazel_tools//src/conditions:linux_x86_64": "@node22_linux_amd64//:node_toolchain",
"@bazel_tools//src/conditions:darwin": "@node22_darwin_amd64//:node_toolchain",
"@bazel_tools//src/conditions:windows": "@node22_windows_amd64//:node_toolchain",
}),
]
# A default toolchain for use when only one is necessary