cloudamqp / lavinmq

Lightweight and fast AMQP (0-9-1) server
https://lavinmq.com
Apache License 2.0
582 stars 33 forks source link

Watch, recompile and reload view changes #802

Closed baelter closed 3 weeks ago

baelter commented 3 weeks ago

WHAT is this pull request doing?

To enable fast iteration on UI development this PR adds a couple of things:

  1. make targets and associated files to compile ECR views separately and serve them from the static/ folder.
  2. make target to watch ECR files and recompile them when they change.
  3. livereload client and server to refresh the browser when views a recompiled.

HOW can this pull request be tested?

Run two terminals with bin/lavinmq and make dev-ui Open a browser and make some changes to ECR files and behold.

spuun commented 3 weeks ago
 6 | watcher = Inotify.watch dir do |event|
                       ^----
Error: undefined method 'watch' for Inotify:Module

Inotify only supports linux: https://github.com/petoem/inotify.cr/blob/master/src/inotify.cr#L3

viktorerlingsson commented 3 weeks ago

Shouldn't live_reload be a development_dependency?

baelter commented 3 weeks ago

Shouldn't live_reload be a development_dependency?

No, I removed the dependency on running live_reload in crystal. https://github.com/cloudamqp/lavinmq/pull/802#discussion_r1795464183