node-watch api issue
yuanchuan opened this issue · comments
Yuan Chuan commented
Hi @billymoon , I saw you've upgraded node-watch up to v0.5.1 and that's great. However, the new APIs is not fully backward-compatible :(
So you have to change the watch function at this line to something like this:
// an extra event name is always provided by the callback function
watch(path.resolve(app.program.args[0] || process.cwd()), function (evt, filename) {
// ...
});
The recursive
option is default to be false
just like fs.watch
does, it needs to be added explicitly if you want to watch all the sub-dirs.
const target = path.resolve(app.program.args[0] || process.cwd());
watch(target, { recursive: true }, function (evt, filename) {
// ...
});
Billy Moon commented
Thanks @yuanchuan for the heads up