feat(01-03): add summer dev watch rebuild loop

- Watch app sources with fsnotify, debounce, and one serialized build.App
- Restart the child only after a successful build and print rebuild latency
- Ignore generated app files and reap the child on cancellation
This commit is contained in:
Jakub Zych
2026-09-16 13:59:43 +02:00
parent a6004e490f
commit 270b7f1e87
6 changed files with 468 additions and 4 deletions

View File

@@ -7,6 +7,7 @@ import (
"git.golem15.com/golem15/summercms/bonfire"
"git.golem15.com/golem15/summercms/internal/build"
"git.golem15.com/golem15/summercms/internal/dev"
)
func main() {
@@ -27,6 +28,7 @@ func toolCommands() []bonfire.Command {
buildCommand(),
makePluginCommand(),
addPluginCommand(),
devCommand(),
}
}
@@ -72,6 +74,20 @@ func makePluginCommand() bonfire.Command {
}
}
func devCommand() bonfire.Command {
return bonfire.Command{
Name: "dev",
Description: "Watch sources and rebuild the app binary",
Run: func(ctx context.Context, in bonfire.Input, out bonfire.Output) error {
dir, err := os.Getwd()
if err != nil {
return err
}
return dev.Watch(ctx, dir, out)
},
}
}
func addPluginCommand() bonfire.Command {
return bonfire.Command{
Name: "plugin:add",