From 7d48ab6e85ca2835c2c2462f10c2c9378752a12e Mon Sep 17 00:00:00 2001 From: Tom Butcher Date: Mon, 3 Aug 2026 01:15:02 +0100 Subject: [PATCH] Update Windows installer and build scripts to transition from deeplink.exe to deeplink.js - Modified the Windows installer script to change the command for the farmcontrol URI handler from `deeplink.exe` to `bun.exe` executing `deeplink.js`, improving the handling of deep links. - Updated the build script to output `deeplink.js` instead of `deeplink.exe`, aligning with the new execution method. - Adjusted the PowerShell script to check for the presence of `deeplink.js` instead of `deeplink.exe`, ensuring the correct file is validated during the staging process. - Refined the patching script to remove references to `deeplink.exe`, streamlining the target executables for patching. --- packaging/windows/installer.nsh | 2 +- scripts/build-windows-deeplink.mjs | 5 ++--- scripts/build-windows-nsis.ps1 | 6 +++--- scripts/patch-windows-binaries.mjs | 2 +- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/packaging/windows/installer.nsh b/packaging/windows/installer.nsh index 4fd380c..0e5fb91 100644 --- a/packaging/windows/installer.nsh +++ b/packaging/windows/installer.nsh @@ -85,7 +85,7 @@ WriteRegStr HKCR "farmcontrol\DefaultIcon" "" "$INSTDIR\bin\launcher.exe" WriteRegStr HKCR "farmcontrol\shell" "" "" WriteRegStr HKCR "farmcontrol\shell\Open" "" "" - WriteRegStr HKCR "farmcontrol\shell\Open\command" "" '"$INSTDIR\bin\deeplink.exe" "%1"' + WriteRegStr HKCR "farmcontrol\shell\Open\command" "" '"$INSTDIR\bin\bun.exe" "$INSTDIR\bin\deeplink.js" "%1"' DetailPrint "Creating shortcuts" !insertmacro createDesktopShortcut diff --git a/scripts/build-windows-deeplink.mjs b/scripts/build-windows-deeplink.mjs index c208ca3..5a1b05f 100644 --- a/scripts/build-windows-deeplink.mjs +++ b/scripts/build-windows-deeplink.mjs @@ -11,16 +11,15 @@ export function stageWindowsDeeplink(appDir) { throw new Error(`stage-windows-deeplink: entrypoint not found: ${entrypoint}`) } - const outputPath = path.join(appDir, 'bin', 'deeplink.exe') + const outputPath = path.join(appDir, 'bin', 'deeplink.js') mkdirSync(path.dirname(outputPath), { recursive: true }) const result = spawnSync( 'bun', [ 'build', - '--compile', '--minify', - '--target=bun-windows-x64', + '--target=bun', entrypoint, '--outfile', outputPath diff --git a/scripts/build-windows-nsis.ps1 b/scripts/build-windows-nsis.ps1 index 87ee010..7f5270d 100644 --- a/scripts/build-windows-nsis.ps1 +++ b/scripts/build-windows-nsis.ps1 @@ -71,12 +71,12 @@ if ($stagedAppBytes -lt 5242880) { } $requiredExe = Join-Path $stagingAppDir "bin\launcher.exe" -$requiredDeeplinkExe = Join-Path $stagingAppDir "bin\deeplink.exe" +$requiredDeeplinkScript = Join-Path $stagingAppDir "bin\deeplink.js" if (-not (Test-Path $requiredExe)) { throw "Staged application is missing bin\launcher.exe" } -if (-not (Test-Path $requiredDeeplinkExe)) { - throw "Staged application is missing bin\deeplink.exe" +if (-not (Test-Path $requiredDeeplinkScript)) { + throw "Staged application is missing bin\deeplink.js" } Copy-Item -LiteralPath $nsiPath -Destination (Join-Path $workDir "farmcontrol.nsi") diff --git a/scripts/patch-windows-binaries.mjs b/scripts/patch-windows-binaries.mjs index 41085bc..6df9528 100644 --- a/scripts/patch-windows-binaries.mjs +++ b/scripts/patch-windows-binaries.mjs @@ -3,7 +3,7 @@ import path from 'node:path' import { fileURLToPath } from 'node:url' import rcedit from 'rcedit' -const PATCH_TARGETS = new Set(['launcher.exe', 'deeplink.exe']) +const PATCH_TARGETS = new Set(['launcher.exe']) export async function patchWindowsBinaries(appDir) { if (process.platform !== 'win32') {