Add "npx" target to node repo
PR Checklist
Please check if your PR fulfills the following requirements:
- [x] Tests for the changes have been added (for bug fixes / features)
- [ ] Docs have been added / updated (for bug fixes / features)
PR Type
What kind of change does this PR introduce?
- [x] Bugfix
- [ ] Feature (please, look at the "Scope of the project" section in the README.md file)
- [ ] Code style update (formatting, local variables)
- [ ] Refactoring (no functional changes, no api changes)
- [ ] Build related changes
- [ ] CI related changes
- [ ] Documentation content changes
- [ ] Other... Please describe:
What is the current behavior?
I want my developers to execute common node commands through bazel run @nodejs//:xxx, so these use the node binary that bazel manages. Anything else can result in creeping inconsistencies due to different pathways using different node versions.
Npm is covered by bazel run @nodejs//:npm, but there is no equivalent for the npx binary.
There is npx_bin, but this is a direct invocation of the npx-cli.js script and uses /usr/local/bin/node rather than the Bazel-managed node binary. This is misleading as the expectation would be that it's going to use the latter.
Issue Number: N/A
What is the new behavior?
This PR adds an npx target to the node repo which can be invoked with Bazel run, e.g. bazel run @nodejs//:npx. This target works just as the npm target does and calls into the .js script via the Bazel-managed node executable.
Does this PR introduce a breaking change?
- [ ] Yes
- [x] No
Other information
Quesions:
Can I remove the npx_bin target?