added build script

This commit is contained in:
2025-02-26 09:40:15 -06:00
parent 2f0655f0ef
commit 435e0e4632
3 changed files with 14 additions and 6 deletions
+1
View File
@@ -4,3 +4,4 @@ test-db.sqlite*
*_templ.go *_templ.go
node_modules/ node_modules/
styles.css styles.css
mmaschedule
Executable
+10
View File
@@ -0,0 +1,10 @@
#!/usr/bin/env bash
main() {
cd src/ || return
bun run build
templ generate
go build -o mmaschedule
}
main
+3 -6
View File
@@ -11,8 +11,8 @@ import (
"time" "time"
) )
//go:generate bun run build //go:embed static/*
//go:generate templ generate var staticfiles embed.FS
func RunServer(addr string, queries *event.Queries) error { func RunServer(addr string, queries *event.Queries) error {
mux := http.NewServeMux() mux := http.NewServeMux()
@@ -28,11 +28,8 @@ func RunServer(addr string, queries *event.Queries) error {
return err return err
} }
//go:embed static/*
var staticFiles embed.FS
func StaticHandler(prefix string) (http.Handler, error) { func StaticHandler(prefix string) (http.Handler, error) {
static, err := fs.Sub(staticFiles, "static") static, err := fs.Sub(staticfiles, "static")
if err != nil { if err != nil {
return nil, err return nil, err
} }