farmcontrol-server/electrobun.config.ts
Tom Butcher 575a2d1d20
Some checks reported errors
farmcontrol/farmcontrol-server/pipeline/head Something is wrong with the build of this commit
Enhance macOS build process and configuration
- Updated electrobun.config.ts to conditionally enable code signing and notarization based on developer ID presence.
- Refactored Jenkinsfile to support separate macOS builds for x64 and arm64 architectures.
- Added new scripts for ensuring core dependencies and patching Electrobun source for cross-architecture compatibility.
- Enhanced build-macos.mjs to improve architecture detection and build order, ensuring robust handling of macOS builds.
- Updated package.json to include a post-install script for patching Electrobun source files.
2026-08-01 21:27:58 +01:00

66 lines
1.6 KiB
TypeScript

import type { ElectrobunConfig } from "electrobun";
import { readFileSync } from "node:fs";
const packageJson = JSON.parse(readFileSync("./package.json", "utf8"));
const buildEnv = process.env.ELECTROBUN_BUILD_ENV || "dev";
const isStable = buildEnv === "stable";
const canCodesign = Boolean(process.env.ELECTROBUN_DEVELOPER_ID);
const nativeExternals = [
"canvas",
"@napi-rs/canvas",
"@img/sharp-libvips*",
"@napi-rs/*",
];
export default {
app: {
name: "Farm Control Server",
identifier: "com.tombutcher.farmcontrolserver",
version: packageJson.version,
description: "Farm Control Server desktop host application",
urlSchemes: ["farmcontrolserver"],
},
runtime: {
exitOnLastWindowClosed: false,
},
build: {
buildFolder: "build",
artifactFolder: "app_dist",
useAsar: isStable,
asarUnpack: ["*.node", "*.dll", "*.dylib", "*.so"],
bun: {
entrypoint: "src/bun/index.js",
external: nativeExternals,
packages: "external",
},
copy: {
"dist/mainview": "views/mainview",
"config.json": "config.json",
},
watch: ["scripts", "src/app"],
watchIgnore: ["dist/**", "build/**", "app_dist/**"],
mac: {
bundleCEF: false,
codesign: isStable && canCodesign,
notarize: isStable && canCodesign,
},
linux: {
bundleCEF: false,
},
win: {
bundleCEF: false,
},
},
scripts: {
preBuild: "scripts/pre-build.mjs",
postPackage: "scripts/finalize-desktop-artifacts.mjs",
},
release: {
baseUrl:
process.env.ELECTROBUN_RELEASE_BASE_URL ||
process.env.RELEASE_BASE_URL ||
"",
},
} satisfies ElectrobunConfig;