fix(release): write package.json as UTF-8 without BOM
Some checks failed
CI / Typecheck + Tests (push) Has been cancelled
CI / Build (Windows) (push) Has been cancelled

PS5.1 Get-Content -Raw without -Encoding utf8 reads in CP1251, mangling
non-ASCII like em-dash. Set-Content -Encoding utf8 writes a BOM that
breaks PostCSS / electron-builder reads of package.json.

Use .NET ReadAllText/WriteAllText with UTF8Encoding(false) to guarantee
roundtrip-safe UTF-8 without BOM.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
AnRil
2026-05-18 15:25:04 +07:00
parent f861af5db1
commit 33e237948e

View File

@@ -106,9 +106,15 @@ if ($DryRun) {
} }
# --- Bump package.json -------------------------------------------------- # --- Bump package.json --------------------------------------------------
# IMPORTANT: read+write as UTF-8 WITHOUT BOM. PS5.1 defaults will (a) read the
# file as CP1251 and mangle non-ASCII chars like em-dash, and (b) write back
# with a BOM that breaks PostCSS / electron-builder reads of package.json.
Write-Host "Bumping package.json to $next..." -ForegroundColor Cyan Write-Host "Bumping package.json to $next..." -ForegroundColor Cyan
$pkgJson = (Get-Content package.json -Raw) -replace "`"version`":\s*`"$current`"", "`"version`": `"$next`"" $pkgPath = Join-Path $root 'package.json'
Set-Content -Path package.json -Value $pkgJson -NoNewline -Encoding utf8 $utf8NoBom = New-Object System.Text.UTF8Encoding $false
$pkgJson = [System.IO.File]::ReadAllText($pkgPath, $utf8NoBom)
$pkgJson = $pkgJson -replace "`"version`":\s*`"$current`"", "`"version`": `"$next`""
[System.IO.File]::WriteAllText($pkgPath, $pkgJson, $utf8NoBom)
git add package.json git add package.json
git commit -m "chore(release): $tag" git commit -m "chore(release): $tag"