Like gulp.watch but for npm scripts.
$ npm install -D nswatch
Assuming you have an npm script
build to compile something, then drop a
watch.js in your project:
const watch =
When you run
node watch, the
npm run build will be invoked right away, and will also be invoked when file changes are detected.
Parallel and Sequence
Array will be treated as parallel,
String will be treated as sequence:
// run in parallel// run in sequence// use ! as seperator
$ npm install -g nswatch
You can also use
nswatch as a command-line program:
Or you can pass the config via CLI arguments, this way configurations in
package.json will be ignored.
# in parallel$ nswatch "src/*.js" --script foo --script bar# in sequence$ nswatch "src/*.js" --script "foo!bar"