All checks were successful
farmcontrol/farmcontrol-server/pipeline/head This commit looks good
- Changed the runtime configuration to set exitOnLastWindowClosed to true, ensuring the application exits when the last window is closed.
83 lines
2.1 KiB
TypeScript
83 lines
2.1 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 targetOs =
|
|
process.env.ELECTROBUN_OS ||
|
|
(process.platform === "darwin"
|
|
? "macos"
|
|
: process.platform === "win32"
|
|
? "win"
|
|
: "linux");
|
|
|
|
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: true,
|
|
},
|
|
build: {
|
|
buildFolder: "build",
|
|
artifactFolder: "app_dist",
|
|
// macOS WebKit loads views:// assets reliably from a flat app folder;
|
|
// ASAR-packed views can fail to load module scripts on first launch.
|
|
useAsar: isStable && targetOs !== "macos",
|
|
asarUnpack: [
|
|
"*.node",
|
|
"*.dll",
|
|
"*.dylib",
|
|
"*.so",
|
|
"views/**",
|
|
],
|
|
bun: {
|
|
entrypoint: "src/bun/index.js",
|
|
external: nativeExternals,
|
|
},
|
|
copy: {
|
|
"dist/mainview": "views/mainview",
|
|
"config.json": "config.json",
|
|
},
|
|
watch: ["scripts", "src/app"],
|
|
watchIgnore: ["dist/**", "build/**", "app_dist/**"],
|
|
mac: {
|
|
bundleCEF: false,
|
|
// DMG is built in finalize-desktop-artifacts (Electrobun createDmg disabled).
|
|
createDmg: 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;
|