From 3c4dc329d006a12992e2727ef3b211965312ecf8 Mon Sep 17 00:00:00 2001 From: Tom Butcher Date: Tue, 4 Aug 2026 01:15:29 +0100 Subject: [PATCH] Remove MSI installer support and related scripts - Deleted the `msiWrapped` configuration from `package.json` and removed the associated `msi-wrapped.wxs` file to streamline the packaging process. - Eliminated the `build-windows-msi.ps1` script, which was previously used for generating MSI installers, as part of the transition to a simpler installation method. - Updated the `finalize-desktop-artifacts.mjs` script to remove references to the MSI build process, ensuring a cleaner artifact finalization workflow. --- package.json | 9 +- packaging/windows/msi-wrapped.wxs | 159 ------------------------- scripts/build-windows-msi.ps1 | 130 -------------------- scripts/finalize-desktop-artifacts.mjs | 48 +------- 4 files changed, 4 insertions(+), 342 deletions(-) delete mode 100644 packaging/windows/msi-wrapped.wxs delete mode 100644 scripts/build-windows-msi.ps1 diff --git a/package.json b/package.json index bf0c979..b7746f3 100644 --- a/package.json +++ b/package.json @@ -226,8 +226,7 @@ }, "win": { "target": [ - "nsis", - "msiWrapped" + "nsis" ], "protocols": [ { @@ -246,12 +245,6 @@ "allowToChangeInstallationDirectory": true, "include": "scripts/installer.nsh", "perMachine": false - }, - "msiWrapped": { - "upgradeCode": "{735812DB-E33B-57A0-8FBC-5FC3155925AA}", - "perMachine": false, - "impersonate": true, - "wrappedInstallerArgs": "/S" } } } diff --git a/packaging/windows/msi-wrapped.wxs b/packaging/windows/msi-wrapped.wxs deleted file mode 100644 index 8092190..0000000 --- a/packaging/windows/msi-wrapped.wxs +++ /dev/null @@ -1,159 +0,0 @@ - - - - - - - = 601]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - NOT Installed - NOT Installed - - NOT Installed AND PREVIOUS_UNINSTALL_CMD - NOT Installed AND NOT PREVIOUS_UNINSTALL_CMD AND PREVIOUS_UNINSTALL_CMD_LEGACY - NOT Installed AND NOT PREVIOUS_UNINSTALL_CMD AND NOT PREVIOUS_UNINSTALL_CMD_LEGACY AND PREVIOUS_INSTALL_DIR - NOT Installed AND NOT PREVIOUS_UNINSTALL_CMD AND NOT PREVIOUS_UNINSTALL_CMD_LEGACY AND NOT PREVIOUS_INSTALL_DIR AND PREVIOUS_INSTALL_DIR_LEGACY - - NOT Installed AND (PREVIOUS_UNINSTALL_CMD OR PREVIOUS_UNINSTALL_CMD_LEGACY OR PREVIOUS_INSTALL_DIR OR PREVIOUS_INSTALL_DIR_LEGACY) - NOT Installed - - - diff --git a/scripts/build-windows-msi.ps1 b/scripts/build-windows-msi.ps1 deleted file mode 100644 index b8051d2..0000000 --- a/scripts/build-windows-msi.ps1 +++ /dev/null @@ -1,130 +0,0 @@ -param( - [Parameter(Mandatory = $true)] - [string]$SetupExe, - - [Parameter(Mandatory = $true)] - [string]$OutputMsi, - - [Parameter(Mandatory = $true)] - [string]$Version, - - [string]$UpgradeCode = "735812DB-E33B-57A0-8FBC-5FC3155925AA" -) - -$ErrorActionPreference = "Stop" - -function Get-MsiVersion { - param([string]$InputVersion) - - $parts = $InputVersion.Split(".") - while ($parts.Count -lt 4) { - $parts += "0" - } - - return ($parts[0..3] -join ".") -} - -function Find-WixToolset { - $searchRoots = @( - $env:WIX, - $env:WIX_TOOLSET_PATH, - "${env:ProgramFiles(x86)}\WiX Toolset v3.14\bin", - "${env:ProgramFiles}\WiX Toolset v3.14\bin", - "${env:ProgramFiles(x86)}\WiX Toolset v3.11\bin", - "${env:ProgramFiles}\WiX Toolset v3.11\bin" - ) - - foreach ($root in $searchRoots) { - if (-not $root) { - continue - } - - $candle = Join-Path $root "candle.exe" - $light = Join-Path $root "light.exe" - if ((Test-Path $candle) -and (Test-Path $light)) { - return @{ - Candle = $candle - Light = $light - } - } - } - - $candleCommand = Get-Command candle.exe -ErrorAction SilentlyContinue - $lightCommand = Get-Command light.exe -ErrorAction SilentlyContinue - if ($candleCommand -and $lightCommand) { - return @{ - Candle = $candleCommand.Source - Light = $lightCommand.Source - } - } - - throw @" -WiX Toolset not found. Install WiX Toolset 3.11+ on the Windows build agent and ensure candle.exe and light.exe are on PATH. -Example: choco install wixtoolset --version=3.14.0.4118 -"@ -} - -function Escape-WixSourcePath { - param([string]$Path) - - return $Path.Replace("\", "\\") -} - -$rootDir = Split-Path -Parent $PSScriptRoot -$templatePath = Join-Path $rootDir "packaging/windows/msi-wrapped.wxs" -$workDir = Join-Path $env:TEMP "farmcontrol-wix" -$wix = Find-WixToolset - -if (Test-Path $workDir) { - Remove-Item $workDir -Recurse -Force -} -New-Item -ItemType Directory -Path $workDir | Out-Null - -$setupExePath = (Resolve-Path -LiteralPath $SetupExe).Path -$outputMsiPath = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($OutputMsi) -$outputDir = Split-Path $outputMsiPath -Parent -if ($outputDir -and -not (Test-Path $outputDir)) { - New-Item -ItemType Directory -Path $outputDir -Force | Out-Null -} - -$installerIconPath = Join-Path $rootDir "assets\installer.ico" -if (-not (Test-Path $installerIconPath)) { - throw "Installer icon not found at $installerIconPath. Run 'bun run generate-app-icons' first." -} - -$installerIconWorkPath = Join-Path $workDir "installer.ico" -Copy-Item -LiteralPath $installerIconPath -Destination $installerIconWorkPath -Force - -$msiVersion = Get-MsiVersion $Version -$wxsContent = Get-Content -LiteralPath $templatePath -Raw -$wxsContent = $wxsContent.Replace("__UPGRADE_CODE__", $UpgradeCode) -$wxsContent = $wxsContent.Replace("__VERSION__", $msiVersion) -$wxsContent = $wxsContent.Replace("__SETUP_EXE__", (Escape-WixSourcePath $setupExePath)) -$wxsContent = $wxsContent.Replace("__INSTALLER_ICON__", (Escape-WixSourcePath $installerIconWorkPath)) - -$projectWxs = Join-Path $workDir "project.wxs" -Set-Content -LiteralPath $projectWxs -Value $wxsContent -Encoding UTF8 - -$wixObj = Join-Path $workDir "project.wixobj" - -Push-Location $workDir -try { - & $wix.Candle "-arch" "x64" "-ext" "WixUtilExtension" $projectWxs - if ($LASTEXITCODE -ne 0) { - throw "candle.exe failed with exit code $LASTEXITCODE" - } - - & $wix.Light "-out" $outputMsiPath "-spdb" "-sw1076" "-ext" "WixUtilExtension" $wixObj - if ($LASTEXITCODE -ne 0) { - throw "light.exe failed with exit code $LASTEXITCODE" - } -} finally { - Pop-Location - Remove-Item $workDir -Recurse -Force -} - -if (-not (Test-Path $outputMsiPath)) { - throw "MSI installer was not created at $outputMsiPath" -} - -Write-Host "Created MSI installer at $outputMsiPath" diff --git a/scripts/finalize-desktop-artifacts.mjs b/scripts/finalize-desktop-artifacts.mjs index 077fa46..2a970ec 100644 --- a/scripts/finalize-desktop-artifacts.mjs +++ b/scripts/finalize-desktop-artifacts.mjs @@ -20,6 +20,7 @@ import { expandWindowsAppFromArchive } from './expand-windows-installer.mjs' import { stageWindowsDeeplink } from './build-windows-deeplink.mjs' +import { patchWindowsBinaries } from './patch-windows-binaries.mjs' import { codesignMacAppBundle } from './codesign-macos-app.mjs' const rootDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..') @@ -572,50 +573,6 @@ function buildWindowsNsis(appDir, arch) { return exePath } -function buildWindowsMsi(setupExePath, arch) { - const scriptPath = path.join(rootDir, 'scripts/build-windows-msi.ps1') - const msiPath = path.join( - artifactDir, - getReleaseArtifactName(version, arch, 'msi') - ) - const powershell = process.env.SystemRoot - ? path.join( - process.env.SystemRoot, - 'System32', - 'WindowsPowerShell', - 'v1.0', - 'powershell.exe' - ) - : 'powershell.exe' - - const result = spawnSync( - powershell, - [ - '-NoProfile', - '-ExecutionPolicy', - 'Bypass', - '-File', - scriptPath, - '-SetupExe', - setupExePath, - '-OutputMsi', - msiPath, - '-Version', - version - ], - { stdio: 'inherit' } - ) - - if (result.status !== 0) { - throw new Error( - `build-windows-msi.ps1 failed with exit code ${result.status ?? 1}` - ) - } - - console.log(`Published ${msiPath}`) - return msiPath -} - if (buildEnv === 'dev') { console.log('finalize-desktop-artifacts: skipping dev build') process.exit(0) @@ -662,11 +619,12 @@ async function main() { platformDir ) stageWindowsDeeplinkScript(appDir) + await patchWindowsBinaries(appDir) let published try { const setupExe = buildWindowsNsis(appDir, arch) - published = [setupExe, buildWindowsMsi(setupExe, arch)] + published = [setupExe] if (installerFiles.setupZip) { published.push(publishArtifact(installerFiles.setupZip, arch, 'zip'))