Optimize Windows deployment scripts: build cache, console integration, and .env.example handling

Build-ROA2WEB.ps1 improvements:
- Add intelligent npm node_modules caching (saves 2-5 minutes on repeated builds)
- Cache stored outside deploy-package in .build-cache/ directory
- Add Clean Cache menu option ([C]) and -CleanCache parameter
- Include ROA2WEB-Console.ps1 in deployment package
- Update README workflow to use unified console (interactive and CLI modes)
- Remove obsolete script references (Manage-ROA2WEB.ps1, Deploy-*.ps1)
- Fix .env.example copying for backend and telegram-bot (copy from source instead of hardcoded template)

ROA2WEB-Console.ps1 improvements:
- Fix PowerShell parsing error: ${ComponentName}: instead of $ComponentName:
- Add .env.example copying in Update-BackendFiles function
- Add .env.example copying in Update-TelegramBotFiles function
- Keep .env.example synchronized with development templates

.gitignore:
- Add .build-cache/ to prevent committing npm cache directory

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-12 02:04:31 +02:00
parent 1832684aca
commit 016c309d70
3 changed files with 214 additions and 61 deletions

View File

@@ -459,7 +459,7 @@ function Show-ServiceStatus {
$service = Get-ServiceSafe -ServiceName $ServiceName
Write-Host "`n$ComponentName:" -ForegroundColor Cyan
Write-Host "`n${ComponentName}:" -ForegroundColor Cyan
Write-Host " Service Name: $ServiceName" -ForegroundColor Gray
if ($service) {
@@ -633,6 +633,14 @@ function Update-BackendFiles {
Write-Success "Backend files updated"
# Copy .env.example explicitly (excluded from recursive copy)
$sourceEnvExample = Join-Path $sourceBackend ".env.example"
$destEnvExample = Join-Path $Config.BackendPath ".env.example"
if (Test-Path $sourceEnvExample) {
Copy-Item -Path $sourceEnvExample -Destination $destEnvExample -Force
Write-Success ".env.example template updated"
}
# Check if requirements.txt changed
$sourceReq = Join-Path $sourceBackend "requirements.txt"
$destReq = Join-Path $Config.BackendPath "requirements.txt"
@@ -743,12 +751,19 @@ function Update-TelegramBotFiles {
}
}
# Preserve .env file
# Copy .env.example template (always update to keep in sync)
$sourceEnvExample = Join-Path $Config.SourcePath ".env.example"
$destEnvExample = Join-Path $Config.TelegramBotPath ".env.example"
if (Test-Path $sourceEnvExample) {
Copy-Item -Path $sourceEnvExample -Destination $destEnvExample -Force
Write-Success ".env.example template updated"
}
# Preserve .env file (or create from .env.example if missing)
$envFile = Join-Path $Config.TelegramBotPath ".env"
if (-not (Test-Path $envFile)) {
$sourceEnv = Join-Path $Config.SourcePath ".env.example"
if (Test-Path $sourceEnv) {
Copy-Item -Path $sourceEnv -Destination $envFile -Force
if (Test-Path $sourceEnvExample) {
Copy-Item -Path $sourceEnvExample -Destination $envFile -Force
Write-Warning "Created .env from .env.example - PLEASE CONFIGURE"
}
} else {