rules_nodejs icon indicating copy to clipboard operation
rules_nodejs copied to clipboard

Generated macros for npm package bin should trigger `npm_package_bin` if `stdout` is used

Open jfirebaugh opened this issue 3 years ago • 0 comments

🚀 feature request

Relevant Rules

Any generated macro for npm packages with bin entries.

Description

I am using emscripten-library-generator, which has a bin that writes to stdout (and no option to write somewhere else). I would like to write:

load("@npm//emscripten-library-generator:index.bzl", "emscripten_library_generator")

emscripten_library_generator(
    name = "gen",
    ...
    stdout = "library.js",
)

This currently triggers:

ERROR: [snip path]: //:gen: no such attribute 'stdout' in 'nodejs_binary' rule

Describe the solution you'd like

If one of the generated macros is used with the stdout attribute, it should use npm_package_bin rather than nodejs_binary.

Describe alternatives you've considered

Revert to using genrule.

jfirebaugh avatar Apr 11 '22 20:04 jfirebaugh