JavaProjectRepo/scripts/sync-frontend.ps1

20 lines
669 B
PowerShell

Param(
[string]$Source = "framework/frontend",
[string]$Target = "business-css/frontend"
)
Write-Host "Sync frontend from '$Source' to '$Target'" -ForegroundColor Cyan
if (!(Test-Path $Target)) {
New-Item -ItemType Directory -Path $Target | Out-Null
}
# 同步除 node_modules/.git/.husky 外的所有文件,排除环境与锁文件
robocopy $Source $Target /MIR /XD node_modules .git .husky /XF .env* pnpm-lock.yaml npm-lock.yaml yarn.lock
# 可选:按需同步共享目录,避免覆盖业务自定义
if (Test-Path "$Source/src/shared") {
robocopy "$Source/src/shared" "$Target/src/shared" /MIR
}
Write-Host "Sync completed." -ForegroundColor Green