Skip to content

Commit

Permalink
fix: account for repository mapping
Browse files Browse the repository at this point in the history
We can't rely on the npm_install generated repos having the name we expect
  • Loading branch information
alexeagle committed Dec 20, 2021
1 parent a1a8788 commit 8bccc1a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion js/npm_import.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,20 @@ nodejs_package(
visibility = ["//visibility:public"],
deps = {deps},
)
# The name of the repo can be affected by repository mapping and may not match
# our declared "npm_foo-1.2.3" naming. So give a stable label as well to use
# when declaring dependencies between packages.
alias(
name = "pkg",
actual = "{name}",
visibility = ["//visibility:public"],
)
""".format(
name = repository_ctx.name,
nested_folder = result.stdout.rstrip("\n"),
package_name = repository_ctx.attr.package,
deps = [str(d) for d in repository_ctx.attr.deps],
deps = [str(d.relative(":pkg")) for d in repository_ctx.attr.deps],
))

_npm_import = repository_rule(
Expand Down

0 comments on commit 8bccc1a

Please sign in to comment.