Skip to content
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

Merged
merged 4 commits into from
May 21, 2021
Merged

Migrate from watch to chokidar #843

merged 4 commits into from
May 21, 2021

Conversation

sqrrrl
Copy link
Member

@sqrrrl sqrrrl commented May 17, 2021

Fixes #841.

  • npm run test succeeds.
  • npm run lint succeeds.
  • Appropriate changes to README are included in PR.

Copy link
Collaborator

@PopGoesTheWza PopGoesTheWza left a 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.

};
const watcher = chokidar.watch(rootDir, {persistent: true, awaitWriteFinish: true, ignoreInitial: true});
watcher.on('ready', pushFiles); // Push on start
watcher.on('all', watchCallback);
Copy link
Collaborator

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)

Copy link
Member Author

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.

Copy link
Collaborator

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.

@PopGoesTheWza
Copy link
Collaborator

LGTM

@sqrrrl sqrrrl merged commit 003d422 into master May 21, 2021
@sqrrrl sqrrrl mentioned this pull request May 21, 2021
3 tasks
@PopGoesTheWza PopGoesTheWza deleted the deps branch May 21, 2021 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

replace old watch dependency with chokidar
2 participants