Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "npx" target to node repo #3429

Merged
merged 4 commits into from
Aug 12, 2023
Merged

Add "npx" target to node repo #3429

merged 4 commits into from
Aug 12, 2023

Conversation

matthewjh
Copy link
Contributor

@matthewjh matthewjh commented Apr 27, 2022

PR Checklist

Please check if your PR fulfills the following requirements:

  • 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?

  • 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
  • No

Other information

Quesions:

Can I remove the npx_bin target?

Copy link
Collaborator

@alexeagle alexeagle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@alexeagle alexeagle closed this Oct 20, 2022
@alexeagle alexeagle reopened this Oct 20, 2022
@alexeagle
Copy link
Collaborator

@matthewjh sorry this got stuck for so long - the test failures look legitimate, could you take a look?

@github-actions
Copy link

This Pull Request has been automatically marked as stale because it has not had any activity for 6 months. It will be closed if no further activity occurs in 30 days. Collaborators can add a "cleanup" or "need: discussion" label to keep it open indefinitely. Thanks for your contributions to rules_nodejs!

@github-actions github-actions bot added the Can Close? We will close this in 30 days if there is no further activity label Apr 22, 2023
@alexeagle alexeagle self-assigned this Apr 22, 2023
@alexeagle alexeagle changed the base branch from stable to main August 11, 2023 23:17
@alexeagle alexeagle force-pushed the npx-fix branch 2 times, most recently from c56dab4 to 03b1e42 Compare August 11, 2023 23:42
@alexeagle
Copy link
Collaborator

I rebased and spent an hour debugging on Windows... :/

Thanks!

@alexeagle alexeagle merged commit 9007dc7 into bazelbuild:main Aug 12, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Can Close? We will close this in 30 days if there is no further activity
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants