cozy-labs / cozy-desktop

File Synchronisation for Cozy on Desktop and Laptop
https://cozy-labs.github.io/cozy-desktop/
GNU Affero General Public License v3.0
98 stars 45 forks source link

core/local: Replace @atom/watcher based producer #2242

Closed taratatach closed 2 years ago

taratatach commented 2 years ago

@atom/watcher prevents us from upgrading Electron to v13+ as it uses an old API and does not compile anymore. After trying to patch it a few times and since the project is dead (it hasn't been maintained in 2 years, its maintainers are unresponsive and Github is sunsetting the Atom text editor, main user of @atom/watcher — see https://github.blog/2022-06-08-sunsetting-atom/), we've decided to replace it entirely.

We want to keep the same channel based local watcher and only replace the producer step.

We've decided to use @parcel/watcher, used by https://github.com/parcel-bundler/parcel. However, since some modifications were required to fit our needs, we'll use our own fork until our changes are merged upstream. If some or all should never get merged, we shall consider building our own npm package instead. The list of changes made to @parcel/watcher can bee seen in the following Pull Request: https://github.com/taratatach/parcel-watcher/pull/1.

Although the behavior of the local watcher will remain untouched on macOS (which does not make use of the new producer yet) and mostly the same on Linux and Windows, we were able to bake some improvements right into @parcel/watcher itself. For this reason, we don't need the win_detect_move step anymore as movements will now be detected and notified by @parcel/watcher, even during an initial scan. Also, we added a directory scanner to @parcel/watcher so we don't need to build one in Javascript in the producer step. This scanner written in C++ should be much faster.

Please make sure the following boxes are checked: