// Package ui embeds the production build of the single-page application so // the ori server ships as a single binary. // // The Vite build writes to ui/dist (run `make build-ui`). When dist only // contains the committed .gitkeep placeholder, the server still compiles and // answers with an explanatory error page instead of the SPA. package ui import ( "embed" "io/fs" ) //go:embed all:dist var dist embed.FS // Dist returns the embedded SPA build as a filesystem rooted at the dist // directory, i.e. index.html lives at the root of the returned fs.FS. // // Example: // // http.Handle("/", http.FileServerFS(ui.Dist())) func Dist() fs.FS { sub, err := fs.Sub(dist, "dist") if err != nil { // The dist directory is embedded at compile time; its absence is a // build-system bug, not a runtime condition a caller could handle. panic(err) } return sub }