-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
Feature Request: CLI to run package.json scripts #12073
Comments
Maybe In a nutshell if |
@michael-ciniawsky can you clarify what |
I've found myself many times wanting to have generic For instance, package.json
Calling If I am in a directory that contains multiple modules in node_modules, and I want to select which one I run... e.g.
(sorry, missed a level in the diagram initially) Then I could do
There would be no environment variables, no need to keep it semantically the same as npm lifecycle scripts, as the |
@jasnell people use runners in |
ok. so perhaps ... |
I really like the idea and few days before I wanted something like that. We already have a lot of forms to run a script in development systems. We've make, npm scripts, gulp, grunt and many others. Porting some of this to the node binary is not an unnecessary overhead? |
The scripts would not necessarily need to be ported to the binary. Runner scripts located in
|
I think we have differing ideas on what this should do, for example webpack, doesn't use main in this manner. Also, some people have bins with different names than their modules so routing could get weird. I am not sure I want |
Ok, that's fair. Perhaps describe a bit more about what you're looking for? |
I was wanting to just run the |
of note: |
@bmeck index is the entry :) |
@michael-ciniawsky this is not intended to be used for any form of package management/installation. That was discussed in |
Following the discussion |
I very much want this to only look at "scripts", and not a new top level key - there should only be one place in my package.json where I define how to run my tests. |
Discussion on this has gone quiet for a few months. Is there something resembling consensus on how this feature should work? Doesn't look like it to me, but if so, maybe we can add a If there isn't consensus, maybe the thing to do is close. People can still submit pull requests with proof-of-concept implementations for any approach they feel strongly about. |
Agreed. To consolidate the many ideas floating around, people could file an EP at https://github.com/nodejs/node-eps, which is what we usually do for a big feature like this. |
For anyone who really wants this badly, there is a little cli app called ipt that creates a dropdown menu from any list you pipe to it. But it looks like there is even a 'workflow' to run npm scripts if you're not a fan of shell aliases. |
Having to have jq installed, and an npm package, seems a lot heavier weight than just having npm itself installed and using |
Since #11835 is undead... several people have remarked that the number 1 reason for broken node installs (observe nodejs/help) is in fact npm. Notably, doing an in-place upgrade or downgrade sometimes leaves npm in a broken state. Node itself is immune to that because it's a single binary. (FWIW, I was not in favor of this proposal back in 2017 but the more I think about it, the more it starts to make sense.) |
Currently many people use
npm run
in order to start up applications. In environments withoutnpm
this functionality would be very useful I recommend we pull this functionality into core itself.This has a few things to note/bikeshed:
Wrapper process when running a
node
child process:*nix
we canexec()
in C to replace current process even if the child is notnode
WIN32
we cannot use the current process if the child is notnode
Env variables:
npm
sets up many environment variables.PATH
is mutated for the process to include a vendorednode-gyp
, I am unclear to what extent we want this.Argv:
--inspect
are not properly propagated to child processesI am not seeking to introduce a standards
node --run-script build
etc. that would run a compile toolchain, not am I seeking to introduce a standardnode --run-script install
. I would like those to completely delegate to thepackage.json
.This can somewhat be related to #11903 which would have some entry point with a
package.json
presumably. It also relates to #11997 which has an idea of process argv delegation.The text was updated successfully, but these errors were encountered: