2026-04-21 03:56:14 +00:00
|
|
|
const { chmodSync, existsSync, readdirSync } = require('node:fs')
|
|
|
|
|
const { join } = require('node:path')
|
|
|
|
|
|
2026-04-03 23:50:28 +00:00
|
|
|
const isMacRelease = process.env.ORCA_MAC_RELEASE === '1'
|
|
|
|
|
|
|
|
|
|
/** @type {import('electron-builder').Configuration} */
|
|
|
|
|
module.exports = {
|
|
|
|
|
appId: 'com.stablyai.orca',
|
|
|
|
|
productName: 'Orca',
|
|
|
|
|
directories: {
|
2026-04-09 19:28:52 +00:00
|
|
|
buildResources: 'resources/build'
|
2026-04-03 23:50:28 +00:00
|
|
|
},
|
|
|
|
|
files: [
|
|
|
|
|
'!**/.vscode/*',
|
|
|
|
|
'!src/*',
|
|
|
|
|
'!electron.vite.config.{js,ts,mjs,cjs}',
|
|
|
|
|
'!{.eslintcache,eslint.config.mjs,.prettierignore,.prettierrc.yaml,dev-app-update.yml,CHANGELOG.md,README.md}',
|
|
|
|
|
'!{.env,.env.*,.npmrc,pnpm-lock.yaml}',
|
2026-04-09 05:49:16 +00:00
|
|
|
'!tsconfig.json',
|
|
|
|
|
'!config/*'
|
2026-04-03 23:50:28 +00:00
|
|
|
],
|
2026-04-06 22:03:05 +00:00
|
|
|
// Why: the CLI entry-point lives in out/cli/ but imports shared modules
|
|
|
|
|
// from out/shared/ (e.g. runtime-bootstrap). Both directories must be
|
|
|
|
|
// unpacked so that Node's require() can resolve the cross-directory imports
|
|
|
|
|
// when the CLI runs outside the asar archive.
|
2026-04-17 05:42:41 +00:00
|
|
|
// Why: daemon-entry.js is forked as a separate Node.js process and must be
|
|
|
|
|
// accessible on disk (not inside the asar archive) for child_process.fork().
|
|
|
|
|
asarUnpack: ['out/cli/**', 'out/shared/**', 'out/main/daemon-entry.js', 'out/main/chunks/**', 'resources/**'],
|
2026-04-21 03:56:14 +00:00
|
|
|
afterPack: async (context) => {
|
|
|
|
|
const resourcesDir =
|
|
|
|
|
context.electronPlatformName === 'darwin'
|
|
|
|
|
? join(context.appOutDir, `${context.packager.appInfo.productFilename}.app`, 'Contents', 'Resources')
|
|
|
|
|
: join(context.appOutDir, 'resources')
|
|
|
|
|
if (!existsSync(resourcesDir)) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
for (const filename of readdirSync(resourcesDir)) {
|
|
|
|
|
if (!filename.startsWith('agent-browser-')) {
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
// Why: the upstream package has inconsistent executable bits across
|
|
|
|
|
// platform binaries (notably darwin-x64). child_process.execFile needs
|
|
|
|
|
// the copied binary to be executable in packaged apps.
|
|
|
|
|
chmodSync(join(resourcesDir, filename), 0o755)
|
|
|
|
|
}
|
|
|
|
|
},
|
2026-04-03 23:50:28 +00:00
|
|
|
win: {
|
|
|
|
|
executableName: 'Orca',
|
|
|
|
|
extraResources: [
|
|
|
|
|
{
|
|
|
|
|
from: 'resources/win32/bin/orca.cmd',
|
|
|
|
|
to: 'bin/orca.cmd'
|
2026-04-21 03:56:14 +00:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
from: 'node_modules/agent-browser/bin/agent-browser-win32-x64.exe',
|
|
|
|
|
to: 'agent-browser-win32-x64.exe'
|
2026-04-03 23:50:28 +00:00
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
nsis: {
|
|
|
|
|
artifactName: 'orca-windows-setup.${ext}',
|
|
|
|
|
shortcutName: '${productName}',
|
|
|
|
|
uninstallDisplayName: '${productName}',
|
|
|
|
|
createDesktopShortcut: 'always'
|
|
|
|
|
},
|
|
|
|
|
mac: {
|
2026-04-09 19:28:52 +00:00
|
|
|
icon: 'resources/build/icon.icns',
|
|
|
|
|
entitlements: 'resources/build/entitlements.mac.plist',
|
|
|
|
|
entitlementsInherit: 'resources/build/entitlements.mac.plist',
|
2026-04-03 23:50:28 +00:00
|
|
|
extendInfo: {
|
|
|
|
|
NSCameraUsageDescription: "Application requests access to the device's camera.",
|
|
|
|
|
NSMicrophoneUsageDescription: "Application requests access to the device's microphone.",
|
|
|
|
|
NSDocumentsFolderUsageDescription:
|
|
|
|
|
"Application requests access to the user's Documents folder.",
|
|
|
|
|
NSDownloadsFolderUsageDescription:
|
|
|
|
|
"Application requests access to the user's Downloads folder."
|
|
|
|
|
},
|
|
|
|
|
// Why: local macOS validation builds should launch without Apple release
|
|
|
|
|
// credentials. Hardened runtime + notarization stay enabled only on the
|
|
|
|
|
// explicit release path so production artifacts remain strict while dev
|
|
|
|
|
// artifacts do not fail with broken ad-hoc launch behavior.
|
|
|
|
|
hardenedRuntime: isMacRelease,
|
|
|
|
|
notarize: isMacRelease,
|
|
|
|
|
extraResources: [
|
|
|
|
|
{
|
|
|
|
|
from: 'resources/darwin/bin/orca',
|
|
|
|
|
to: 'bin/orca'
|
2026-04-21 03:56:14 +00:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
from: 'node_modules/agent-browser/bin/agent-browser-darwin-${arch}',
|
|
|
|
|
to: 'agent-browser-darwin-${arch}'
|
2026-04-03 23:50:28 +00:00
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
target: [
|
|
|
|
|
{
|
|
|
|
|
target: 'dmg',
|
|
|
|
|
arch: ['x64', 'arm64']
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
target: 'zip',
|
|
|
|
|
arch: ['x64', 'arm64']
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
// Why: release builds should fail if signing is unavailable instead of
|
|
|
|
|
// silently downgrading to ad-hoc artifacts that look shippable in CI logs.
|
|
|
|
|
forceCodeSigning: isMacRelease,
|
|
|
|
|
dmg: {
|
|
|
|
|
artifactName: 'orca-macos-${arch}.${ext}'
|
|
|
|
|
},
|
|
|
|
|
linux: {
|
|
|
|
|
extraResources: [
|
|
|
|
|
{
|
|
|
|
|
from: 'resources/linux/bin/orca',
|
|
|
|
|
to: 'bin/orca'
|
2026-04-21 03:56:14 +00:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
from: 'node_modules/agent-browser/bin/agent-browser-linux-${arch}',
|
|
|
|
|
to: 'agent-browser-linux-${arch}'
|
2026-04-03 23:50:28 +00:00
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
target: ['AppImage', 'deb'],
|
|
|
|
|
maintainer: 'stablyai',
|
|
|
|
|
category: 'Utility'
|
|
|
|
|
},
|
|
|
|
|
appImage: {
|
|
|
|
|
artifactName: 'orca-linux.${ext}'
|
|
|
|
|
},
|
2026-04-07 07:13:51 +00:00
|
|
|
// Why: must be true so that electron-builder rebuilds native modules
|
|
|
|
|
// (node-pty) for each target architecture when producing dual-arch macOS
|
|
|
|
|
// builds (x64 + arm64). With npmRebuild disabled, CI on an arm64 runner
|
|
|
|
|
// packages arm64 binaries into the x64 DMG, causing "posix_spawnp failed"
|
|
|
|
|
// on Intel Macs.
|
|
|
|
|
npmRebuild: true,
|
2026-04-03 23:50:28 +00:00
|
|
|
publish: {
|
|
|
|
|
provider: 'github',
|
|
|
|
|
owner: 'stablyai',
|
|
|
|
|
repo: 'orca',
|
|
|
|
|
releaseType: 'release'
|
|
|
|
|
}
|
|
|
|
|
}
|