Vellum/Makefile
mithral 5283e073f5 Web UI: Svelte app, embedded into the binary
The frontend the app needs to be usable at all.

- web/: Svelte 5 + Vite + TypeScript SPA. Login, app shell with per-type nav,
  library list/create/scan/delete, item grid with covers, admin user
  management, and an epub.js reader that syncs progress.
- Reader resumes by spine index — an integer — which is why the polymorphic
  progress table needs no text column.
- Session state uses classic stores in a plain .ts module rather than runes in
  a .svelte.ts module, avoiding special module resolution.
- Embedding: web/embed.go embeds web/dist. A committed .gitkeep keeps the
  directive valid before the frontend is built, so `go build ./...` never
  fails. Unknown non-API paths serve index.html for client routes; /api/* and
  /healthz always return JSON and never fall back to HTML.
- Dockerfile builds the UI in a node stage and overlays dist into the Go stage.
- pnpm 12 needs allowBuilds in pnpm-workspace.yaml; esbuild approved, the two
  unused transitive scripts explicitly denied so install exits 0.

svelte-check: 0 errors, 0 warnings. Verified served: SPA shell at /, route
fallback, hashed asset, and JSON 404 on /api/*.
2026-10-09 16:40:58 -04:00

46 lines
979 B
Makefile

# Vellum — developer commands.
#
# Requires Go >= 1.26 and pnpm. On Fedora: sudo dnf install golang
# Frontend: cd web && pnpm install
BINARY := vellum
VERSION ?= 0.4.0-dev
LDFLAGS := -s -w -X main.version=$(VERSION)
.PHONY: build web run test fmt vet tidy check docker clean
# Build the frontend first: the Go build embeds web/dist.
build: web
CGO_ENABLED=0 go build -trimpath -ldflags "$(LDFLAGS)" -o $(BINARY) ./cmd/vellum
web:
cd web && pnpm install --silent && pnpm build
# Go-only build, for when the frontend is unchanged.
build-go:
CGO_ENABLED=0 go build -trimpath -ldflags "$(LDFLAGS)" -o $(BINARY) ./cmd/vellum
run:
go run ./cmd/vellum
test:
go test ./...
fmt:
gofmt -w .
vet:
go vet ./...
tidy:
go mod tidy
# What CI should run.
check: fmt vet test
docker:
podman build --build-arg VERSION=$(VERSION) -t localhost/vellum:$(VERSION) .
clean:
rm -f $(BINARY)
rm -rf data config web/dist/*.js web/dist/*.css web/dist/assets web/dist/index.html