run-npm - Run locally-installed node module executables. Useful for debugging npm scripts.
npm-quick-run - Quickly run npm scripts by prefix without typing the full name.
Cross-platform Shell Reference
&& runs commands in sequence. If a command fails, the script exits.
| pipes the stdout of one command into the stdin of the next. (do-something | something else)
> writes the stdout of a command to a file. (do-something > file)
< sends the contents of a file to a command's stdin. (command < file)
cd <dir> changes the current working directory to <dir>. Note that cd alone prints the current working directory on windows, but changes the working directory to ~ on *nix.
npm run Reference
You can use npm run-script or npm run; they both do the same thing, but npm run is shorter.
Run just npm run to print a list of scripts.
Running npm run script (where script is the name of your script) will run prescript, script, andpostscript; in that order.
You can't nest pre and post hooks (i.e. preprescript won't work).
You can pass arguments to your scripts by passing -- to npm run, followed by the arguments. Example: Given the script "mocha": "mocha", you can run npm run mocha -- --reporter xunit. This effectively runs mocha --reporter xunit.
Running npm test is the same as running npm run test. The same applies to npm start and npm stop.
You can run npm run <script> -s to silence the default npm output (useful for calling a script within another script).