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,17 +534,20 @@ if ($dryrun -or $buildonly -or $release.assets_url -imatch '^https:') {
exit 1 exit 1
} }
} }
# Adding BOM to procution bundle # Adding BOM to some files
$bundleFile = "$PSScriptRoot/../dist/www/js/bundle.min.js" $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 $bundle = Get-Content -encoding "UTF8" $bundleFile
if ($bundle -match "^(?!\xEF\xBB\xBF)") { if ($bundle -match "^(?!\xEF\xBB\xBF)") {
Write-Host "Adding missing BOM to production bundle!`n" -ForegroundColor Yellow Write-Host "Adding missing BOM to bundle file $bundleFile`n" -ForegroundColor Yellow
if (-not $dryrun) { if (-not $dryrun) {
$bundle | Set-Content -encoding "utf8BOM" $bundleFile $bundle | Set-Content -encoding "utf8BOM" $bundleFile
} else { } else {
"[DRYRUN] Would have added BOM to $bundleFile" "[DRYRUN] Would have added BOM to $bundleFile"
} }
} }
}
if (-not $dryrun) { if (-not $dryrun) {
$projstub = $text_tag $projstub = $text_tag