/**
 * Electron Forge Configuration — Bradly Desktop App
 *
 * Handles packaging and creating distributable installers.
 * Currently targets macOS (.dmg) only.
 */
import type { ForgeConfig } from '@electron-forge/shared-types';
import { MakerDMG } from '@electron-forge/maker-dmg';

const config: ForgeConfig = {
  packagerConfig: {
    name: 'Bradly',
    executableName: 'bradly',
    icon: './assets/icon',
    asar: {
      // Remotion compositor binaries MUST be outside app.asar
      // because they are native executables that need direct filesystem access
      unpack: '{**/node_modules/@remotion/compositor-*/**,**/node_modules/@remotion/renderer/**}',
    },
    // Include the built renderer and Remotion bundle as extra resources
    extraResource: [
      './out/renderer',
      './out/remotion-bundle',
    ],
    // Ignore development files during packaging
    ignore: [
      /^\/src$/,
      /^\/scripts$/,
      /^\/uploads$/,
      /^\/renders$/,
      /^\/\.vscode$/,
      /^\/\.git$/,
      /^\/\.env/,
      /^\/\.antigravity$/,
      /^\/vite\.config\.ts$/,
      /^\/electron\.vite\.config\.ts$/,
      /^\/tsconfig\.json$/,
      /^\/ABOUT\.md$/,
      /^\/AGENTS\.md$/,
      /^\/README\.md$/,
      /^\/schema\.sql$/,
      /^\/backend_endpoint\.py$/,
    ],
  },
  makers: [
    new MakerDMG({
      format: 'ULFO',
    }),
  ],
};

export default config;
