# Restore frontend node_modules from an offline dependency archive. param( [Parameter(Mandatory = $true)] [string]$Archive ) $ErrorActionPreference = "Stop" $Root = Split-Path $PSScriptRoot -Parent $Frontend = Join-Path $Root "frontend-web" if (-not (Test-Path $Archive)) { throw "Archive not found: $Archive" } Write-Host "Restoring frontend dependencies to $Frontend ..." # Back up existing node_modules if present $backup = Join-Path $Frontend "node_modules.bak" if (Test-Path (Join-Path $Frontend "node_modules")) { if (Test-Path $backup) { Remove-Item $backup -Recurse -Force } Rename-Item (Join-Path $Frontend "node_modules") "node_modules.bak" Write-Host " Existing node_modules backed up to node_modules.bak" } tar -xzf $Archive -C $Frontend # Quick sanity check $required = @( "node_modules\.pnpm", "node_modules\react\package.json", "node_modules\vite\package.json" ) foreach ($rel in $required) { if (-not (Test-Path (Join-Path $Frontend $rel))) { throw "Restore incomplete — missing $rel" } } Write-Host "" Write-Host "Restore complete. You can now run:" Write-Host " cd frontend-web" Write-Host " pnpm dev"