-
Notifications
You must be signed in to change notification settings - Fork 421
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate from watch to chokidar #843
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please consider reducing eligible events.
src/commands/push.ts
Outdated
}; | ||
const watcher = chokidar.watch(rootDir, {persistent: true, awaitWriteFinish: true, ignoreInitial: true}); | ||
watcher.on('ready', pushFiles); // Push on start | ||
watcher.on('all', watchCallback); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure events like addDir
and unlinkDir
are worth processing for they relate to folder events. Inside watchCallback
I filter and keep only add
, change
and unlink
events (or register watchCallback
only for those .on()
events)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. In practice, it's not much of an issue since default clasp ignore settings ends up filtering out directories. In any case, changed it to just add/change/unlink + added debouncing to handle 'save all' type actions in IDEs so the events get coalesced into a single push.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seeing how you added debounce
, I guess you use/test the watch feature. There's just too much I did refactor without thoroughly testing it.
LGTM |
Fixes #841.
npm run test
succeeds.npm run lint
succeeds.