Skip to content

Commit 9645ec6

Browse files
committed
build: disconnect @npm workspace from main project
This will speed up significantly as we don't need to fetch all dependencies again just for the `@npm` repository that is at this point only leveraged by the `ng_package` rule for some of its dependencies. This commit allows us to drop the `yarn.lock` and Aspect lock files, and allows us to independently migrate `ng_package` to `rules_js`. It also allows us to drop the `_rjs` TS interop layer in follow-up commits.
1 parent beab546 commit 9645ec6

File tree

14 files changed

+2112
-176
lines changed

14 files changed

+2112
-176
lines changed

.aspect/rules/external_repository_action_cache/npm_translate_lock_MzA5NzUwNzMx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# This file should be checked into version control along with the pnpm-lock.yaml file.
44
.npmrc=-1406867100
55
modules/testing/builder/package.json=973445093
6-
package.json=1084945472
6+
package.json=577630563
77
packages/angular/build/package.json=1235849957
88
packages/angular/cli/package.json=-1917515334
99
packages/angular/pwa/package.json=1108903917
@@ -17,7 +17,7 @@ packages/angular_devkit/schematics/package.json=-1133510866
1717
packages/angular_devkit/schematics_cli/package.json=-2026655035
1818
packages/ngtools/webpack/package.json=71458652
1919
packages/schematics/angular/package.json=251715148
20-
pnpm-lock.yaml=-699735310
20+
pnpm-lock.yaml=1658089886
2121
pnpm-workspace.yaml=-1264044456
2222
tests/package.json=700948366
2323
yarn.lock=958506060

