Skip to content

armgit / orca

Public Imported from GitHub
0

Orca is the place for working with a fleet of agents (e.g. Grok Bot, Claude Code). Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

1.4 KB
Raw Blame
import { spawn } from 'node:child_process'
import { fileURLToPath } from 'node:url'

const buildScript = fileURLToPath(new URL('./run-electron-vite-build.mjs', import.meta.url))
// Use CommonJS .cts wrapper so concurrent electron-vite targets do not share timestamped ESM temp file.
const targetConfig = fileURLToPath(new URL('../electron-vite-target.config.cts', import.meta.url))
const targets = ['main', 'preload', 'renderer']

function buildTarget(target) {
  return new Promise((resolve, reject) => {
    const child = spawn(
      process.execPath,
      [buildScript, '--config', targetConfig, '--ignoreConfigWarning', ...process.argv.slice(2)],
      {
        stdio: 'inherit',
        env: {
          ...process.env,
          ORCA_ELECTRON_VITE_TARGET: target
        }
      }
    )

    child.on('error', reject)
    child.on('exit', (code, signal) => {
      if (signal) {
        reject(new Error(`Electron Vite ${target} build exited with signal ${signal}`))
      } else if (code !== 0) {
        reject(new Error(`Electron Vite ${target} build exited with code ${code}`))
      } else {
        resolve()
      }
    })
  })
}

const results = await Promise.allSettled(targets.map(buildTarget))
const failures = results.filter((result) => result.status === 'rejected')

if (failures.length > 0) {
  for (const failure of failures) {
    console.error(failure.reason)
  }
  process.exit(1)
}