Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CLI: Re-implement run.watch() with 'node-watch' instead of 'sane'
Similar to the previous commit, I considered a simple approach of our own based on the built-in Node.js API. The fs.watch() API is actually quite good in Node 6+ (certainly much better than it used to be). But, there are two notable issues that I think we should care about: 1. Its "recursive" feature is lacking on Linux (only stable on macOS and Windows). 2. Its ability to distinguish between create, update and remove events isn't very good. This last point would be fairly easily to do on the consumer side with a quick fs.stat() call. We could even omit it entirely given we only use it for one word (a verb) in the CLI output. But the first point (recursion) is slightly more involved than I'd like to maintain locally. All the reviewed packages essentially handle this the same way. They create a non-recursive fs.watch() for each sub directory found on the system, track them in an object. Then, start new ones as needed when new directories are created, and stop old one when directories are removed. That's about 100 lines of simple code. Where they differ is: * How many extra features they provide. * How many simple functions for non-critical code are delegated to other packages. * Whether they use native "recursive" when available (on macOS/Windows). privide in addition to that I'm proposing we go with node-watch. This package is well-maintained, tested with the latest Node versions, optimised for Node 6+, and provides no additional features, and is dependency-free. > [email protected] (current) > Dependencies:⚠️ > 119 packages. > (concerning in terms of dicipline and security) > License: ✅ > MIT. > Supported: ✅ > 2018 saw 25 commits, 8 contributors, 2 major releases. > Modern: *️⃣ > Requires Node 6+, but not yet tested on Node 10. > [email protected] > Dependencies: *️⃣ > 14 packages. > (okay, but could be better.) > License: ✅ > MIT. > Supported: ✅ > 2018 saw 22 commits, 6 contributors, 1 release. > Modern: ✅ > Requires Node 4+, tested with Node 10. > [email protected]: > Dependencies: ✅ > 3 packages. > License: ✅ > Apache-2.0. > Supported:⚠️ > 2018 saw no commits or releases. > Modern:⚠️ > Still supports Node 0.1. No visible CI or commit activity > indicating testing with recent Node releases. > [email protected]: > Dependencies: ✅ > 1 package (dependency-free). > License: ✅ > MIT. > Supported: ✅ > 2018 saw 22 commits, 3 contributors, 3 minor releases. > Modern: ✅ > Requires Node 6+, tested with Node 10. > Uses native fs.watch/recursive support where available. > [email protected]: > Dependencies: ✅ > 2 packages (1 dependency). > License: ✅ > MIT. > Supported:⚠️ > 2018 saw no commits or releases. > Modern:⚠️ > Last tested with Node 0.10. > Uses per-file watching and polling for all platforms. Fixes #1342.
- Loading branch information