Skip to content

Commit 05a9c37

Browse files
committed
build: setup rules_js and link dependencies
Sets up `rules_js` and links dependencies into the bazel-bin.
1 parent 3e2a3db commit 05a9c37

File tree

11 files changed

+16596
-931
lines changed

11 files changed

+16596
-931
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# @generated
2+
# Input hashes for repository rule npm_translate_lock(name = "npm2", pnpm_lock = "@//:pnpm-lock.yaml").
3+
# This file should be checked into version control along with the pnpm-lock.yaml file.
4+
.npmrc=-2023857461
5+
package.json=-1367474012
6+
pnpm-lock.yaml=-811131462
7+
pnpm-workspace.yaml=1711114604
8+
yarn.lock=-1654078010

.github/workflows/ci.yml

+2
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,8 @@ jobs:
173173
run: yarn install --frozen-lockfile
174174
- name: Run tests
175175
run: bazel test --build_tag_filters=-e2e --test_tag_filters=-e2e --build_tests_only -- src/...
176+
env:
177+
ASPECT_RULES_JS_FROZEN_PNPM_LOCK: '1'
176178
- uses: ./.github/actions/slack
177179
if: failure()
178180
with:

.github/workflows/pr.yml

+2
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,8 @@ jobs:
149149
run: yarn install --frozen-lockfile
150150
- name: Run tests
151151
run: bazel test --build_tag_filters=-e2e --test_tag_filters=-e2e --build_tests_only -- src/...
152+
env:
153+
ASPECT_RULES_JS_FROZEN_PNPM_LOCK: '1'
152154

153155
build:
154156
runs-on: ubuntu-latest-16core

.npmrc

+7-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
1-
engine-strict = true
1+
# Yarn Berry doesn't check engines at all, so pnpm shouldn't either.
2+
engine-strict = false
3+
4+
# Disabling pnpm [hoisting](https://pnpm.io/npmrc#hoist) by setting `hoist=false` is recommended on
5+
# projects using rules_js so that pnpm outside of Bazel lays out a node_modules tree similar to what
6+
# rules_js lays out under Bazel (without a hidden node_modules/.pnpm/node_modules)
7+
hoist=false

.prettierignore

+2
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@ src/cdk/schematics/ng-update/test-cases/**/*_input.ts
1212
src/cdk/schematics/ng-update/test-cases/**/*_expected_output.ts
1313
src/material/schematics/ng-update/test-cases/**/*_input.ts
1414
src/material/schematics/ng-update/test-cases/**/*_expected_output.ts
15+
16+
pnpm-lock.yaml

BUILD.bazel

+5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ load("//src/cdk:config.bzl", "CDK_ENTRYPOINTS")
44
load("//src/cdk-experimental:config.bzl", "CDK_EXPERIMENTAL_ENTRYPOINTS")
55
load("//src/material:config.bzl", "MATERIAL_ENTRYPOINTS", "MATERIAL_TESTING_ENTRYPOINTS")
66
load("//src/material-experimental:config.bzl", "MATERIAL_EXPERIMENTAL_ENTRYPOINTS", "MATERIAL_EXPERIMENTAL_TESTING_ENTRYPOINTS")
7+
load("@npm2//:defs.bzl", "npm_link_all_packages")
78

89
package(default_visibility = ["//visibility:public"])
910

@@ -12,6 +13,10 @@ exports_files([
1213
"package.json",
1314
])
1415

