node-supervisor
node-supervisor copied to clipboard
wishlist: also act on newly created files
Hi!
In addition to watch changes to existing files, it would be handy if supervisor could also monitor the appearance of new files.
Maybe a command line flag that turns on this feature would be useful.
I would love to include this feature. As long as it worked well and only caught files that fit the given criteria, I think it would be fine to do this for everyone. No need tor a flag IMO.
On Thu, Feb 7, 2013 at 3:25 AM, Adrian Knoth [email protected]:
Hi!
In addition to watch changes to existing files, it would be handy if supervisor could also monitor the appearance of new files.
Maybe a command line flag that turns on this feature would be useful.
— Reply to this email directly or view it on GitHubhttps://github.com/isaacs/node-supervisor/issues/89.
+1
+1 Indeed. It actually took me a while to realize what was going on when restarts weren't happening as I'd expect. During certain phases of development, one is creating and/or removing files nearly as often as one is modifying them.
I wouldn't expect it to be much work to rescan directories that have been passed via --watch.
I created a branch to experiment with this feature. It will now rescan the watched items, but will not restart if only a new file is placed in one of the watched directories.
Unfortunately, I think a good deal more refactoring is needed to include new files without requiring a restart/rescan. In particular, watching needs to be sensitive to whether a file or directory was requested. If it's a directory, it needs to be watched itself and scan/update on changes. Even more unfortunately, I think you need to keep track of what may no longer be watched and what's still around.
Fortunately, I tend to modify existing files when a new file is added. Thus, the new stuff gets added.
+1