Files
base/ui-react/embed.go
zeekay 387363b909 feat(ui-react): swap admin SPA to @hanzogui/admin chrome via apps/admin-base
Source moves to ~/work/hanzo/gui/apps/admin-base. scripts/sync-admin-ui.sh
copies dist/ here for go:embed. apis/serve.go now imports ui-react instead
of legacy Svelte ui. README + embed.go docstrings updated. .gitignore
exception flipped from ui/dist to ui-react/dist so go build is hermetic.
2026-04-27 18:30:29 -07:00

31 lines
991 B
Go

// Package uireact embeds the Base admin bundle (Hanzo GUI v7 + Vite).
//
// Source lives in ../gui/apps/admin-base. Build there with `bun run build`,
// then sync into ./dist via scripts/sync-admin-ui.sh. The //go:embed
// directive below picks up the resulting static assets at compile time
// of the Base binary.
//
// The Go HTTP handler serves the admin UI at the Base server's /_/ path
// — see apis/serve.go (gated behind BASE_ENABLE_ADMIN_UI=1).
package uireact
import (
"embed"
"io/fs"
)
//go:embed all:dist
var distFS embed.FS
// DistDirFS returns a rooted fs.FS pointing at dist/ so it can be passed
// directly to http.FileServerFS or the Base router's Static handler.
func DistDirFS() fs.FS {
sub, err := fs.Sub(distFS, "dist")
if err != nil {
// dist/ must exist before building the Go binary. Run
// `pnpm --dir ui-react build` in CI before `go build`.
panic("ui-react: dist/ missing — run `pnpm --dir ui-react build` first: " + err.Error())
}
return sub
}