diff --git a/scripts/release.ps1 b/scripts/release.ps1 index c6b4b2a..5c7dbb2 100644 --- a/scripts/release.ps1 +++ b/scripts/release.ps1 @@ -106,9 +106,15 @@ if ($DryRun) { } # --- 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 -$pkgJson = (Get-Content package.json -Raw) -replace "`"version`":\s*`"$current`"", "`"version`": `"$next`"" -Set-Content -Path package.json -Value $pkgJson -NoNewline -Encoding utf8 +$pkgPath = Join-Path $root 'package.json' +$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 commit -m "chore(release): $tag"