Skip to content

Commit 115e2b2

Browse files
committed
build: setup rules_js and link dependencies
Sets up `rules_js` and links dependencies into the bazel-bin.
1 parent 0a1e28a commit 115e2b2

File tree

12 files changed

+16629
-930
lines changed

12 files changed

+16629
-930
lines changed
Lines changed: 8 additions & 0 deletions
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

Lines changed: 2 additions & 0 deletions
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

Lines changed: 2 additions & 0 deletions
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

Lines changed: 7 additions & 1 deletion
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

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
18.19.1
1+
22.0.0

.prettierignore

Lines changed: 2 additions & 0 deletions
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

Lines changed: 5 additions & 0 deletions
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

Lines changed: 51 additions & 10 deletions
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-
"18.19.1-darwin_arm64": ("node-v18.19.1-darwin-arm64.tar.gz", "node-v18.19.1-darwin-arm64", "0c7249318868877032ed21cc0ed450015ee44b31b9b281955521cd3fc39fbfa3"),
72-
"18.19.1-darwin_amd64": ("node-v18.19.1-darwin-x64.tar.gz", "node-v18.19.1-darwin-x64", "ab67c52c0d215d6890197c951e1bd479b6140ab630212b96867395e21d813016"),
73-
"18.19.1-linux_arm64": ("node-v18.19.1-linux-arm64.tar.xz", "node-v18.19.1-linux-arm64", "228ad1eee660fba3f9fd2cccf02f05b8ebccc294d27f22c155d20b233a9d76b3"),
74-
"18.19.1-linux_ppc64le": ("node-v18.19.1-linux-ppc64le.tar.xz", "node-v18.19.1-linux-ppc64le", "2e5812b8fc00548e2e8ab9daa88ace13974c16b6ba5595a7a50c35f848f7d432"),
75-
"18.19.1-linux_s390x": ("node-v18.19.1-linux-s390x.tar.xz", "node-v18.19.1-linux-s390x", "15106acf4c9e3aca02416dd89fb5c71af77097042455a73f9caa064c1988ead5"),
76-
"18.19.1-linux_amd64": ("node-v18.19.1-linux-x64.tar.xz", "node-v18.19.1-linux-x64", "f35f24edd4415cd609a2ebc03be03ed2cfe211d7333d55c752d831754fb849f0"),
77-
"18.19.1-windows_amd64": ("node-v18.19.1-win-x64.zip", "node-v18.19.1-win-x64", "ff08f8fe253fba9274992d7052e9d9a70141342d7b36ddbd6e84cbe823e312c6"),
78-
},
79-
node_version = "18.19.1",
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")
@@ -135,3 +157,22 @@ load("@build_bazel_rules_nodejs//toolchains/esbuild:esbuild_repositories.bzl", "
135157
esbuild_repositories(
136158
npm_repository = "npm",
137159
)
160+
161+
load("@aspect_rules_js//npm:repositories.bzl", "npm_translate_lock")
162+
163+
npm_translate_lock(
164+
name = "npm2",
165+
data = [
166+
"//:package.json",
167+
"//:pnpm-workspace.yaml",
168+
],
169+
npmrc = "//:.npmrc",
170+
pnpm_lock = "//:pnpm-lock.yaml",
171+
update_pnpm_lock = True,
172+
verify_node_modules_ignored = "//:.bazelignore",
173+
yarn_lock = "//:yarn.lock",
174+
)
175+
176+
load("@npm2//:repositories.bzl", "npm_repositories")
177+
178+
npm_repositories()

package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@
7373
"@angular-devkit/build-angular": "^19.2.0",
7474
"@angular-devkit/core": "^19.2.0",
7575
"@angular-devkit/schematics": "^19.2.0",
76-
"@angular/bazel": "https://github.com/angular/bazel-builds.git#87091472fecf0232c16c385e9183b328bea984f6",
77-
"@angular/build-tooling": "https://github.com/angular/dev-infra-private-build-tooling-builds.git#74e0e7b090c6e16056290836b2d936ca7820b86f",
76+
"@angular/bazel": "https://github.com/angular/bazel-builds.git#ba9ff4622e455b7cad2f983f5e611b9f46c57e86",
77+
"@angular/build-tooling": "https://github.com/angular/dev-infra-private-build-tooling-builds.git#220b0088d48ae5cff6a715ad8823812b913eba7c",
7878
"@angular/build": "^19.2.0",
7979
"@angular/cli": "^19.2.0",
8080
"@angular/compiler-cli": "^19.2.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)