.PHONY: build build-frontend build-backend dev clean

# Build everything: frontend first, then backend (which embeds frontend).
build: build-frontend build-backend

# Build the SvelteKit frontend to web/build/.
build-frontend:
	cd web && npm install && npm run build

# Build the Go binary (embeds web/build/ via go:embed).
build-backend:
	go build -o tinyforge ./cmd/server

# Run in development mode with hot reload.
# Requires air (go install github.com/air-verse/air@latest).
dev:
	air -c .air.toml 2>/dev/null || go run ./cmd/server

# Clean build artifacts.
clean:
	rm -rf web/build web/node_modules/.vite tinyforge
