Auto-restart node apps using chokidar!
npm install thann/chode
if (require('chode')()) return;
And your app will restart on any changes to the folder it's in!
This is just a wrapper for chokidar.watch(...)
,
so you can pass any of those options.
You can also run arbitrary commands in the terminal like this:
$ chode echo cool
const watcher = require('chode')(
__dirname, // folder to watch
{ // chokidar options
ignored: /.*\/node_modules\/.*/
},
{ // library options
killSignal: 'SIGTERM'
}
);
if (watcher) {
watcher.on('change', f => console.log('----- changed:', f));
return;
}
See test.js for an example app.