billymoon / sir

Simple command line development server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

node-watch api issue

yuanchuan opened this issue · comments

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) {
  // ...
});

Thanks @yuanchuan for the heads up