Skip to content

Conversation

@amitb0ra
Copy link

Fixes: #174

Changes

New: AppWatcher class (src/misc/appWatcher.ts)

Extracted all watch logic into a dedicated class with:

  • 1-second debounce - rapid saves only trigger one build
  • Build queue - prevents parallel builds from stepping on each other
  • Error recovery - TS errors are logged, watcher keeps running
  • Config hot-reload - detects app.json, tsconfig.json, .rcappsconfig, package.json changes

Updated: Session management (src/commands/watch.ts)

  • Cache auth token - login once, reuse the session
  • Auto-retry - if token expires, re-auth and retry automatically
  • Refactored deployHelpers.ts to extract retrieveSession() helper

UX improvements

  • Show relative paths in logs instead of absolute
  • Display build duration
  • Clear console before each build
  • Warn if package.json changes (reminds you to run npm install)
  • Graceful shutdown on Ctrl+C

Bug fixes

  • FolderDetails now uses fs.readJson() instead of require() to avoid stale config cache
  • Tuned chokidar stability threshold to 500ms (was 2000ms)

Testing

Added integration tests for debouncing, config reload, and event handling. All existing tests pass.

Dependencies

  • Added p-limit v7.2.0 for build queue

Demo

better-watch.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Infinite loop in rc-apps watch

1 participant