From 0d41b245b9e890c73bf6519497bc4fb079033b22 Mon Sep 17 00:00:00 2001 From: Nitin Goyal Date: Tue, 1 Dec 2026 01:15:10 +0530 Subject: [PATCH] fix(build): run the pinned pnpm with npx when pnpm isn't installed GoReleaser's release job runs make web with only the runner's Node and npm, so the v0.16.0 release failed with "pnpm not found" and has no binaries. make web and web-dev now use the pnpm on PATH, else the release web/package.json pins run with npx. Co-Authored-By: Claude Opus 5.5 --- Makefile | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 8f15049..5183506 100644 --- a/Makefile +++ b/Makefile @@ -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 @@ -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