When developing with amber w, the server compiles and restarts automatically. However if the server has started once, and a successive restart fails to compile, the watch will just restart the old version of the server.
With the new logging, one request is enough to make the compiler errors disappear, and it can be confusing why new changes aren't showing up.
amber watch, ensure app starts successfullyExpected behavior:
I think it makes sense to terminate the server and wait for a new change to retry compiling.
Actual behavior:
Server starts with old code.
Reproduces how often: 100%
> amber --version
Amber CLI (amberframework.org) - v0.6.0
> crystal --version
Crystal 0.24.1 (2017-12-26)
LLVM: 5.0.1
Default target: x86_64-apple-macosx

@faustinoaq with all the different work floating around with the watcher, I was hoping that this issue was already being worked on. Thank you!
We should also add Process.new(args...).wait to avoid NPM from starting before the amber w is complete. Also I was considering that we change the order of the processes, NPM install first then Amber Watch. WDYGT?
I'm not sure the process order matters to me. I'd rather have both start as soon as possible so the server refresh time is as fast as possible.
We should also add Process.new(args...).wait to avoid NPM from starting before the amber w is complete.
I think this is making amber watch a bit slow. I changed it to run NPM once and in parallel, so we can have both as fast as possible watching the project files.
I'm not sure the process order matters to me. I'd rather have both start as soon as possible so the server refresh time is as fast as possible.
I agree 馃憤
I think, this is fixed on v0.6.2:
09:02:08 Watcher | Watching file: ././src/blog.cr
09:02:08 Watcher | Watching file: ././src/controllers/home_controller.cr
09:02:08 Watcher | Watching file: ././src/controllers/application_controller.cr
09:02:08 Watcher | Watching file: ././config/routes.cr
09:02:08 Watcher | Watching file: ././config/application.cr
09:02:08 Watcher | Watching file: ././src/views/layouts/application.slang
09:02:08 Watcher | Watching file: ././src/views/layouts/_nav.slang
09:02:08 Watcher | Watching file: ././src/views/home/index.slang
09:02:08 Watcher | Building project Blog...
Syntax error in src/blog.cr:5: for empty hashes use '{} of KeyType => ValueType'
{}
^
09:02:08 Watcher | Compile time errors detected. Shutting down...
@faustinoaq which PRs address these issues?
Most helpful comment
I think this is making
amber watcha bit slow. I changed it to run NPM once and in parallel, so we can have both as fast as possible watching the project files.I agree 馃憤