Update Windows installer and deeplink handling
All checks were successful
farmcontrol/farmcontrol-ui/pipeline/head This commit looks good
All checks were successful
farmcontrol/farmcontrol-ui/pipeline/head This commit looks good
- Changed the default icon reference in the Windows installer from `deeplink.exe` to `launcher.exe`. - Updated the command for opening the deeplink to use `bun.exe` with the new `deeplink.js` script. - Refactored the deeplink build script to rename the function from `buildWindowsDeeplinkExe` to `stageWindowsDeeplink` for clarity. - Adjusted the PowerShell script to check for the presence of `deeplink.js` instead of `deeplink.exe`, ensuring correct staging of the application. - Modified the finalization script to reflect the new staging function for the deeplink, enhancing the build process.
This commit is contained in:
parent
09d90632f9
commit
a196d0f26d
@ -51,10 +51,10 @@
|
||||
DeleteRegKey HKCR "farmcontrol"
|
||||
WriteRegStr HKCR "farmcontrol" "" "URL:farmcontrol"
|
||||
WriteRegStr HKCR "farmcontrol" "URL Protocol" ""
|
||||
WriteRegStr HKCR "farmcontrol\DefaultIcon" "" "$INSTDIR\bin\deeplink.exe"
|
||||
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"'
|
||||
!macroend
|
||||
|
||||
!macro customUnInstall
|
||||
|
||||
@ -6,24 +6,20 @@ import { fileURLToPath } from 'node:url'
|
||||
const rootDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..')
|
||||
const entrypoint = path.join(rootDir, 'src/bun/deeplink.js')
|
||||
|
||||
export function buildWindowsDeeplinkExe(outputPath) {
|
||||
export function stageWindowsDeeplink(appDir) {
|
||||
if (!existsSync(entrypoint)) {
|
||||
throw new Error(`build-windows-deeplink: entrypoint not found: ${entrypoint}`)
|
||||
throw new Error(`stage-windows-deeplink: entrypoint not found: ${entrypoint}`)
|
||||
}
|
||||
|
||||
const outputPath = path.join(appDir, 'bin', 'deeplink.js')
|
||||
mkdirSync(path.dirname(outputPath), { recursive: true })
|
||||
|
||||
const target = process.env.ELECTROBUN_ARCH === 'arm64'
|
||||
? 'bun-windows-x64'
|
||||
: 'bun-windows-x64'
|
||||
|
||||
const result = spawnSync(
|
||||
'bun',
|
||||
[
|
||||
'build',
|
||||
'--compile',
|
||||
'--minify',
|
||||
`--target=${target}`,
|
||||
'--target=bun',
|
||||
entrypoint,
|
||||
'--outfile',
|
||||
outputPath
|
||||
@ -37,24 +33,24 @@ export function buildWindowsDeeplinkExe(outputPath) {
|
||||
|
||||
if (result.status !== 0) {
|
||||
throw new Error(
|
||||
`build-windows-deeplink: bun build failed with exit code ${result.status ?? 1}`
|
||||
`stage-windows-deeplink: bun build failed with exit code ${result.status ?? 1}`
|
||||
)
|
||||
}
|
||||
|
||||
if (!existsSync(outputPath)) {
|
||||
throw new Error(`build-windows-deeplink: output not created: ${outputPath}`)
|
||||
throw new Error(`stage-windows-deeplink: output not created: ${outputPath}`)
|
||||
}
|
||||
|
||||
console.log(`build-windows-deeplink: created ${outputPath}`)
|
||||
console.log(`stage-windows-deeplink: created ${outputPath}`)
|
||||
return outputPath
|
||||
}
|
||||
|
||||
if (process.argv[1] === fileURLToPath(import.meta.url)) {
|
||||
const outputArg = process.argv[2]
|
||||
if (!outputArg) {
|
||||
console.error('Usage: bun scripts/build-windows-deeplink.mjs <output-path>')
|
||||
const appDirArg = process.argv[2]
|
||||
if (!appDirArg) {
|
||||
console.error('Usage: bun scripts/build-windows-deeplink.mjs <app-dir>')
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
buildWindowsDeeplinkExe(path.resolve(outputArg))
|
||||
stageWindowsDeeplink(path.resolve(appDirArg))
|
||||
}
|
||||
|
||||
@ -68,12 +68,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")
|
||||
|
||||
@ -19,7 +19,7 @@ import {
|
||||
cleanExpandedWindowsApp,
|
||||
expandWindowsAppFromArchive
|
||||
} from './expand-windows-installer.mjs'
|
||||
import { buildWindowsDeeplinkExe } from './build-windows-deeplink.mjs'
|
||||
import { stageWindowsDeeplink } from './build-windows-deeplink.mjs'
|
||||
import { codesignMacAppBundle } from './codesign-macos-app.mjs'
|
||||
|
||||
const rootDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..')
|
||||
@ -429,10 +429,8 @@ function buildMacPkg(appBundlePath, arch) {
|
||||
return pkgPath
|
||||
}
|
||||
|
||||
function stageWindowsDeeplinkExe(appDir) {
|
||||
const deeplinkPath = path.join(appDir, 'bin', 'deeplink.exe')
|
||||
buildWindowsDeeplinkExe(deeplinkPath)
|
||||
return deeplinkPath
|
||||
function stageWindowsDeeplinkScript(appDir) {
|
||||
return stageWindowsDeeplink(appDir)
|
||||
}
|
||||
|
||||
function cleanWinBuildDir(arch) {
|
||||
@ -584,7 +582,7 @@ async function main() {
|
||||
installerFiles.setupArchive,
|
||||
platformDir
|
||||
)
|
||||
stageWindowsDeeplinkExe(appDir)
|
||||
stageWindowsDeeplinkScript(appDir)
|
||||
|
||||
let published
|
||||
try {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user