Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: web web-dev pnpm-check build clean test test-db test-e2e fmt lint docker-build run
.PHONY: web web-dev build clean test test-db test-e2e fmt lint docker-build run

BINARY ?= code-review-console
IMAGE ?= ghcr.io/divmora/code-review-console
Expand All @@ -11,20 +11,21 @@ BOT_DIR ?= ../code-review-bot
# build it first when it's missing (`make web` rebuilds it after changes).
UI_INDEX := internal/admin/ui/index.html

# pnpm: the release web/package.json pins in packageManager, e.g.
# npm install -g "$(node -p "require('./web/package.json').packageManager")"
web: pnpm-check
@cd web && pnpm install --frozen-lockfile && pnpm run build
# pnpm: the one on PATH (it switches itself to the release web/package.json
# pins in packageManager), else that release run with npx, so `make web`
# works anywhere Node.js and npm are installed, including GoReleaser's
# release job, which has no pnpm.
PNPM := $(shell command -v pnpm >/dev/null 2>&1 && echo pnpm || echo "npx --yes $$(node -p "require('./web/package.json').packageManager")")

pnpm-check:
@command -v pnpm >/dev/null || { echo "pnpm not found: install the release web/package.json pins (packageManager) with npm install -g" >&2; exit 1; }
web:
@cd web && $(PNPM) install --frozen-lockfile && $(PNPM) run build

$(UI_INDEX):
@$(MAKE) --no-print-directory web

# Vite dev server on :5173, proxying the API to a console on :8080.
web-dev: pnpm-check
@cd web && pnpm run dev
web-dev:
@cd web && $(PNPM) run dev

build: $(UI_INDEX)
@go build -trimpath -ldflags "$(LDFLAGS)" -o bin/$(BINARY) ./cmd/console
Expand Down
Loading