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"
|
DeleteRegKey HKCR "farmcontrol"
|
||||||
WriteRegStr HKCR "farmcontrol" "" "URL:farmcontrol"
|
WriteRegStr HKCR "farmcontrol" "" "URL:farmcontrol"
|
||||||
WriteRegStr HKCR "farmcontrol" "URL Protocol" ""
|
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" "" ""
|
||||||
WriteRegStr HKCR "farmcontrol\shell\Open" "" ""
|
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
|
!macroend
|
||||||
|
|
||||||
!macro customUnInstall
|
!macro customUnInstall
|
||||||
|
|||||||
@ -6,24 +6,20 @@ import { fileURLToPath } from 'node:url'
|
|||||||
const rootDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..')
|
const rootDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..')
|
||||||
const entrypoint = path.join(rootDir, 'src/bun/deeplink.js')
|
const entrypoint = path.join(rootDir, 'src/bun/deeplink.js')
|
||||||
|
|
||||||
export function buildWindowsDeeplinkExe(outputPath) {
|
export function stageWindowsDeeplink(appDir) {
|
||||||
if (!existsSync(entrypoint)) {
|
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 })
|
mkdirSync(path.dirname(outputPath), { recursive: true })
|
||||||
|
|
||||||
const target = process.env.ELECTROBUN_ARCH === 'arm64'
|
|
||||||
? 'bun-windows-x64'
|
|
||||||
: 'bun-windows-x64'
|
|
||||||
|
|
||||||
const result = spawnSync(
|
const result = spawnSync(
|
||||||
'bun',
|
'bun',
|
||||||
[
|
[
|
||||||
'build',
|
'build',
|
||||||
'--compile',
|
|
||||||
'--minify',
|
'--minify',
|
||||||
`--target=${target}`,
|
'--target=bun',
|
||||||
entrypoint,
|
entrypoint,
|
||||||
'--outfile',
|
'--outfile',
|
||||||
outputPath
|
outputPath
|
||||||
@ -37,24 +33,24 @@ export function buildWindowsDeeplinkExe(outputPath) {
|
|||||||
|
|
||||||
if (result.status !== 0) {
|
if (result.status !== 0) {
|
||||||
throw new Error(
|
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)) {
|
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
|
return outputPath
|
||||||
}
|
}
|
||||||
|
|
||||||
if (process.argv[1] === fileURLToPath(import.meta.url)) {
|
if (process.argv[1] === fileURLToPath(import.meta.url)) {
|
||||||
const outputArg = process.argv[2]
|
const appDirArg = process.argv[2]
|
||||||
if (!outputArg) {
|
if (!appDirArg) {
|
||||||
console.error('Usage: bun scripts/build-windows-deeplink.mjs <output-path>')
|
console.error('Usage: bun scripts/build-windows-deeplink.mjs <app-dir>')
|
||||||
process.exit(1)
|
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"
|
$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)) {
|
if (-not (Test-Path $requiredExe)) {
|
||||||
throw "Staged application is missing bin\launcher.exe"
|
throw "Staged application is missing bin\launcher.exe"
|
||||||
}
|
}
|
||||||
if (-not (Test-Path $requiredDeeplinkExe)) {
|
if (-not (Test-Path $requiredDeeplinkScript)) {
|
||||||
throw "Staged application is missing bin\deeplink.exe"
|
throw "Staged application is missing bin\deeplink.js"
|
||||||
}
|
}
|
||||||
|
|
||||||
Copy-Item -LiteralPath $nsiPath -Destination (Join-Path $workDir "farmcontrol.nsi")
|
Copy-Item -LiteralPath $nsiPath -Destination (Join-Path $workDir "farmcontrol.nsi")
|
||||||
|
|||||||
@ -19,7 +19,7 @@ import {
|
|||||||
cleanExpandedWindowsApp,
|
cleanExpandedWindowsApp,
|
||||||
expandWindowsAppFromArchive
|
expandWindowsAppFromArchive
|
||||||
} from './expand-windows-installer.mjs'
|
} 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'
|
import { codesignMacAppBundle } from './codesign-macos-app.mjs'
|
||||||
|
|
||||||
const rootDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..')
|
const rootDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..')
|
||||||
@ -429,10 +429,8 @@ function buildMacPkg(appBundlePath, arch) {
|
|||||||
return pkgPath
|
return pkgPath
|
||||||
}
|
}
|
||||||
|
|
||||||
function stageWindowsDeeplinkExe(appDir) {
|
function stageWindowsDeeplinkScript(appDir) {
|
||||||
const deeplinkPath = path.join(appDir, 'bin', 'deeplink.exe')
|
return stageWindowsDeeplink(appDir)
|
||||||
buildWindowsDeeplinkExe(deeplinkPath)
|
|
||||||
return deeplinkPath
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function cleanWinBuildDir(arch) {
|
function cleanWinBuildDir(arch) {
|
||||||
@ -584,7 +582,7 @@ async function main() {
|
|||||||
installerFiles.setupArchive,
|
installerFiles.setupArchive,
|
||||||
platformDir
|
platformDir
|
||||||
)
|
)
|
||||||
stageWindowsDeeplinkExe(appDir)
|
stageWindowsDeeplinkScript(appDir)
|
||||||
|
|
||||||
let published
|
let published
|
||||||
try {
|
try {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user