|
| 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") |
0 commit comments