From 259db7ac07dac39acb76e80c7de07b82977d039c Mon Sep 17 00:00:00 2001 From: Jaifroid Date: Fri, 22 Dec 2023 08:57:33 +0000 Subject: [PATCH] Update Create-DraftRelease.ps1 --- scripts/Create-DraftRelease.ps1 | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/scripts/Create-DraftRelease.ps1 b/scripts/Create-DraftRelease.ps1 index f7eb22ac..f8221366 100644 --- a/scripts/Create-DraftRelease.ps1 +++ b/scripts/Create-DraftRelease.ps1 @@ -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) {