Open
Description
Description
Hi, I'm using js_grpc_node_library
, and I'm trying to use the deps_repo=
parameter to point to a custom named repo.
I'm using rules_js
, my WORKSPACE
looks like this.
http_archive(
name = "aspect_rules_js",
sha256 = "7c50475662810ce9635fa45d718220285a8adef32b2febd8631aae62e5816353",
strip_prefix = "rules_js-1.23.2",
url = "https://github.com/aspect-build/rules_js/releases/download/v1.23.2/rules_js-v1.23.2.tar.gz",
)
load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
rules_js_dependencies()
load("@rules_nodejs//nodejs:repositories.bzl", "nodejs_register_toolchains")
nodejs_register_toolchains(
name = "nodejs",
node_version = "16.15.1",
)
load("@aspect_rules_js//npm:npm_import.bzl", "npm_translate_lock")
npm_translate_lock(
name = "custom_npm",
)
and then my BUILD
file looks like this:
proto_library(
name = "api_proto",
srcs = ["api.proto"],
)
js_grpc_node_library(
name = "protos_js",
protos = [":api_proto"],
)
Adding deps_repo="@custom_npm"
doesn't work because the dep is looked up at @custom_npm//@grpc/grpc-js
which I believe is correct when using the old and now unmaintained rules_nodejs
, but when using the newer rules_js
the dep is placed instead at @custom_npm//:node_modules/@grpc/grpc-js
(per docs https://docs-legacy.aspect.build/aspect-build/rules_js/v1.6.4/docs/npm_import-docgen.html#npm_translate_lock-link_workspace). Is there a way to make this work?
I looked at the code a bit, and there's a string replacement taking place
that doesn't seem ameanable, unless there is some other trick I am missing.