Some checks failed
farmcontrol/farmcontrol-ui/pipeline/head There was a failure building this commit
- Updated `electrobun` dependency to version `1.18.4-beta.19` in `package.json` and `bun.lock`. - Added `rcedit` and `@tweenjs/tween.js` dependencies to `bun.lock`. - Modified `Jenkinsfile` to clean up additional staging directories for production builds. - Refactored `electrobun.config.ts` to dynamically read the `package.json` path. - Introduced new scripts for managing Hutch installation and execution, improving the build process. - Enhanced artifact finalization logic to support multiple build environments and streamline platform directory resolution.
90 lines
2.5 KiB
TypeScript
90 lines
2.5 KiB
TypeScript
import type { ElectrobunConfig } from "electrobun";
|
|
import { readFileSync } from "node:fs";
|
|
import path from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
const rootDir = path.dirname(fileURLToPath(import.meta.url));
|
|
const packageJson = JSON.parse(
|
|
readFileSync(path.join(rootDir, "package.json"), "utf8"),
|
|
);
|
|
const buildEnv = process.env.ELECTROBUN_BUILD_ENV || "dev";
|
|
const isStable = buildEnv === "stable";
|
|
const canCodesign = Boolean(process.env.ELECTROBUN_DEVELOPER_ID);
|
|
const bundleCEF = ["1", "true", "yes"].includes(
|
|
String(process.env.ELECTROBUN_BUNDLE_CEF || "").toLowerCase(),
|
|
);
|
|
const defaultRenderer = bundleCEF ? "cef" : "native";
|
|
const targetOs =
|
|
process.env.ELECTROBUN_OS ||
|
|
(process.platform === "darwin"
|
|
? "macos"
|
|
: process.platform === "win32"
|
|
? "win"
|
|
: "linux");
|
|
|
|
export default {
|
|
app: {
|
|
name: "Farm Control",
|
|
identifier: "com.tombutcher.farmcontrol",
|
|
version: packageJson.version,
|
|
description: "3D Printer ERP and Control Software.",
|
|
urlSchemes: ["farmcontrol"],
|
|
},
|
|
runtime: {
|
|
exitOnLastWindowClosed: true,
|
|
},
|
|
build: {
|
|
mainProcess: "bun",
|
|
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",
|
|
},
|
|
copy: {
|
|
"dist/mainview": "views/mainview",
|
|
"src/bun/libMacWindowEffects.dylib": "bun/libMacWindowEffects.dylib",
|
|
},
|
|
watch: ["scripts", "src"],
|
|
watchIgnore: ["dist/**", "build/**", "app_dist/**"],
|
|
mac: {
|
|
bundleCEF,
|
|
defaultRenderer,
|
|
icons: "assets/icon.iconset",
|
|
createDmg: false,
|
|
codesign: isStable && canCodesign,
|
|
notarize: isStable && canCodesign,
|
|
},
|
|
linux: {
|
|
bundleCEF: false,
|
|
defaultRenderer: "native",
|
|
icon: "assets/icon.png",
|
|
},
|
|
win: {
|
|
bundleCEF,
|
|
defaultRenderer,
|
|
icon: "assets/icon.iconset/icon_256x256.png",
|
|
},
|
|
},
|
|
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;
|