33 lines
1.2 KiB
PowerShell
33 lines
1.2 KiB
PowerShell
# Package frontend node_modules for offline development.
|
|
# Uses tar -h to dereference pnpm junctions so the archive is self-contained.
|
|
param(
|
|
[string]$OutputDir = (Join-Path (Split-Path $PSScriptRoot -Parent) "dist")
|
|
)
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
$Root = Split-Path $PSScriptRoot -Parent
|
|
$Frontend = Join-Path $Root "frontend-web"
|
|
$Archive = Join-Path $OutputDir "frontend-offline-deps.tar.gz"
|
|
|
|
if (-not (Test-Path (Join-Path $Frontend "node_modules\.pnpm"))) {
|
|
throw "frontend-web/node_modules is missing or incomplete. Run 'pnpm install' in frontend-web first."
|
|
}
|
|
|
|
New-Item -ItemType Directory -Force -Path $OutputDir | Out-Null
|
|
if (Test-Path $Archive) { Remove-Item $Archive -Force }
|
|
|
|
Write-Host "Packaging frontend dependencies..."
|
|
Write-Host " Source: $Frontend"
|
|
Write-Host " Output: $Archive"
|
|
|
|
$start = Get-Date
|
|
tar -czhf $Archive -C $Frontend node_modules package.json pnpm-lock.yaml
|
|
$elapsed = ((Get-Date) - $start).TotalSeconds
|
|
$sizeMb = [math]::Round((Get-Item $Archive).Length / 1MB, 2)
|
|
|
|
Write-Host ""
|
|
Write-Host "Done in ${elapsed}s — ${sizeMb} MB"
|
|
Write-Host ""
|
|
Write-Host "Copy to offline machine, then run:"
|
|
Write-Host " scripts\restore-frontend-offline-deps.ps1 -Archive <path-to-archive>"
|