Files
openchamber/packages/electron/scripts/bundle-main.mjs
T
502c96630e feat(desktop): Linux AppImage polish — window controls, updater UX, docs (#2144)
* feat(electron): add Linux AppImage releases

* ci: cache Linux OpenCode CLI artifacts

* fix(ci): await Linux release inventory check

* fix(electron): add frameless window controls on Linux desktop

Linux AppImages were created without native WM decorations and without
in-app controls, leaving users unable to close the window with a mouse.

Treat Linux like Windows: frameless BrowserWindow plus the existing
WindowsWindowControls header buttons and app-menu entry. macOS keeps
hidden title bar with traffic lights unchanged.

Shared usesFramelessElectronChrome() helper drives main window, mini
chat, header insets, and titlebar controls.

Co-authored-by: Serhii Dziupin <makeittech@users.noreply.github.com>

* feat(desktop): add configurable window controls position by OS

Add desktopWindowControlsPosition setting (auto/left/right) with OS-aware
defaults: Linux left, Windows right. Wire frameless chrome controls in
Header, TitlebarLeftControls, and MiniChatLayout, plus a Sessions settings
control for Windows and Linux desktop shells.

Co-authored-by: Serhii Dziupin <makeittech@users.noreply.github.com>

* fix(desktop): address Linux AppImage release review findings

Propagate updater capability errors to the UI, treat missing
latest-linux.yml feeds as no-update, stop installed-apps IPC spam on
Linux, document FUSE/AppImage limits, add CHANGELOG entry, migrate
remaining btriapitsyn URLs, and run Electron Linux unit tests on PRs.

Co-authored-by: Serhii Dziupin <makeittech@users.noreply.github.com>

---------

Co-authored-by: jibanez-staticduo <staticduo@gmail.com>
Co-authored-by: Serhii Dziupin <makeittech@users.noreply.github.com>
2026-07-13 08:59:31 +03:00

49 lines
1.6 KiB
JavaScript

/**
* Bundle main.mjs into a single file. Small electron-* helper deps are
* inlined; everything else — including the in-process web server
* (@openchamber/web) and native modules — stays external so it resolves
* from node_modules at runtime inside the packaged app.
*
* Why external matters: packages/web/server pulls in bun-pty, which has
* a top-level `import { dlopen } from "bun:ffi"`. If we inline it here,
* Node's ESM loader sees `bun:ffi` at package load time and crashes with
* ERR_UNSUPPORTED_ESM_URL_SCHEME before any runtime guard can skip it.
* Leaving @openchamber/web external means the conditional
* `if (isBunRuntime) await import('bun-pty')` stays dynamic and is never
* reached under Electron.
*/
import path from 'node:path';
import { fileURLToPath } from 'node:url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const root = path.resolve(__dirname, '..');
const updaterE2eBuild = process.env.OPENCHAMBER_UPDATER_E2E_BUILD === '1';
const result = await Bun.build({
entrypoints: [path.join(root, 'main.mjs')],
outdir: path.join(root, 'dist-bundle'),
target: 'node',
format: 'esm',
external: [
'electron',
'@openchamber/web',
'@openchamber/web/*',
'bun-pty',
'node-pty',
'better-sqlite3',
],
minify: false,
sourcemap: 'none',
naming: '[name].mjs',
define: {
__OPENCHAMBER_UPDATER_E2E_BUILD__: updaterE2eBuild ? 'true' : 'false',
},
});
if (!result.success) {
for (const msg of result.logs) console.error(msg);
process.exit(1);
}
console.log(`[electron] main.mjs bundled -> dist-bundle/main.mjs (updater E2E=${updaterE2eBuild})`);