electron-builder.config.js2.2 KBView on GitHub
'use strict'

const isStaging = process.env.NODE_ENV === 'staging'

// Must match __RECORDING_ENABLED__ in electron.vite.config.ts. With recording off
// the Recall SDK is dead weight (~335MB) AND a build hazard: its bundled
// GStreamer.framework is what afterPack has to hand-sign and what mergeASARs
// chokes on. Excluding it lets the standard signing path handle the whole app.
const recordingEnabled = process.env.CEDAR_RECORDING === '1'

/** @type {import('electron-builder').Configuration} */
module.exports = {
  appId: isStaging ? 'com.cedarcopilot.mail.staging' : 'com.cedarcopilot.mail',
  productName: isStaging ? 'Cedar Mail Staging' : 'Cedar Mail',
  npmRebuild: false,
  directories: {
    output: 'release',
    buildResources: 'resources',
  },
  files: [
    'out/**/*',
    'package.json',
    ...(recordingEnabled ? [] : ['!node_modules/@recallai/**']),
  ],
  extraResources: [
    { from: 'resources', to: 'resources', filter: ['*.png', '*.html'] },
  ],
  ...(recordingEnabled ? { afterPack: './sign-gstreamer.cjs' } : {}),
  afterSign: './notarize.cjs',
  mac: {
    icon: 'resources/icon.icns',
    target: [
      { target: 'dmg', arch: ['universal'] },
      { target: 'zip', arch: ['universal'] },
    ],
    category: 'public.app-category.productivity',
    identity: 'Isabelle Ilyia (2QR5XNJVRF)',
    hardenedRuntime: true,
    gatekeeperAssess: false,
    entitlements: 'entitlements.mac.plist',
    entitlementsInherit: 'entitlements.mac.plist',
    // Both of the following only apply when the Recall SDK ships:
    // mergeASARs causes EEXIST errors for GStreamer.framework symlinks from
    // @recallai/desktop-sdk when building universal binaries. Disabling it
    // uses the split-asar approach (app-x64.asar / app-arm64.asar) instead.
    // signIgnore covers GStreamer.framework/GStreamer, an ambiguous bundle
    // (app vs framework) that makes codesign fail.
    ...(recordingEnabled
      ? { mergeASARs: false, signIgnore: ['GStreamer\\.framework'] }
      : {}),
  },
  protocols: [{ name: 'Cedar Mail', schemes: ['cedar'] }],
  publish: {
    provider: 'github',
    owner: 'CedarCopilot',
    repo: 'cedar-releases',
    releaseType: isStaging ? 'prerelease' : 'release',
    vPrefixedTagName: true,
  },
}