Skip to content

Commit 73fe1cc

Browse files
committed
build: update minimum development Node.js versions
With Node.js v18 approaching End-of-Life on 2025-04-30, the minimum supported versions for development have been updated to `^20.11.1 || ^22.11.0`. This change does not affect published packages. The custom ESM loader was disabled in several Node.js jasmine tests due to incompatibilities with the updated custom loader API in newer Node.js versions. The API in v18 was not considered stable. The rules_js migration will remove the need for this loader fully in future.
1 parent 39dbc45 commit 73fe1cc

File tree

9 files changed

+42
-33
lines changed

9 files changed

+42
-33
lines changed

.nvmrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
18.20.5
1+
20.11.1

WORKSPACE

+12-11
Original file line numberDiff line numberDiff line change
@@ -47,19 +47,20 @@ http_archive(
4747
# Setup the Node.js toolchain.
4848
load("@rules_nodejs//nodejs:repositories.bzl", "nodejs_register_toolchains")
4949

50+
NODE_20_REPO = {
51+
"20.11.1-darwin_arm64": ("node-v20.11.1-darwin-arm64.tar.gz", "node-v20.11.1-darwin-arm64", "e0065c61f340e85106a99c4b54746c5cee09d59b08c5712f67f99e92aa44995d"),
52+
"20.11.1-darwin_amd64": ("node-v20.11.1-darwin-x64.tar.gz", "node-v20.11.1-darwin-x64", "c52e7fb0709dbe63a4cbe08ac8af3479188692937a7bd8e776e0eedfa33bb848"),
53+
"20.11.1-linux_arm64": ("node-v20.11.1-linux-arm64.tar.xz", "node-v20.11.1-linux-arm64", "c957f29eb4e341903520caf362534f0acd1db7be79c502ae8e283994eed07fe1"),
54+
"20.11.1-linux_ppc64le": ("node-v20.11.1-linux-ppc64le.tar.xz", "node-v20.11.1-linux-ppc64le", "51343cacf5cdf5c4b5e93e919d19dd373d6ef43d5f2c666eae299f26e31d08b5"),
55+
"20.11.1-linux_s390x": ("node-v20.11.1-linux-s390x.tar.xz", "node-v20.11.1-linux-s390x", "b32616b705cd0ddbb230b95c693e3d7a37becc2ced9bcadea8dc824cceed6be0"),
56+
"20.11.1-linux_amd64": ("node-v20.11.1-linux-x64.tar.xz", "node-v20.11.1-linux-x64", "d8dab549b09672b03356aa2257699f3de3b58c96e74eb26a8b495fbdc9cf6fbe"),
57+
"20.11.1-windows_amd64": ("node-v20.11.1-win-x64.zip", "node-v20.11.1-win-x64", "bc032628d77d206ffa7f133518a6225a9c5d6d9210ead30d67e294ff37044bda"),
58+
}
59+
5060
nodejs_register_toolchains(
5161
name = "nodejs",
52-
node_repositories = {
53-
"18.20.5-darwin_arm64": ("node-v18.20.5-darwin-arm64.tar.gz", "node-v18.20.5-darwin-arm64", "bdfeaf59dbf29aec08c0c66130edf0a8a17014b4f2997727641dfd0b58b51f48"),
54-
"18.20.5-darwin_amd64": ("node-v18.20.5-darwin-x64.tar.gz", "node-v18.20.5-darwin-x64", "dff01068da7d3fe7b515f72a3903dca96a34dc377f6f426b6a813901274b6441"),
55-
"18.20.5-linux_arm64": ("node-v18.20.5-linux-arm64.tar.xz", "node-v18.20.5-linux-arm64", "a77db6ab34267f3bc80e02ed68abf51b7065eb5c82fcd69adc4b40e390d9b116"),
56-
"18.20.5-linux_ppc64le": ("node-v18.20.5-linux-ppc64le.tar.xz", "node-v18.20.5-linux-ppc64le", "63b4c6801c96fb452e3bd8125e8b5b195ecacc4fa2505e47a128e94587999aeb"),
57-
"18.20.5-linux_s390x": ("node-v18.20.5-linux-s390x.tar.xz", "node-v18.20.5-linux-s390x", "617d7456e16534a4b4e03f5285cc8d13581f39cdad9196efff2516d6588de319"),
58-
"18.20.5-linux_amd64": ("node-v18.20.5-linux-x64.tar.xz", "node-v18.20.5-linux-x64", "e4a3a21e5ac7e074ed50d2533dd0087d8460647ab567464867141a2b643f3fb3"),
59-
"18.20.5-windows_amd64": ("node-v18.20.5-win-x64.zip", "node-v18.20.5-win-x64", "910237449895b4de61026568dc076fa6c3ffcd667563ed03112a4a77e1f1556b"),
60-
},
61-
# We need at least Node 18.20.5 due to some transitive dependencies.
62-
node_version = "18.20.5",
62+
node_repositories = NODE_20_REPO,
63+
node_version = "20.11.1",
6364
)
6465

6566
# Download npm dependencies.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"bugs": "https://github.com/angular/angular/issues",
88
"license": "MIT",
99
"engines": {
10-
"node": "^18.19.1 || ^20.11.1",
10+
"node": "^20.11.1 || ^22.11.0",
1111
"yarn": ">=1.22.4 <2",
1212
"npm": "Please use yarn instead of NPM to install dependencies"
1313
},

packages/core/schematics/migrations/output-migration/BUILD.bazel

+1
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,6 @@ ts_library(
4343
jasmine_node_test(
4444
name = "test",
4545
srcs = [":test_lib"],
46+
enable_linker = True,
4647
env = {"FORCE_COLOR": "3"},
4748
)

packages/core/schematics/migrations/self-closing-tags-migration/BUILD.bazel

+1
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,6 @@ ts_library(
4444
jasmine_node_test(
4545
name = "test",
4646
srcs = [":test_lib"],
47+
enable_linker = True,
4748
env = {"FORCE_COLOR": "3"},
4849
)

packages/core/schematics/migrations/signal-migration/test/BUILD.bazel

+1
Original file line numberDiff line numberDiff line change
@@ -142,4 +142,5 @@ ts_library(
142142
jasmine_node_test(
143143
name = "test_jasmine",
144144
srcs = [":test_lib"],
145+
enable_linker = True,
145146
)

packages/core/schematics/migrations/signal-queries-migration/BUILD.bazel

+1
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,6 @@ ts_library(
4444
jasmine_node_test(
4545
name = "test",
4646
srcs = [":test_lib"],
47+
enable_linker = True,
4748
env = {"FORCE_COLOR": "3"},
4849
)

packages/core/schematics/utils/tsurge/test/BUILD.bazel

+1
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,6 @@ ts_library(
3535

3636
jasmine_node_test(
3737
name = "test",
38+
enable_linker = True,
3839
deps = [":test_lib"],
3940
)

tools/defaults.bzl

+23-20
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
"""Re-export of some bazel rules with repository-wide defaults."""
22

3-
load("@rules_pkg//:pkg.bzl", "pkg_tar")
43
load("@build_bazel_rules_nodejs//:index.bzl", "generated_file_test", _npm_package_bin = "npm_package_bin", _pkg_npm = "pkg_npm")
5-
load("@npm//@bazel/jasmine:index.bzl", _jasmine_node_test = "jasmine_node_test")
6-
load("@npm//@bazel/concatjs:index.bzl", _ts_config = "ts_config", _ts_library = "ts_library")
7-
load("@npm//@bazel/rollup:index.bzl", _rollup_bundle = "rollup_bundle")
8-
load("@npm//@bazel/terser:index.bzl", "terser_minified")
9-
load("@npm//@bazel/protractor:index.bzl", _protractor_web_test_suite = "protractor_web_test_suite")
10-
load("@npm//typescript:index.bzl", "tsc")
11-
load("@npm//@angular/build-tooling/bazel/app-bundling:index.bzl", _app_bundle = "app_bundle")
12-
load("@npm//@angular/build-tooling/bazel/http-server:index.bzl", _http_server = "http_server")
13-
load("@npm//@angular/build-tooling/bazel/karma:index.bzl", _karma_web_test = "karma_web_test", _karma_web_test_suite = "karma_web_test_suite")
14-
load("@npm//@angular/build-tooling/bazel/api-golden:index.bzl", _api_golden_test = "api_golden_test", _api_golden_test_npm_package = "api_golden_test_npm_package")
154
load("@npm//@angular/build-tooling/bazel:extract_js_module_output.bzl", "extract_js_module_output")
165
load("@npm//@angular/build-tooling/bazel:extract_types.bzl", _extract_types = "extract_types")
6+
load("@npm//@angular/build-tooling/bazel/api-golden:index.bzl", _api_golden_test = "api_golden_test", _api_golden_test_npm_package = "api_golden_test_npm_package")
7+
load("@npm//@angular/build-tooling/bazel/app-bundling:index.bzl", _app_bundle = "app_bundle")
178
load("@npm//@angular/build-tooling/bazel/esbuild:index.bzl", _esbuild = "esbuild", _esbuild_config = "esbuild_config", _esbuild_esm_bundle = "esbuild_esm_bundle")
18-
load("@npm//@angular/build-tooling/bazel/spec-bundling:spec-entrypoint.bzl", "spec_entrypoint")
9+
load("@npm//@angular/build-tooling/bazel/http-server:index.bzl", _http_server = "http_server")
10+
load("@npm//@angular/build-tooling/bazel/karma:index.bzl", _karma_web_test = "karma_web_test", _karma_web_test_suite = "karma_web_test_suite")
1911
load("@npm//@angular/build-tooling/bazel/spec-bundling:index.bzl", "spec_bundle")
12+
load("@npm//@angular/build-tooling/bazel/spec-bundling:spec-entrypoint.bzl", "spec_entrypoint")
13+
load("@npm//@bazel/concatjs:index.bzl", _ts_config = "ts_config", _ts_library = "ts_library")
14+
load("@npm//@bazel/jasmine:index.bzl", _jasmine_node_test = "jasmine_node_test")
15+
load("@npm//@bazel/protractor:index.bzl", _protractor_web_test_suite = "protractor_web_test_suite")
16+
load("@npm//@bazel/rollup:index.bzl", _rollup_bundle = "rollup_bundle")
17+
load("@npm//@bazel/terser:index.bzl", "terser_minified")
2018
load("@npm//tsec:index.bzl", _tsec_test = "tsec_test")
19+
load("@npm//typescript:index.bzl", "tsc")
20+
load("@rules_pkg//:pkg.bzl", "pkg_tar")
21+
load("//adev/shared-docs/pipeline/api-gen:generate_api_docs.bzl", _generate_api_docs = "generate_api_docs")
2122
load("//packages/bazel:index.bzl", _ng_module = "ng_module", _ng_package = "ng_package")
2223
load("//tools/esm-interop:index.bzl", "enable_esm_node_module_loader", _nodejs_binary = "nodejs_binary", _nodejs_test = "nodejs_test")
23-
load("//adev/shared-docs/pipeline/api-gen:generate_api_docs.bzl", _generate_api_docs = "generate_api_docs")
2424

2525
_DEFAULT_TSCONFIG_TEST = "//packages:tsconfig-test"
2626
_INTERNAL_NG_MODULE_COMPILER = "//packages/bazel/src/ngc-wrapped"
@@ -479,7 +479,7 @@ def esbuild_jasmine_node_test(name, specs = [], external = [], bootstrap = [], *
479479
**kwargs
480480
)
481481

482-
def jasmine_node_test(name, srcs = [], data = [], bootstrap = [], env = {}, **kwargs):
482+
def jasmine_node_test(name, srcs = [], data = [], bootstrap = [], env = {}, templated_args = [], enable_linker = False, **kwargs):
483483
# Very common dependencies for tests
484484
deps = kwargs.pop("deps", []) + [
485485
"@npm//chokidar",
@@ -492,13 +492,16 @@ def jasmine_node_test(name, srcs = [], data = [], bootstrap = [], env = {}, **kw
492492
]
493493
configuration_env_vars = kwargs.pop("configuration_env_vars", [])
494494

495-
# Disable the linker and rely on patched resolution which works better on Windows
496-
# and is less prone to race conditions when targets build concurrently.
497-
templated_args = ["--nobazel_run_linker"] + kwargs.pop("templated_args", [])
495+
if not enable_linker:
496+
templated_args = templated_args + [
497+
# Disable the linker and rely on patched resolution which works better on Windows
498+
# and is less prone to race conditions when targets build concurrently.
499+
"--nobazel_run_linker",
500+
]
498501

499-
# We disable the linker, so the ESM node module loader needs to be enabled.
500-
npm_workspace = _node_modules_workspace_name()
501-
env = enable_esm_node_module_loader(npm_workspace, env)
502+
# We disable the linker, so the ESM node module loader needs to be enabled.
503+
npm_workspace = _node_modules_workspace_name()
504+
env = enable_esm_node_module_loader(npm_workspace, env)
502505

503506
spec_entrypoint(
504507
name = "%s_spec_entrypoint.spec" % name,

0 commit comments

Comments
 (0)