Vellum/Makefile
mithral 7754b0f504 dev: fix the Vite proxy and add a one-command dev runner
Running `pnpm dev` alone gave ECONNREFUSED on every request, because nothing
was listening on :7788. Two separate causes:

- the backend simply was not running, and
- Vite bound [::1]:5173 while the proxy target was "localhost", which Node
  resolves to ::1 first. The Go server binds IPv4, so even with the backend up
  the proxy could fail before falling back.

- vite.config.ts: proxy target is now 127.0.0.1 explicitly and overridable via
  VELLUM_API; server.host is true so both stacks are served.
- scripts/dev.sh + `make dev`: builds the backend, waits for /healthz, starts
  Vite, and stops the backend on exit. Ctrl-C tears down both.
- README documents that running Vite alone needs the backend already up.
2026-10-10 16:32:32 -04:00

50 lines
1.1 KiB
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 build-go dev run test fmt vet tidy check docker clean
# Backend + Vite dev server together, with hot reload. Ctrl-C stops both.
dev:
./scripts/dev.sh
# 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