From a977a92729052214ca6a8428dc6c656eba9a50df Mon Sep 17 00:00:00 2001 From: SiYue <2835601846@qq.com> Date: Fri, 24 Apr 2026 16:40:06 +0800 Subject: [PATCH] build(web): avoid shell-expanding powershell vars in windows recipe - rewrite build-frontend Windows command without PowerShell local vars - keep install-stamp hash check logic --- Makefile | 17 ----------------- web/Makefile | 18 +----------------- 2 files changed, 1 insertion(+), 34 deletions(-) diff --git a/Makefile b/Makefile index 11adcef06..acb258370 100644 --- a/Makefile +++ b/Makefile @@ -9,11 +9,6 @@ EXT= ifeq ($(OS),Windows_NT) POWERSHELL=powershell -NoProfile -Command -<<<<<<< HEAD -======= - GO=go - WEB_GO=go ->>>>>>> 83c79087 (Fix Windows build flow) WINDOWS_GOARCH_RAW:=$(strip $(shell go env GOARCH 2>NUL)) endif @@ -45,10 +40,7 @@ GOFLAGS?=-v -tags $(GO_BUILD_TAGS) GOCACHE?=$(CURDIR)/.cache/go-build GOMODCACHE?=$(CURDIR)/.cache/go-mod GOTOOLCHAIN?=local -<<<<<<< HEAD export CGO_ENABLED -======= ->>>>>>> 83c79087 (Fix Windows build flow) export GOCACHE export GOMODCACHE export GOTOOLCHAIN @@ -215,16 +207,7 @@ build-launcher: @echo "Building picoclaw-launcher for $(PLATFORM)/$(ARCH)..." ifeq ($(OS),Windows_NT) @$(POWERSHELL) "New-Item -ItemType Directory -Force -Path '$(BUILD_DIR)' | Out-Null" -<<<<<<< HEAD @$(MAKE) -C web build PLATFORM="$(PLATFORM)" ARCH="$(ARCH)" EXT="$(EXT)" OUTPUT="$(CURDIR)/$(BUILD_DIR)/picoclaw-launcher-$(PLATFORM)-$(ARCH)$(EXT)" GO_BUILD_TAGS="$(GO_BUILD_TAGS)" -======= - @$(MAKE) -C web build \ - PLATFORM="$(PLATFORM)" \ - ARCH="$(ARCH)" \ - EXT="$(EXT)" \ - OUTPUT="$(CURDIR)/$(BUILD_DIR)/picoclaw-launcher-$(PLATFORM)-$(ARCH)$(EXT)" \ - GO_BUILD_TAGS="$(GO_BUILD_TAGS)" ->>>>>>> 83c79087 (Fix Windows build flow) @$(POWERSHELL) "Copy-Item -LiteralPath '$(BUILD_DIR)/picoclaw-launcher-$(PLATFORM)-$(ARCH)$(EXT)' -Destination '$(BUILD_DIR)/picoclaw-launcher$(EXT)' -Force" else @mkdir -p $(BUILD_DIR) diff --git a/web/Makefile b/web/Makefile index 5580827bb..254c439e9 100644 --- a/web/Makefile +++ b/web/Makefile @@ -10,10 +10,7 @@ GOFLAGS?=-v -tags $(GO_BUILD_TAGS) GOCACHE?=$(abspath ../.cache/go-build) GOMODCACHE?=$(abspath ../.cache/go-mod) GOTOOLCHAIN?=local -<<<<<<< HEAD export CGO_ENABLED -======= ->>>>>>> 83c79087 (Fix Windows build flow) export GOCACHE export GOMODCACHE export GOTOOLCHAIN @@ -33,11 +30,6 @@ LAUNCHER_GUI_LDFLAG= ifeq ($(OS),Windows_NT) POWERSHELL=powershell -NoProfile -Command -<<<<<<< HEAD -======= - GO=go - WEB_GO=go ->>>>>>> 83c79087 (Fix Windows build flow) WINDOWS_GOARCH_RAW:=$(strip $(shell go env GOARCH 2>NUL)) endif @@ -172,21 +164,13 @@ endif build-frontend: ifeq ($(OS),Windows_NT) -<<<<<<< HEAD - @$(POWERSHELL) "$$frontend='$(FRONTEND_DIR)'; $$stamp='$(FRONTEND_INSTALL_STAMP)'; $$pkg='$(FRONTEND_DIR)/package.json'; $$lock='$(FRONTEND_DIR)/pnpm-lock.yaml'; $$expected=((Get-FileHash -LiteralPath $$pkg -Algorithm SHA256).Hash + ':' + (Get-FileHash -LiteralPath $$lock -Algorithm SHA256).Hash); $$nodeModules=$$frontend + '/node_modules'; $$tsc=$$nodeModules + '/.bin/tsc'; $$current=''; if (Test-Path -LiteralPath $$stamp) { $$current=(Get-Content -LiteralPath $$stamp -Raw).Trim() }; if ((-not (Test-Path -LiteralPath $$nodeModules)) -or (-not (Test-Path -LiteralPath $$tsc)) -or ($$current -ne $$expected)) { Write-Host 'Installing frontend dependencies...'; Push-Location $$frontend; try { $$env:CI='true'; pnpm install --frozen-lockfile } finally { Pop-Location; Remove-Item Env:CI -ErrorAction SilentlyContinue }; Set-Content -LiteralPath $$stamp -Value $$expected -NoNewline }" + @$(POWERSHELL) "if ((-not (Test-Path -LiteralPath '$(FRONTEND_DIR)/node_modules')) -or (-not (Test-Path -LiteralPath '$(FRONTEND_DIR)/node_modules/.bin/tsc')) -or (-not (Test-Path -LiteralPath '$(FRONTEND_INSTALL_STAMP)')) -or ((Get-Content -LiteralPath '$(FRONTEND_INSTALL_STAMP)' -Raw).Trim() -ne (((Get-FileHash -LiteralPath '$(FRONTEND_DIR)/package.json' -Algorithm SHA256).Hash + ':' + (Get-FileHash -LiteralPath '$(FRONTEND_DIR)/pnpm-lock.yaml' -Algorithm SHA256).Hash)))) { Write-Host 'Installing frontend dependencies...'; Push-Location '$(FRONTEND_DIR)'; try { pnpm install --frozen-lockfile } finally { Pop-Location }; Set-Content -LiteralPath '$(FRONTEND_INSTALL_STAMP)' -Value (((Get-FileHash -LiteralPath '$(FRONTEND_DIR)/package.json' -Algorithm SHA256).Hash + ':' + (Get-FileHash -LiteralPath '$(FRONTEND_DIR)/pnpm-lock.yaml' -Algorithm SHA256).Hash)) -NoNewline }" else @expected_stamp="$$(cat $(FRONTEND_DIR)/package.json $(FRONTEND_DIR)/pnpm-lock.yaml | cksum | awk '{print $$1 ":" $$2}')"; \ if [ ! -d $(FRONTEND_DIR)/node_modules ] || \ [ ! -x $(FRONTEND_DIR)/node_modules/.bin/tsc ] || \ [ ! -f $(FRONTEND_INSTALL_STAMP) ] || \ [ "$$(cat $(FRONTEND_INSTALL_STAMP) 2>/dev/null)" != "$$expected_stamp" ]; then \ -======= - @if not exist "$(FRONTEND_DIR)\node_modules" (echo Installing frontend dependencies... && cd $(FRONTEND_DIR) && pnpm install --frozen-lockfile --store-dir .pnpm-store) else echo Frontend dependencies already installed. -else - @if [ ! -d $(FRONTEND_DIR)/node_modules ] || \ - [ $(FRONTEND_DIR)/package.json -nt $(FRONTEND_DIR)/node_modules ] || \ - [ $(FRONTEND_DIR)/pnpm-lock.yaml -nt $(FRONTEND_DIR)/node_modules ]; then \ ->>>>>>> 83c79087 (Fix Windows build flow) echo "Installing frontend dependencies..."; \ (cd $(FRONTEND_DIR) && CI=true pnpm install --frozen-lockfile) && \ printf '%s\n' "$$expected_stamp" > $(FRONTEND_INSTALL_STAMP); \