farmcontrol-server/electrobun.config.ts
Tom Butcher 8741a2c6fd
Some checks failed
farmcontrol/farmcontrol-server/pipeline/head There was a failure building this commit
Enhance build configuration and scripts
- Updated electrobun.config.ts to include environment-based settings for stability and external dependencies.
- Refactored package.json scripts for improved build processes and streamlined commands.
- Added new build scripts for Linux and renderer, while removing the obsolete build-server script.
- Enhanced pre-build validation to ensure required files are present and added logging for better visibility.
- Updated clean-build script to remove additional artifact directories for thorough cleanup.
2026-08-01 21:13:51 +01:00

65 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 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,
notarize: isStable,
},
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;