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

@@ -0,0 +1,31 @@
package diary_test
import (
"os/exec"
"strings"
"testing"
)
// TestDiaryDoesNotLinkTheConsoleStack (IN-07): diary, and the security
// modules that log through it, link neither bonfire nor the TUI stack
// (bubbletea, bubbles, huh) nor cobra. The console types diary shares with
// bonfire live in internal/consolekit.
func TestDiaryDoesNotLinkTheConsoleStack(t *testing.T) {
goTool, err := exec.LookPath("go")
if err != nil {
t.Skip("go tool not on PATH")
}
const module = "git.golem15.com/golem15/summercms/modules/"
out, err := exec.Command(goTool, "list", "-deps", module+"diary", module+"bouncer", module+"wristband").Output()
if err != nil {
t.Fatalf("go list -deps: %v", err)
}
banned := []string{module + "bonfire", "charm.land/bubbletea/v2", "charm.land/bubbles/v2", "charm.land/huh/v2", "github.com/spf13/cobra"}
for _, dep := range strings.Split(string(out), "\n") {
for _, b := range banned {
if dep == b || strings.HasPrefix(dep, b+"/") {
t.Errorf("diary, bouncer or wristband links %s", dep)
}
}
}
}