File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ const NodeWatcher = require('./src/node_watcher');
44const PollWatcher = require ( './src/poll_watcher' ) ;
55const WatchmanWatcher = require ( './src/watchman_watcher' ) ;
66const FSEventsWatcher = require ( './src/fsevents_watcher' ) ;
7+ const WatchDetector = require ( 'watch-detector' ) ;
78
89function sane ( dir , options ) {
910 options = options || { } ;
@@ -16,6 +17,18 @@ function sane(dir, options) {
1617 return new WatchmanWatcher ( dir , options ) ;
1718 } else if ( options . fsevents ) {
1819 return new FSEventsWatcher ( dir , options ) ;
20+ } else if ( options . auto ) {
21+ delete options . auto ;
22+ const detector = new WatchDetector ( {
23+ fs : require ( 'fs' ) ,
24+ root : dir ,
25+ ui : {
26+ writeLine ( message ) {
27+ console . log ( message ) ;
28+ } ,
29+ } ,
30+ } ) ;
31+ return sane ( dir , detector . findBestWatcherOption ( options ) ) ;
1932 } else {
2033 return new NodeWatcher ( dir , options ) ;
2134 }
Original file line number Diff line number Diff line change 3535 "micromatch" : " ^3.1.4" ,
3636 "minimist" : " ^1.1.1" ,
3737 "walker" : " ~1.0.5" ,
38- "watch" : " ~0.18.0"
38+ "watch" : " ~0.18.0" ,
39+ "watch-detector" : " ^0.1.0"
3940 },
4041 "devDependencies" : {
4142 "eslint" : " ^3.19.0" ,
You can’t perform that action at this time.
0 commit comments