farmcontrol-server/electrobun.config.ts
Tom Butcher cda0286db7
Some checks failed
farmcontrol/farmcontrol-server/pipeline/head There was a failure building this commit
Add postWrap script for macOS bundle expansion and implement expand-macos-bundle script
- Updated electrobun.config.ts to include a new postWrap script for expanding macOS bundles.
- Introduced expand-macos-bundle.mjs script to handle the extraction and setup of macOS application bundles, including metadata validation and resource management.
- Enhanced error handling and logging for better visibility during the expansion process.
2026-08-01 21:38:05 +01:00

67 lines
1.7 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",
postWrap: "scripts/expand-macos-bundle.mjs",
postPackage: "scripts/finalize-desktop-artifacts.mjs",
},
release: {
baseUrl:
process.env.ELECTROBUN_RELEASE_BASE_URL ||
process.env.RELEASE_BASE_URL ||
"",
},
} satisfies ElectrobunConfig;