I have a package.json
script for example npm run script1
and I have also private npm package which is added as a dependency in my project and this package has also scripts in package.json
and this script name script2
. I want that when I run npm run script1
then run automatically start script2. Is that possible?
Thank you.
Package.json
"scripts": {
"runbothscripts": "npm run script1 && npm run script2"
}
Should run both scripts for you if you execute it by doing npm run runbothscripts
.
If script2
would be in a different folders package.json you also first navigate to that folder by doing cd ./otherfolder && npm run script2
Use npm explore command. For example, to run a test script from lodash after running eslint, add this script in your package.json file:
"scripts": {
"script1": "eslint . && npm explore lodash -- npm run test"
}
Then run it as:
npm run script1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With