Reputation: 868
From Bazel I want to run some npm
commands to install
node modules,
and to run
some webpack commands.
I have created a genrule to run the correct commands, but this seems to run in a sandbox without the npm
command.
I found https://github.com/redfin/npm-bazel but am unsure if this does what I want.
In this they seem to add a new_http_archive
for node, and I'm thinking whether doing this and then passing it to my commands via the tools
argument in genrule is the correct approach?
Upvotes: 4
Views: 4276
Reputation: 5915
I think the project you link to is an npm module to generate a bazel workspace (and maybe build files). I think you want the other direction to depend on npm modules. AFAIK there isn't yet rules_npm but there is some basic support in rules_typescript. I haven't yet used it (we're migrating JVM code before JS code) but I suggest you try to poke there and see if it's usable for you even without the typescript part. The above link shows some commits, issues and very basic code pointers for npm.
Hope this helps.
Update:
rules_nodejs has been released and it has built in support for npm.
Upvotes: 4