History

desktop app, setup page, keychain secrets, release pipeline

- Electron desktop app with sidecar CLI binary bundling - Setup page on marketing site with OS-detected download buttons - GitHub Actions workflow for building desktop distributables - Re-enable keychain secrets plugin - Fix React production build (resolve.dedupe) - Support EXECUTOR_SCOPE_DIR env var for scope selection

Rhys Sullivan committed 7 months ago

Commit e4bd2fa1 parent 723b8f313 files · +470 −138Browse files

Showing the changes to apps/desktop/scripts/bundle-cli.js (1 of 13 files). Show all

Unified · Split

apps/desktop/scripts/bundle-cli.js+58−0
@@ -0,0 +1,58 @@
1/**
2 * Builds the executor CLI binary and copies it into the desktop app's
3 * resources/ folder so electron-builder can bundle it as a sidecar.
4 */
5const { execSync, spawnSync } = require("node:child_process");
6const { existsSync, mkdirSync, cpSync, chmodSync } = require("node:fs");
7const { resolve, join } = require("node:path");
8
9const root = resolve(__dirname, "..");
10const repoRoot = resolve(root, "../..");
11const cliRoot = resolve(repoRoot, "apps/cli");
12const resourcesDir = resolve(root, "resources");
13
14// Build CLI for current platform
15console.log("Building executor CLI binary...");
16
17// Resolve bun binary path explicitly
18const { homedir } = require("node:os");
19const bunBin = resolve(process.env.BUN_INSTALL || join(homedir(), ".bun"), "bin", "bun");
20
21const result = spawnSync(bunBin, ["run", "src/build.ts", "binary", "--single"], {
22 cwd: cliRoot,
23 stdio: "inherit",
24});
25
26if (result.error) {
27 console.error("CLI build spawn error:", result.error.message);
28 process.exit(1);
29}
30
31if (result.status !== 0) {
32 console.error(`CLI build failed with exit code ${result.status}`);
33 process.exit(1);
34}
35
36// Find the built binary
37const platform = process.platform === "win32" ? "windows" : process.platform;
38const arch = process.arch === "arm64" ? "arm64" : "x64";
39const binaryName = process.platform === "win32" ? "executor.exe" : "executor";
40const targetDir = join(cliRoot, "dist", `executor-${platform}-${arch}`, "bin");
41
42if (!existsSync(join(targetDir, binaryName))) {
43 console.error(`Binary not found at ${join(targetDir, binaryName)}`);
44 process.exit(1);
45}
46
47// Copy to resources/
48mkdirSync(resourcesDir, { recursive: true });
49cpSync(join(targetDir, binaryName), join(resourcesDir, binaryName));
50chmodSync(join(resourcesDir, binaryName), 0o755);
51
52// Copy QuickJS WASM if present
53const wasmPath = join(targetDir, "emscripten-module.wasm");
54if (existsSync(wasmPath)) {
55 cpSync(wasmPath, join(resourcesDir, "emscripten-module.wasm"));
56}
57
58console.log(`Sidecar binary copied to ${resourcesDir}`);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t