- Published on
Cross Platform NPM Scripts with shx and npm run all
- Authors
- Name
- Yair Mark
- @yairmark
In the process of trying to understand how Lerna is used I looked at some big repos that exist in the wild and also came across 2 interesting NPM packages:
- shx: This lets you run Unix like commands in your
package.json
scripts section. Usingshx
makes these scripts work cross-platform not just in Un/Linux environments. - npm-run-all: Instead of having to chain commands together using
&&
in yourpackage.json
scripts you can instead use this package which lets you simply specify the commands one after another.npm run script1 && npm run script2 && num run script3
becomesrun-s script1 script2 script3
or simplyrun-s script*
. This runs these scripts sequentially.- You can also run these in parallel by using
run-p script1 script2 script3
or simplyrun-p script*
.
- You can also run these in parallel by using