diff --git a/studio/setup.ps1 b/studio/setup.ps1 index 2420448deb..9f152aa477 100644 --- a/studio/setup.ps1 +++ b/studio/setup.ps1 @@ -748,8 +748,11 @@ Write-Host "" # ========================================================================== # PHASE 2: Frontend build (skip if pip-installed -- already bundled) # ========================================================================== +$DistDir = Join-Path $FrontendDir "dist" if ($IsPipInstall) { Write-Host "[OK] Running from pip install - frontend already bundled, skipping build" -ForegroundColor Green +} elseif (Test-Path $DistDir) { + Write-Host "[OK] Frontend already built (frontend/dist exists). To rebuild, delete frontend/dist and re-run setup." -ForegroundColor Green } else { Write-Host "" Write-Host "Building frontend..." -ForegroundColor Cyan @@ -758,9 +761,6 @@ if ($IsPipInstall) { $prevEAP_npm = $ErrorActionPreference $ErrorActionPreference = "Continue" Push-Location $FrontendDir - # Remove stale node_modules and package-lock.json to avoid version conflicts - if (Test-Path "node_modules") { Remove-Item -Recurse -Force "node_modules" } - if (Test-Path "package-lock.json") { Remove-Item -Force "package-lock.json" } npm install 2>&1 | Out-Null if ($LASTEXITCODE -ne 0) { Pop-Location diff --git a/studio/setup.sh b/studio/setup.sh index 4c8a6c7dde..7070b8a089 100755 --- a/studio/setup.sh +++ b/studio/setup.sh @@ -41,13 +41,10 @@ if [[ "$keynames" == *$'\nCOLAB_'* ]]; then fi # ── Detect whether frontend needs building ── -# Only skip when BOTH conditions are true: -# 1. We're inside site-packages (PyPI / pip install, not editable) -# 2. dist/ already exists (pre-built in the wheel) -# Otherwise always (re)build — handles upgrades, editable installs, and -# pip-from-source where dist/ was never built. -if [[ "$SCRIPT_DIR" == */site-packages/* ]] && [ -d "$SCRIPT_DIR/frontend/dist" ]; then - echo "✅ Frontend pre-built (PyPI) — skipping Node/npm check." +# Skip frontend build if dist/ already exists (PyPI wheel, previous build, etc.) +# To force a rebuild, delete frontend/dist and re-run setup. +if [ -d "$SCRIPT_DIR/frontend/dist" ]; then + echo "✅ Frontend already built (frontend/dist exists) -- skipping Node/npm check." else NEED_NODE=true if command -v node &>/dev/null && command -v npm &>/dev/null; then