Allow cli to be executed against arbitrary package.json scripts?
See original GitHub issueLet’s say I have package.json scripts
declaration like this:
"scripts": {
"stats": "webpack --profile --json > stats.json",
"start": "webpack-dev-server",
"deploy": "gh-pages -d build",
"build": "webpack",
"test": "karma start",
"test:tdd": "karma start --auto-watch --no-single-run",
"test:lint": "eslint . --ext .js --ext .jsx --ignore-path .gitignore --ignore-pattern dist --cache"
},
I would like to run webpack-validator
cli against all of these (separate script) without having to spell each script explicitly.
My current tooling figures out which webpack configuration to run based on process.env.npm_lifecycle_event
. I would need some neat way to run the validator while setting that against each script name.
How would you solve this? I could probably handle it outside of webpack-validator
but some kind of integration might be cool as well. Then you would perhaps point the validator to package.json and it would just work.
If we can agree on a specification, I could implement it.
Issue Analytics
- State:
- Created 7 years ago
- Comments:16 (7 by maintainers)
Top Results From Across the Web
npm-exec
This command allows you to run an arbitrary command from an npm package (either one installed locally, or fetched remotely), in a similar...
Read more >pass cli args anywhere into an npm run scripts command with ...
ok, i found a solution. I can wrap whatever i need to pass into an npm script command into a cli tool, that...
Read more >Preventing npm from Executing Arbitrary Scripts - NerdyCode
In 2016, npm disclosed the discovery of a vulnerability that essentially allows npm packages to execute potentially malicious code on your ...
Read more >Why doesn't "npm run" run my arbitrary package script?
Also, make sure ignore-scripts is not set to true globally. npm config set ignore-scripts false.
Read more >Using NPM Run-Scripts To Execute Shell Commands In ...
As it turns out, there is a --prefix argument which will force the npm CLI tool to execute the subsequent commands from the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
--all-scripts
would be cool, yeah.The implementation takes a couple of further tweaks (need to do
path.join
againstprocess.cwd()
etc.) but I don’t mind doing a PR.Ok, now I understand it much better. Well, it’ll probably be really handy for 80 percent of people’s setups. As long as we have an explicit description what it can and can’t do in the README, I think we can put it on the cli, maybe with
--all-scripts
,--from-scripts
or--scripts
?