-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial PR for migrating to rules_js
#30629
Changes from all commits
b887826
80e7715
18ffb09
d686d81
eeee0db
0fd84f3
94a1982
a5899a7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# @generated | ||
# Input hashes for repository rule npm_translate_lock(name = "npm2", pnpm_lock = "@//:pnpm-lock.yaml"). | ||
# This file should be checked into version control along with the pnpm-lock.yaml file. | ||
.npmrc=-2023857461 | ||
package.json=1204886269 | ||
pnpm-lock.yaml=1975546108 | ||
pnpm-workspace.yaml=1711114604 | ||
yarn.lock=824621907 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
5.0.0 | ||
6.5.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,7 @@ | ||
engine-strict = true | ||
# Yarn Berry doesn't check engines at all, so pnpm shouldn't either. | ||
engine-strict = false | ||
|
||
# Disabling pnpm [hoisting](https://pnpm.io/npmrc#hoist) by setting `hoist=false` is recommended on | ||
# projects using rules_js so that pnpm outside of Bazel lays out a node_modules tree similar to what | ||
# rules_js lays out under Bazel (without a hidden node_modules/.pnpm/node_modules) | ||
hoist=false |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
#Workspace for angular material | ||
workspace( | ||
name = "angular_material", | ||
managed_directories = {"@npm": ["node_modules"]}, | ||
) | ||
|
||
# Point to the nested WORKSPACE we merged from github.com/angular/material.angular.io | ||
|
@@ -64,20 +63,42 @@ load("@build_bazel_rules_nodejs//:repositories.bzl", "build_bazel_rules_nodejs_d | |
|
||
build_bazel_rules_nodejs_dependencies() | ||
|
||
http_archive( | ||
name = "aspect_rules_js", | ||
sha256 = "75c25a0f15a9e4592bbda45b57aa089e4bf17f9176fd735351e8c6444df87b52", | ||
strip_prefix = "rules_js-2.1.0", | ||
url = "https://github.com/aspect-build/rules_js/releases/download/v2.1.0/rules_js-v2.1.0.tar.gz", | ||
) | ||
|
||
load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies") | ||
|
||
rules_js_dependencies() | ||
|
||
load("@rules_nodejs//nodejs:repositories.bzl", "nodejs_register_toolchains") | ||
|
||
NODE_VERSION = "22.0.0" | ||
|
||
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"), | ||
} | ||
|
||
nodejs_register_toolchains( | ||
name = "nodejs", | ||
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", | ||
node_repositories = NODE_REPOSITORIES, | ||
node_version = NODE_VERSION, | ||
) | ||
|
||
load("@aspect_rules_js//js:toolchains.bzl", "rules_js_register_toolchains") | ||
|
||
rules_js_register_toolchains( | ||
node_repositories = NODE_REPOSITORIES, | ||
node_version = NODE_VERSION, | ||
) | ||
|
||
load("@build_bazel_rules_nodejs//:index.bzl", "yarn_install") | ||
|
@@ -103,9 +124,6 @@ yarn_install( | |
manual_build_file_contents = create_npm_package_archive_build_file(), | ||
package_json = "//:package.json", | ||
quiet = False, | ||
# We prefer to symlink the `node_modules` to only maintain a single install. | ||
# See https://github.com/angular/dev-infra/pull/446#issuecomment-1059820287 for details. | ||
symlink_node_modules = True, | ||
yarn = "//:.yarn/releases/yarn-1.22.17.cjs", | ||
yarn_lock = "//:yarn.lock", | ||
) | ||
|
@@ -140,3 +158,74 @@ load("@build_bazel_rules_nodejs//toolchains/esbuild:esbuild_repositories.bzl", " | |
esbuild_repositories( | ||
npm_repository = "npm", | ||
) | ||
|
||
load("@aspect_rules_js//npm:repositories.bzl", "npm_translate_lock") | ||
|
||
npm_translate_lock( | ||
name = "npm2", | ||
data = [ | ||
"//:package.json", | ||
"//:pnpm-workspace.yaml", | ||
], | ||
npmrc = "//:.npmrc", | ||
pnpm_lock = "//:pnpm-lock.yaml", | ||
update_pnpm_lock = True, | ||
verify_node_modules_ignored = "//:.bazelignore", | ||
yarn_lock = "//:yarn.lock", | ||
) | ||
|
||
load("@npm2//:repositories.bzl", "npm_repositories") | ||
|
||
npm_repositories() | ||
|
||
http_archive( | ||
name = "aspect_rules_ts", | ||
sha256 = "9acd128abe77397505148eaa6895faed57839560dbf2177dd6285e51235e2724", | ||
strip_prefix = "rules_ts-3.3.1", | ||
url = "https://github.com/aspect-build/rules_ts/releases/download/v3.3.1/rules_ts-v3.3.1.tar.gz", | ||
) | ||
|
||
load("@aspect_rules_ts//ts:repositories.bzl", "rules_ts_dependencies") | ||
|
||
rules_ts_dependencies( | ||
# Obtained by: curl --silent https://registry.npmjs.org/typescript/5.8.2 | jq -r '.dist.integrity' | ||
ts_integrity = "sha512-aJn6wq13/afZp/jT9QZmwEjDqqvSGp1VT5GVg+f/t6/oVyrgXM6BY1h9BRh/O5p3PlUPAe+WuiEZOmb/49RqoQ==", | ||
ts_version_from = "//:package.json", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note that I don't know if we want to align on, for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, in CLI I have a clean-up PR (blocked currently) that also leverages the version from the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see your point. Not feeling strongly, but ideally, long-term |
||
) | ||
|
||
http_archive( | ||
name = "aspect_rules_rollup", | ||
sha256 = "c4062681968f5dcd3ce01e09e4ba73670c064744a7046211763e17c98ab8396e", | ||
strip_prefix = "rules_rollup-2.0.0", | ||
url = "https://github.com/aspect-build/rules_rollup/releases/download/v2.0.0/rules_rollup-v2.0.0.tar.gz", | ||
) | ||
|
||
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") | ||
|
||
git_repository( | ||
name = "devinfra", | ||
commit = "cc73dde52b557f831cc3b6e48daf8c3b542a33df", | ||
remote = "https://github.com/angular/dev-infra.git", | ||
) | ||
|
||
load("@devinfra//bazel:setup_dependencies_1.bzl", "setup_dependencies_1") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Noting this while I am looking at it now. We should name these setup functions to include the repo they are setting up so that we don't have name collisions in the functions we bring in as well. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed. Let's follow-up on this and also align |
||
|
||
setup_dependencies_1() | ||
|
||
load("@devinfra//bazel:setup_dependencies_2.bzl", "setup_dependencies_2") | ||
|
||
setup_dependencies_2() | ||
|
||
git_repository( | ||
name = "rules_angular", | ||
commit = "e10bf488aca18c159399f4c1163324a40f45a5dc", | ||
remote = "https://github.com/devversion/rules_angular.git", | ||
) | ||
|
||
load("@rules_angular//setup:step_1.bzl", "step_1") | ||
|
||
step_1() | ||
|
||
load("@rules_angular//setup:step_2.bzl", "step_2") | ||
|
||
step_2() |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,38 @@ | ||
load("@devinfra//bazel/api-golden:index.bzl", "api_golden_test_npm_package") | ||
|
||
exports_files([ | ||
"size-test.yaml", | ||
"tsec-exemption.json", | ||
]) | ||
|
||
api_golden_test_npm_package( | ||
name = "cdk_api", | ||
data = glob(["cdk/**"]) + [ | ||
"//src/cdk:npm_package", | ||
], | ||
golden_dir = "angular_material/goldens/cdk", | ||
npm_package = "angular_material/src/cdk/npm_package", | ||
) | ||
|
||
api_golden_test_npm_package( | ||
name = "material_api", | ||
data = glob(["material/**"]) + ["//src/material:npm_package"], | ||
golden_dir = "angular_material/goldens/material", | ||
npm_package = "angular_material/src/material/npm_package", | ||
) | ||
|
||
api_golden_test_npm_package( | ||
name = "google_maps_api", | ||
data = glob(["google-maps/**"]) + ["//src/google-maps:npm_package"], | ||
golden_dir = "angular_material/goldens/google-maps", | ||
npm_package = "angular_material/src/google-maps/npm_package", | ||
types = ["@npm//@types/google.maps"], | ||
) | ||
|
||
api_golden_test_npm_package( | ||
name = "youtube_player_api", | ||
data = glob(["youtube-player/**"]) + ["//src/youtube-player:npm_package"], | ||
golden_dir = "angular_material/goldens/youtube-player", | ||
npm_package = "angular_material/src/youtube-player/npm_package", | ||
types = ["@npm//@types/youtube"], | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we be on
20.11.1
?Typically we have our version of node within our repository as the earliest
maintenance
version (and moving to 20 now instead of waiting til mid april makes sense to me) instead of thecurrent
version.I know that it was already at
22.0.0
when you moved this part over, but I wanted to check in on this now.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think for the Bazel invocation it doesn't necessarily matter as everyone gets the same. What do you think would be the value for staying at the earliest maintenance version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we still support the lower versions, the value is mostly in making sure we don't incidentally rely on something unsupported in the lower versions. It likely doesn't really make a difference, but just wanted to flag it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think for CLI this matters, but here the risk is very low yeah.
Good idea to follow-up on this though. I can see this being a potential issue for the shipped schematics code.