Skip to content

Commit fa903c5

Browse files
jaqx0rjbedard
authored andcommitted
fix: Prefix the publishable package path with ./
When trying to call the `.publish` rule on a publishable `npm_package` in a non-root BUILD file, currently the call to `npm` does not find the given package and interprets the argument as a git repository `github.com/path/to.git` . Specifically if you have a package rule in a first-level drectory, e.g. `ts/BUILD.bazel` contains a `npm_package(name = 'foo'...` then calling `npm publish ts/foo` will attempt to `git ls-remote https://github.com/ts/foo.git`. npm/cli#2796 implies that this is a behaviour change and we need to prefix a `./` to force it to find this argument as a filesystem path. This does indeed work in my local testing.
1 parent 6bba239 commit fa903c5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

npm/private/npm_package.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ def npm_package(
452452
name = "{}.publish".format(name),
453453
entry_point = Label("@aspect_rules_js//npm/private:npm_publish_mjs"),
454454
fixed_args = [
455-
"$(rootpath :{})".format(name),
455+
"./$(rootpath :{})".format(name),
456456
],
457457
data = [name],
458458
# required to make npm to be available in PATH

0 commit comments

Comments
 (0)