[#6136] added warning logs in case of mismatched modernc deps

This commit is contained in:
Gani Georgiev
2024-12-20 12:21:18 +02:00
parent 7147633f96
commit 2ebc6aecac
3 changed files with 89 additions and 0 deletions

View File

@@ -12,7 +12,9 @@ import (
"github.com/fatih/color"
"github.com/pocketbase/pocketbase/cmd"
"github.com/pocketbase/pocketbase/core"
"github.com/pocketbase/pocketbase/tools/hook"
"github.com/pocketbase/pocketbase/tools/list"
"github.com/pocketbase/pocketbase/tools/routine"
"github.com/spf13/cobra"
_ "github.com/pocketbase/pocketbase/migrations"
@@ -137,6 +139,24 @@ func NewWithConfig(config Config) *PocketBase {
// hide the default help command (allow only `--help` flag)
pb.RootCmd.SetHelpCommand(&cobra.Command{Hidden: true})
// https://github.com/pocketbase/pocketbase/issues/6136
pb.OnBootstrap().Bind(&hook.Handler[*core.BootstrapEvent]{
Id: ModerncDepsCheckHookId,
Func: func(be *core.BootstrapEvent) error {
if err := be.Next(); err != nil {
return err
}
// run separately to avoid blocking
logger := be.App.Logger()
routine.FireAndForget(func() {
checkModerncDeps(logger)
})
return nil
},
})
return pb
}