bazel-distribution icon indicating copy to clipboard operation
bazel-distribution copied to clipboard

Help with `npm_deploy` rule

Open jon-whit opened this issue 5 years ago • 2 comments

First off, thanks for this awesome library of bazel rules. It's been a huge help!

I'm trying to get an npm artifact published to an npm Artifactory registry. Here's what my rules look like:

nodejs_grpc_library(
    name = "pubsub_nodejs_grpc",
    deps = ["//protos/eventhub/pubsub/v1alpha1:pubsub_proto"],
)

load("@graknlabs_bazel_distribution//npm:rules.bzl", "deploy_npm", "assemble_npm")
assemble_npm(
    name = "npm_assemble_pubsub_nodejs",
    target = ":pubsub_nodejs_grpc"
)

deploy_npm(
    name = "npm_deploy_pubsub_nodejs",
    target = "npm_assemble_pubsub_nodejs",
    deployment_properties = "//:deployment.properties"
)

when I run bazel run //...:npm_deploy_pubsub_nodejs -- release the error I get is this:

ERROR: /.../BUILD.bazel:96:11: every rule of type deploy_npm implicitly depends upon the target '@nodejs//:bin/npm', but this target could not be found because of: no such target '@nodejs//:bin/npm': target 'bin/npm' not declared in package '' defined by /.../external/nodejs/BUILD.bazel

Does anyone have any good examples of how to do this with npm? I'm not sure how to best get the target @nodejs//:bin/npm to resolve.

jon-whit avatar Nov 02 '20 18:11 jon-whit

Apologies for having missed this issue. We are using this rule in our NodeJS client release pipeline.

Therefore, if you have a look at how we declare deploy_npm target in this BUILD file, as well as looking at how we declare all the dependencies in the WORKSPACE file you should have full information on how to make it work on your end.

lolski avatar Jun 16 '22 13:06 lolski

Hi @jon-whit . Were you able to get deploy_npm working?

alexjpwalker avatar Jan 11 '23 18:01 alexjpwalker