refactor(diary): share the console types through internal/consolekit so diary no longer links bonfire (IN-07, quick-261028-rqd)

This commit is contained in:
Jakub Zych
2026-10-28 20:46:32 +01:00
parent 3520d5d480
commit f3f87f3cc4
14 changed files with 364 additions and 169 deletions

View File

@@ -18,7 +18,7 @@ import (
"sync/atomic"
"time"
"git.golem15.com/golem15/summercms/modules/bonfire"
"git.golem15.com/golem15/summercms/internal/consolekit"
"git.golem15.com/golem15/summercms/modules/compass"
)
@@ -33,7 +33,7 @@ type Options struct {
// Quiet raises the console channels to warn; files keep their levels.
Quiet bool
// Color decides on styled console output (bonfire.ColorAuto by default).
Color bonfire.ColorMode
Color consolekit.ColorMode
// Root is the application root that relative daily paths resolve
// against; empty means the working directory.
Root string
@@ -214,8 +214,9 @@ func setVerbosityLocked(v int, quiet bool) {
// FromGlobals returns the Options for the console global options: their
// verbosity, quiet switch and color mode. The generated main passes it to
// Bootstrap and Setup.
func FromGlobals(g bonfire.Globals) Options {
// Bootstrap and Setup. g is a bonfire.Globals: bonfire and diary share the
// type through internal/consolekit, so diary does not link bonfire.
func FromGlobals(g consolekit.Globals) Options {
return Options{Verbosity: g.Verbosity, Quiet: g.Quiet, Color: g.Color}
}
@@ -225,7 +226,7 @@ func FromGlobals(g bonfire.Globals) Options {
// rebuilds the channels from the same configuration. The generated main
// registers it with bonfire.OnGlobals. It holds the setup lock for its
// whole run, so concurrent calls rebuild the channels once.
func ApplyGlobals(g bonfire.Globals) {
func ApplyGlobals(g consolekit.Globals) {
mu.Lock()
defer mu.Unlock()
st := current.Load()