# 写入 frontend-web/config/version.js(start.bat / sync-config 自动调用,发版上传前也会更新) param([string]$Version = '') $ErrorActionPreference = 'Stop' $Root = Split-Path $PSScriptRoot -Parent $WebRoot = Join-Path $Root 'frontend-web' if (-not $Version) { Push-Location $Root try { $Version = (git rev-parse --short HEAD 2>$null) } finally { Pop-Location } if (-not $Version) { $Version = Get-Date -Format 'yyyyMMddHHmmss' } } $out = @" (function () { 'use strict'; window.SOON_APP_VERSION = '$Version'; })(); "@ $path = Join-Path $WebRoot 'config\version.js' [System.IO.File]::WriteAllText($path, $out, (New-Object System.Text.UTF8Encoding $false))