- 
          
- 
        Couldn't load subscription status. 
- Fork 197
Closed
Description
The way live sync watch works now is to watch for file changes, and when that happens:
- Trigger a platform prepare.
- Sync files to the device.
The problem is that step #2 doesn't wait for #1 to complete, and doesn't detect any files changed by platform prepare (before-prepare) hooks where we usually register compilers (typescript, etc). We handle this with a hack that:
- Excludes source files (e.g. *.tsfrom triggering a live sync).
- Start another file system watcher (or three, when speaking of the nativescript-dev-typescript plugin), and compile files when we detect changes.
- Modify before-preparehooks, detect "live sync" preparation invocations, and do nothing in that case.
- Wait for livesync to sync generated files using the "regular" work flow.
This manifests into all sorts of problems like:
- Endless prepare-compile-prepare loops caused by omissions in ignore lists or hooks that don't detect live sync runs..
- Unnecessary double compiles (a milder version of Package skeleton, typescript support and entry point for the cli #1 above).
- Requiring to compiler and code generator hooks to implement their logic in two places: both in their before-preparehook and a file system watcher.
All that goes away with PR #1335 which waits for prepare hooks to run, collects changed files, and removes the need for additional file system watchers.