16+
npm_link_all_packages(
17+
name = "node_modules",
18+
)
19+
1520
nodejs_binary(
1621
name = "yarn_vendored",
1722
data = [".yarn/releases/yarn-1.22.17.cjs"],

WORKSPACE

+51-10
Original file line numberDiff line numberDiff line change
@@ -63,20 +63,42 @@ load("@build_bazel_rules_nodejs//:repositories.bzl", "build_bazel_rules_nodejs_d
6363

6464
build_bazel_rules_nodejs_dependencies()
6565

66+
http_archive(
67+
name = "aspect_rules_js",
68+
sha256 = "75c25a0f15a9e4592bbda45b57aa089e4bf17f9176fd735351e8c6444df87b52",
69+
strip_prefix = "rules_js-2.1.0",
70+
url = "https://github.com/aspect-build/rules_js/releases/download/v2.1.0/rules_js-v2.1.0.tar.gz",
71+
)
72+
73+
load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
74+
75+
rules_js_dependencies()
76+
6677
load("@rules_nodejs//nodejs:repositories.bzl", "nodejs_register_toolchains")
6778

79+
NODE_VERSION = "22.0.0"
80+
81+
NODE_REPOSITORIES = {
82+
"22.0.0-darwin_arm64": ("node-v22.0.0-darwin-arm64.tar.gz", "node-v22.0.0-darwin-arm64", "ea96d349cfaa67aa87ceeaa3e5b52c9167f7ac302fd8d1ff162d0785e9dc0785"),
83+
"22.0.0-darwin_amd64": ("node-v22.0.0-darwin-x64.tar.gz", "node-v22.0.0-darwin-x64", "422a3887ff5418f0a4552d89cf99346ab8ab51bb5d384660baa88b8444d2c111"),
84+
"22.0.0-linux_arm64": ("node-v22.0.0-linux-arm64.tar.xz", "node-v22.0.0-linux-arm64", "83711d29cbe46375bdffab5419f3d831892e24294169272f6c39edc364556241"),
85+
"22.0.0-linux_ppc64le": ("node-v22.0.0-linux-ppc64le.tar.xz", "node-v22.0.0-linux-ppc64le", "2b3fb8707a79243bfb3131312b86716ddc3855bce21bb168095b6b916798e5e9"),
86+
"22.0.0-linux_s390x": ("node-v22.0.0-linux-s390x.tar.xz", "node-v22.0.0-linux-s390x", "89a8efeeb9f94ce9ea251b8109e079c14919f4c0dc2cbc9f545ec47ef0886737"),
87+
"22.0.0-linux_amd64": ("node-v22.0.0-linux-x64.tar.xz", "node-v22.0.0-linux-x64", "9122e50f2642afd5f6078cafd1f52ede60fc464284384f05c18a04d13d07ae5a"),
88+
"22.0.0-windows_amd64": ("node-v22.0.0-win-x64.zip", "node-v22.0.0-win-x64", "32d639b47d4c0a651ff8f8d7d41a454168a3d4045be37985f9a810cf8cef6174"),
89+
}
90+
6891
nodejs_register_toolchains(
6992
name = "nodejs",
70-
node_repositories = {
71-
"22.0.0-darwin_arm64": ("node-v22.0.0-darwin-arm64.tar.gz", "node-v22.0.0-darwin-arm64", "ea96d349cfaa67aa87ceeaa3e5b52c9167f7ac302fd8d1ff162d0785e9dc0785"),
72-
"22.0.0-darwin_amd64": ("node-v22.0.0-darwin-x64.tar.gz", "node-v22.0.0-darwin-x64", "422a3887ff5418f0a4552d89cf99346ab8ab51bb5d384660baa88b8444d2c111"),
73-
"22.0.0-linux_arm64": ("node-v22.0.0-linux-arm64.tar.xz", "node-v22.0.0-linux-arm64", "83711d29cbe46375bdffab5419f3d831892e24294169272f6c39edc364556241"),
74-
"22.0.0-linux_ppc64le": ("node-v22.0.0-linux-ppc64le.tar.xz", "node-v22.0.0-linux-ppc64le", "2b3fb8707a79243bfb3131312b86716ddc3855bce21bb168095b6b916798e5e9"),
75-
"22.0.0-linux_s390x": ("node-v22.0.0-linux-s390x.tar.xz", "node-v22.0.0-linux-s390x", "89a8efeeb9f94ce9ea251b8109e079c14919f4c0dc2cbc9f545ec47ef0886737"),
76-
"22.0.0-linux_amd64": ("node-v22.0.0-linux-x64.tar.xz", "node-v22.0.0-linux-x64", "9122e50f2642afd5f6078cafd1f52ede60fc464284384f05c18a04d13d07ae5a"),
77-
"22.0.0-windows_amd64": ("node-v22.0.0-win-x64.zip", "node-v22.0.0-win-x64", "32d639b47d4c0a651ff8f8d7d41a454168a3d4045be37985f9a810cf8cef6174"),
78-
},
79-
node_version = "22.0.0",
93+
node_repositories = NODE_REPOSITORIES,
94+
node_version = NODE_VERSION,
95+
)
96+
97+
load("@aspect_rules_js//js:toolchains.bzl", "rules_js_register_toolchains")
98+
99+
rules_js_register_toolchains(
100+
node_repositories = NODE_REPOSITORIES,
101+
node_version = NODE_VERSION,
80102
)
81103

82104
load("@build_bazel_rules_nodejs//:index.bzl", "yarn_install")
@@ -136,3 +158,22 @@ load("@build_bazel_rules_nodejs//toolchains/esbuild:esbuild_repositories.bzl", "
136158
esbuild_repositories(
137159
npm_repository = "npm",
138160
)
161+
162+
load("@aspect_rules_js//npm:repositories.bzl", "npm_translate_lock")
163+
164+
npm_translate_lock(
165+
name = "npm2",
166+
data = [
167+
"//:package.json",
168+
"//:pnpm-workspace.yaml",
169+
],
170+
npmrc = "//:.npmrc",
171+
pnpm_lock = "//:pnpm-lock.yaml",
172+
update_pnpm_lock = True,
173+
verify_node_modules_ignored = "//:.bazelignore",
174+
yarn_lock = "//:yarn.lock",
175+
)
176+
177+
load("@npm2//:repositories.bzl", "npm_repositories")
178+
179+
npm_repositories()

package.json

+6-5
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
"@angular-devkit/schematics": "^20.0.0-next.0",
7676
"@angular/bazel": "https://github.com/angular/bazel-builds.git#ba9ff4622e455b7cad2f983f5e611b9f46c57e86",
7777
"@angular/build": "^20.0.0-next.0",
78-
"@angular/build-tooling": "https://github.com/angular/dev-infra-private-build-tooling-builds.git#74e0e7b090c6e16056290836b2d936ca7820b86f",
78+
"@angular/build-tooling": "https://github.com/angular/dev-infra-private-build-tooling-builds.git#220b0088d48ae5cff6a715ad8823812b913eba7c",
7979
"@angular/cli": "^20.0.0-next.0",
8080
"@angular/compiler-cli": "^20.0.0-next.0",
8181
"@angular/localize": "^20.0.0-next.0",
@@ -179,12 +179,13 @@
179179
"zx": "^6.2.4"
180180
},
181181
"resolutions": {
182-
"@angular/build-tooling/typescript": "5.8.2",
183-
"@angular/ng-dev/typescript": "5.8.2",
182+
"typescript": "5.8.2",
184183
"browser-sync-client": "2.26.13",
185-
"dgeni-packages/typescript": "5.8.2",
186-
"**/https-proxy-agent": "5.0.0",
184+
"https-proxy-agent": "5.0.0",
187185
"string-width": "4.2.3",
188186
"wrap-ansi": "7.0.0"
187+
},
188+
"pnpm": {
189+
"onlyBuiltDependencies": []
189190
}
190191
}

0 commit comments

Comments
 (0)