WORKSPACE

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,20 +110,18 @@ rules_js_register_toolchains(
110110

111111
load("@build_bazel_rules_nodejs//:index.bzl", "yarn_install")
112112

113+
# TODO(devversion): Remove this once `ng_package` is ported over to `rules_js`.
113114
yarn_install(
114115
name = "npm",
115116
data = [
116117
"//:.yarn/releases/yarn-4.5.0.cjs",
117118
"//:.yarnrc.yml",
118-
"//:patches/@angular+bazel+20.0.0-next.1.patch",
119+
"//tools/legacy-rnjs:.yarn/patches/@angular-bazel-https-24aa003e56.patch",
119120
],
120-
# Currently disabled due to:
121-
# 1. Missing Windows support currently.
122-
# 2. Incompatibilites with the `ts_library` rule.
123121
exports_directories_only = False,
124-
package_json = "//:package.json",
122+
package_json = "//tools/legacy-rnjs:package.json",
125123
yarn = "//:.yarn/releases/yarn-4.5.0.cjs",
126-
yarn_lock = "//:yarn.lock",
124+
yarn_lock = "//tools/legacy-rnjs:yarn.lock",
127125
)
128126

129127
http_archive(

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
"devDependencies": {
4545
"@ampproject/remapping": "2.3.0",
4646
"@angular/animations": "20.0.0-next.1",
47-
"@angular/bazel": "https://github.com/angular/bazel-builds.git#3422dcb650e407d2c00ac724acf560ab1506d68c",
4847
"@angular/build-tooling": "https://github.com/angular/dev-infra-private-build-tooling-builds.git#d4727212a9d0f7eb63ae3116d73c769d9bd0bdc1",
4948
"@angular/cdk": "20.0.0-next.0",
5049
"@angular/common": "20.0.0-next.1",

packages/angular/ssr/node/test/BUILD.bazel

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
load("@npm//@angular/build-tooling/bazel/spec-bundling:index.bzl", "spec_bundle")
1+
load("@devinfra//bazel/spec-bundling:index_rjs.bzl", "spec_bundle")
22
load("//tools:defaults2.bzl", "jasmine_test", "ts_project")
33

44
ts_project(
@@ -14,9 +14,6 @@ ts_project(
1414
# TODO: Clean this up when this repo runs ESM consistently.
1515
spec_bundle(
1616
name = "esm_tests_bundled",
17-
downlevel_async_await = False,
18-
platform = "node",
19-
run_angular_linker = False,
2017
deps = [
2118
":unit_test_lib",
2219
],

packages/angular/ssr/test/BUILD.bazel

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
load("@npm//@angular/build-tooling/bazel/spec-bundling:index.bzl", "spec_bundle")
1+
load("@devinfra//bazel/spec-bundling:index_rjs.bzl", "spec_bundle")
22
load("//tools:defaults2.bzl", "jasmine_test", "ts_project")
33

44
ts_project(
@@ -20,13 +20,8 @@ ts_project(
2020
],
2121
)
2222

23-
# TODO: Replace this with a `rules_js` variant, or make the SSR package
24-
# native ESM compatible! (import extensions etc.)
2523
spec_bundle(
2624
name = "esm_tests_bundled",
27-
downlevel_async_await = False,
28-
platform = "node",
29-
run_angular_linker = False,
3025
deps = [
3126
":unit_test_lib",
3227
],

patches/@angular+bazel+20.0.0-next.1.patch

Lines changed: 0 additions & 13 deletions
This file was deleted.

pnpm-lock.yaml

Lines changed: 1 addition & 115 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/legacy-cli/e2e/utils/BUILD.bazel

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ ts_project(
99
data = [
1010
"//tests/legacy-cli/e2e/ng-snapshot",
1111
],
12-
# TODO(devversion): Remove
13-
enable_runtime_rnjs_interop = False,
1412
deps = [
1513
"//:node_modules/@types/jasmine",
1614
"//:node_modules/@types/node",

tools/interop.bzl

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -107,33 +107,10 @@ def ts_project(
107107
testonly = False,
108108
visibility = None,
109109
ignore_strict_deps = False,
110-
enable_runtime_rnjs_interop = True,
111110
**kwargs):
112-
interop_deps = []
113-
114-
# Pull in the `rules_nodejs` variants of dependencies we know are "hybrid". This
115-
# is necessary as we can't mix `npm/node_modules` from RNJS with the pnpm-style
116-
# symlink-dependent node modules. In addition, we need to extract `_rjs` interop
117-
# dependencies so that we can forward and capture the module mappings for runtime
118-
# execution, with regards to first-party dependency linking.
119-
rjs_modules_to_rnjs = []
120-
if enable_runtime_rnjs_interop:
121-
for d in deps:
122-
if d.startswith("//:node_modules/"):
123-
rjs_modules_to_rnjs.append(d.replace("//:node_modules/", "@npm//"))
124-
if d.endswith("_rjs"):
125-
rjs_modules_to_rnjs.append(d.replace("_rjs", ""))
126-
127111
if tsconfig == None:
128112
tsconfig = "//:test-tsconfig" if testonly else "//:build-tsconfig"
129113

130-
ts_deps_interop(
131-
name = "%s_interop_deps" % name,
132-
deps = [] + interop_deps + rjs_modules_to_rnjs,
133-
visibility = visibility,
134-
testonly = testonly,
135-
)
136-
137114
_ts_project(
138115
name = "%s_rjs" % name,
139116
testonly = testonly,
@@ -145,7 +122,7 @@ def ts_project(
145122
# worker for efficient, fast DX and avoiding Windows no-sandbox issues.
146123
supports_workers = 1,
147124
tsc_worker = "//tools:vanilla_ts_worker",
148-
deps = [":%s_interop_deps" % name] + deps,
125+
deps = deps,
149126
**kwargs
150127
)
151128

@@ -161,9 +138,7 @@ def ts_project(
161138
testonly = testonly,
162139
visibility = visibility,
163140
dep = "%s_rjs" % name,
164-
# Forwarded dependencies for linker module mapping aspect.
165-
# RJS deps can also transitively pull in module mappings from their `interop_deps`.
166-
deps = [] + ["%s_interop_deps" % name] + deps,
141+
deps = deps,
167142
module_name = module_name,
168143
)
169144

tools/legacy-rnjs/.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
node_modules/
2+
3+
# Yarn
4+
.yarn/*
5+
!.yarn/patches
6+
!.yarn/plugins
7+
!.yarn/releases
8+
!.yarn/sdks
9+
!.yarn/versions

0 commit comments

Comments
 (0)