Enhance core dependency management and CLI script for macOS
Some checks are pending
farmcontrol/farmcontrol-server/pipeline/head Build queued...
Some checks are pending
farmcontrol/farmcontrol-server/pipeline/head Build queued...
- Updated ensure-electrobun-core.mjs to ensure core dependencies for both host and target architectures, improving compatibility. - Modified patch-electrobun-src.mjs to enhance the handling of the Bun binary, ensuring the correct binary is used based on availability, which improves error reporting and execution reliability.
This commit is contained in:
parent
72cea3a740
commit
f6bd45c214
@ -114,10 +114,14 @@ async function ensureCoreDependencies(targetOS, targetArch) {
|
||||
}
|
||||
|
||||
const targetOS = "macos";
|
||||
const hostArch = getReleaseArch(process.arch);
|
||||
const targetArch = getReleaseArch(
|
||||
process.env.ELECTROBUN_TARGET_ARCH ||
|
||||
process.env.ELECTROBUN_FORCE_ARCH ||
|
||||
process.arch,
|
||||
);
|
||||
|
||||
await ensureCoreDependencies(targetOS, targetArch);
|
||||
const archesToEnsure = new Set([hostArch, targetArch]);
|
||||
for (const arch of archesToEnsure) {
|
||||
await ensureCoreDependencies(targetOS, arch);
|
||||
}
|
||||
|
||||
@ -151,6 +151,25 @@ if (!cliSource.includes("toolPaths")) {
|
||||
"zigAsarCli = join(toolPaths.BSPATCH).replace(\"bspatch\", \"zig-asar\");",
|
||||
);
|
||||
writeFileSync(cliPath, cliSource);
|
||||
cliSource = readFileSync(cliPath, "utf8");
|
||||
}
|
||||
if (!cliSource.includes("hookBunBinary")) {
|
||||
cliSource = cliSource.replace(
|
||||
`const hostPaths = getPlatformPaths(OS, HOST_ARCH);
|
||||
|
||||
const result = Bun.spawnSync([hostPaths.BUN_BINARY, hookScript],`,
|
||||
`const hostPaths = getPlatformPaths(OS, HOST_ARCH);
|
||||
const hookBunBinary = existsSync(hostPaths.BUN_BINARY)
|
||||
? hostPaths.BUN_BINARY
|
||||
: process.execPath;
|
||||
|
||||
const result = Bun.spawnSync([hookBunBinary, hookScript],`,
|
||||
);
|
||||
cliSource = cliSource.replace(
|
||||
"console.error(\"Tried to run with bun at:\", hostPaths.BUN_BINARY);",
|
||||
"console.error(\"Tried to run with bun at:\", hookBunBinary);",
|
||||
);
|
||||
writeFileSync(cliPath, cliSource);
|
||||
}
|
||||
|
||||
const markerPath = path.join(electrobunDir, ".farmcontrol-electrobun-patched");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user