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:
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user