build: switch ui workflow to pnpm

This commit is contained in:
Jack O'Neill
2026-04-05 10:58:25 +02:00
parent f0d9c4dc09
commit a42274a770
6 changed files with 17 additions and 2204 deletions

2
.gitignore vendored
View File

@@ -33,4 +33,4 @@ bin/
OB1/
ui/node_modules/
ui/.svelte-kit/
internal/app/ui/dist
internal/app/ui/dist/

View File

@@ -1,12 +1,13 @@
FROM node:22-bookworm AS ui-builder
RUN npm install -g pnpm
WORKDIR /src/ui
COPY ui/package.json ui/package-lock.json ./
RUN npm ci
COPY ui/package.json ui/pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile
COPY ui/ ./
RUN npm run build
RUN pnpm run build
FROM golang:1.26.1-bookworm AS builder

View File

@@ -4,11 +4,11 @@ SERVER_BIN := $(BIN_DIR)/amcs-server
CMD_SERVER := ./cmd/amcs-server
BUILDINFO_PKG := git.warky.dev/wdevs/amcs/internal/buildinfo
UI_DIR := $(CURDIR)/ui
UI_DIST_DIR := $(CURDIR)/internal/app/ui/dist
PATCH_INCREMENT ?= 1
VERSION_TAG ?= $(shell git describe --tags --exact-match 2>/dev/null || echo dev)
COMMIT_SHA ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo unknown)
BUILD_DATE ?= $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
PNPM ?= pnpm
LDFLAGS := -s -w \
-X $(BUILDINFO_PKG).Version=$(VERSION_TAG) \
-X $(BUILDINFO_PKG).TagName=$(VERSION_TAG) \
@@ -24,16 +24,16 @@ build: ui-build
go build -ldflags "$(LDFLAGS)" -o $(SERVER_BIN) $(CMD_SERVER)
ui-install:
npm --prefix $(UI_DIR) ci
cd $(UI_DIR) && $(PNPM) install --frozen-lockfile
ui-build: ui-install
npm --prefix $(UI_DIR) run build
cd $(UI_DIR) && $(PNPM) run build
ui-dev: ui-install
npm --prefix $(UI_DIR) run dev
cd $(UI_DIR) && $(PNPM) run dev
ui-check: ui-install
npm --prefix $(UI_DIR) run check
cd $(UI_DIR) && $(PNPM) run check
test: ui-check
@mkdir -p $(GO_CACHE_DIR)

View File

@@ -535,10 +535,14 @@ Run the SQL migrations against a local database with:
The web UI now lives in the top-level `ui/` module and is embedded into the Go binary at build time with `go:embed`.
- `make build` — builds the Svelte/Tailwind frontend, then compiles the Go server
**Use `pnpm` for all UI work in this repo.**
- `make build` — runs the real UI build first, then compiles the Go server
- `make test` — runs `svelte-check` for the frontend and `go test ./...` for the backend
- `make ui-build` — builds only the frontend into `internal/app/ui/dist`
- `make ui-install` — installs frontend dependencies with `pnpm install --frozen-lockfile`
- `make ui-build` — builds only the frontend bundle
- `make ui-dev` — starts the Vite dev server with hot reload on `http://localhost:5173`
- `make ui-check` — runs the frontend type and Svelte checks
### Local UI workflow

2193
ui/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -2,6 +2,7 @@
"name": "amcs-ui",
"private": true,
"version": "0.0.0",
"packageManager": "pnpm@10.33.0",
"type": "module",
"scripts": {
"dev": "vite",