farmcontrol-ui/scripts/build-windows-deeplink.mjs
Tom Butcher a196d0f26d
All checks were successful
farmcontrol/farmcontrol-ui/pipeline/head This commit looks good
Update Windows installer and deeplink handling
- 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.
2026-08-02 21:34:43 +01:00

57 lines
1.4 KiB
JavaScript

import { existsSync, mkdirSync } from 'node:fs'
import path from 'node:path'
import { spawnSync } from 'node:child_process'
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 stageWindowsDeeplink(appDir) {
if (!existsSync(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 result = spawnSync(
'bun',
[
'build',
'--minify',
'--target=bun',
entrypoint,
'--outfile',
outputPath
],
{
cwd: rootDir,
stdio: 'inherit',
env: process.env
}
)
if (result.status !== 0) {
throw new Error(
`stage-windows-deeplink: bun build failed with exit code ${result.status ?? 1}`
)
}
if (!existsSync(outputPath)) {
throw new Error(`stage-windows-deeplink: output not created: ${outputPath}`)
}
console.log(`stage-windows-deeplink: created ${outputPath}`)
return outputPath
}
if (process.argv[1] === fileURLToPath(import.meta.url)) {
const appDirArg = process.argv[2]
if (!appDirArg) {
console.error('Usage: bun scripts/build-windows-deeplink.mjs <app-dir>')
process.exit(1)
}
stageWindowsDeeplink(path.resolve(appDirArg))
}