Skip to content

Commit e19c3e4

Browse files
committed
test: enable rules_foo e2e test in bzlmod
1 parent 29e706b commit e19c3e4

File tree

4 files changed

+40
-0
lines changed

4 files changed

+40
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,8 @@ jobs:
170170
folder: e2e/npm_link_package
171171
- bzlmod: 1
172172
folder: e2e/rules_foo
173+
bazel-version:
174+
major: 6
173175
# gyp_no_install_script+patch_from_repo+js_run_devserver are broken in an usual way on 6.5.0
174176
# that is not worth investigating as we're dropping Bazel 6 support soon
175177
- bazel-version:

e2e/rules_foo/.bazelignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
node_modules/
12
foo/node_modules/

e2e/rules_foo/MODULE.bazel

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
module(name = "rules_foo")
2+
3+
bazel_dep(name = "aspect_rules_js", version = "0.0.0")
4+
local_path_override(
5+
module_name = "aspect_rules_js",
6+
path = "../..",
7+
)
8+
9+
bazel_dep(name = "aspect_bazel_lib", version = "2.21.1")
10+
11+
npm = use_extension(
12+
"@aspect_rules_js//npm:extensions.bzl",
13+
"npm",
14+
)
15+
npm.npm_translate_lock(
16+
name = "foo",
17+
additional_file_contents = {
18+
"BUILD.bazel": [
19+
"""load("//:npm_link_all_packages.bzl", "npm_link_all_packages")""",
20+
"""npm_link_all_packages(name = "node_modules")""",
21+
],
22+
# Test that we can add statements to the generated defs bzl file
23+
"npm_link_all_packages.bzl": [
24+
"""load("@aspect_rules_js//js:defs.bzl", _js_run_binary = "js_run_binary")""",
25+
"""def js_run_binary(**kwargs):
26+
_js_run_binary(**kwargs)""",
27+
],
28+
},
29+
defs_bzl_filename = "npm_link_all_packages.bzl",
30+
# We'll be linking in the @foo repository and not the repository where the pnpm-lock file is located
31+
link_workspace = "foo",
32+
pnpm_lock = "//foo:pnpm-lock.yaml",
33+
# Override the Bazel package where pnpm-lock.yaml is located and link to the specified package instead
34+
root_package = "",
35+
verify_node_modules_ignored = "//:.bazelignore",
36+
)
37+
use_repo(npm, "foo")

e2e/rules_foo/WORKSPACE.bzlmod

Whitespace-only changes.

0 commit comments

Comments
 (0)