Update Create-DraftRelease.ps1

This commit is contained in:
Jaifroid 2023-12-22 08:57:33 +00:00
parent 52da0b5c3e
commit 259db7ac07

View File

@ -534,16 +534,19 @@ if ($dryrun -or $buildonly -or $release.assets_url -imatch '^https:') {
exit 1
}
}
# Adding BOM to procution bundle
$bundleFile = "$PSScriptRoot/../dist/www/js/bundle.min.js"
$bundle = Get-Content -encoding "UTF8" $bundleFile
if ($bundle -match "^(?!\xEF\xBB\xBF)") {
Write-Host "Adding missing BOM to production bundle!`n" -ForegroundColor Yellow
if (-not $dryrun) {
$bundle | Set-Content -encoding "utf8BOM" $bundleFile
} else {
"[DRYRUN] Would have added BOM to $bundleFile"
}
# Adding BOM to some files
$bundleFiles = @("$PSScriptRoot/../dist/www/js/bundle.min.js", "$PSScriptRoot/../dist/service-worker.js", "$PSScriptRoot/../dist/replayWorker.js")
# Add BOM to each file if it doesn't already have one
foreach ($bundleFile in $bundleFiles) {
$bundle = Get-Content -encoding "UTF8" $bundleFile
if ($bundle -match "^(?!\xEF\xBB\xBF)") {
Write-Host "Adding missing BOM to bundle file $bundleFile`n" -ForegroundColor Yellow
if (-not $dryrun) {
$bundle | Set-Content -encoding "utf8BOM" $bundleFile
} else {
"[DRYRUN] Would have added BOM to $bundleFile"
}
}
}
if (-not $dryrun) {