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

Support for running bin scripts using node --run #53845

Open
manoraj opened this issue Jul 14, 2024 · 6 comments
Open

Support for running bin scripts using node --run #53845

manoraj opened this issue Jul 14, 2024 · 6 comments
Labels
cli Issues and PRs related to the Node.js command line interface. feature request Issues that request new features to be added to Node.js. stale

Comments

@manoraj
Copy link

manoraj commented Jul 14, 2024

What is the problem this feature will solve?

This feature will help run the bin scripts in package.json, similar to running scripts. During local development, it's very common to run the bin scripts, and it would be great if the node task runner supported it.

What is the feature you are proposing to solve the problem?

Add node --run --bin or node --run-bin. This will run the bin script similar to what node --run does, except it looks for a bin field.

I know node task runner is not a replacement for something like yarn, but, another option is to support both the fields (scripts and bin) with node --run, similar to what yarn does.

What alternatives have you considered?

No response

@manoraj manoraj added the feature request Issues that request new features to be added to Node.js. label Jul 14, 2024
@github-project-automation github-project-automation bot moved this to Awaiting Triage in Node.js feature requests Jul 14, 2024
@KunalKumar-1
Copy link
Contributor

KunalKumar-1 commented Jul 14, 2024

It seems like you're proposing a cli feature related to running executable scripts defined in the bin field of package.json files, similar to how npm run executes scripts defined in the scripts field.
is it ?

@avivkeller avivkeller added the cli Issues and PRs related to the Node.js command line interface. label Jul 14, 2024
@avivkeller avivkeller moved this from Awaiting Triage to Triaged in Node.js feature requests Jul 14, 2024
@manoraj
Copy link
Author

manoraj commented Jul 15, 2024

It seems like you're proposing a cli feature related to running executable scripts defined in the bin field of package.json files, similar to how npm run executes scripts defined in the scripts field. is it ?

@KunalKumar-1 Yes. Node already has node --run. Ask is to extend it to bin scripts as well.

@jasnell
Copy link
Member

jasnell commented Jul 15, 2024

Since we've added --run supporting bin also seems to make sense. Perhaps node --bin foo would work?

@manoraj
Copy link
Author

manoraj commented Jul 19, 2024

Since we've added --run supporting bin also seems to make sense. Perhaps node --bin foo would work?

That's one option. The other option is to extend checking both scripts and bin fields in package.json with --run. Just like how yarn <script> does.

@jdalton
Copy link
Member

jdalton commented Oct 3, 2024

The more you jam into node --run the slower it gets? I was able to leverage node --run with spawn and conditionally use it (when supported or fallback to npm run) resolving the bin with the which package.

Copy link
Contributor

github-actions bot commented Apr 1, 2025

There has been no activity on this feature request for 5 months. To help maintain relevant open issues, please add the never-stale Mark issue so that it is never considered stale label or close this issue if it should be closed. If not, the issue will be automatically closed 6 months after the last non-automated comment.
For more information on how the project manages feature requests, please consult the feature request management document.

@github-actions github-actions bot added the stale label Apr 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli Issues and PRs related to the Node.js command line interface. feature request Issues that request new features to be added to Node.js. stale
Projects
Development

No branches or pull requests

5 participants