Skip to content

The open-source AI receptionist for businesses. Answers every call, books the appointment and hands over to a person when needed. You own the code and the data.

1.1 KB
Raw Blame
// Bundles the main process and the preload into dist/ (CommonJS: a sandboxed preload must be one file). The server
// the app opens and whether updates are on are fixed here, at build time (src/config.ts).
import { build } from 'esbuild'

const server = new URL(process.env.LINEDESK_APP_URL || 'https://app.linedesk.ai').origin
const updates = process.env.LINEDESK_DESKTOP_UPDATES === '1'
// A test build for CI only (debugging port, server override): never shipped (src/config.ts E2E_BUILD).
const e2e = process.env.LINEDESK_DESKTOP_E2E === '1'

const common = {
  bundle: true,
  platform: 'node',
  format: 'cjs',
  target: 'node22',
  external: ['electron'],
  sourcemap: false,
  logLevel: 'warning',
  define: {
    __LINEDESK_SERVER__: JSON.stringify(server),
    __LINEDESK_UPDATES__: JSON.stringify(updates),
    __LINEDESK_E2E__: JSON.stringify(e2e),
  },
}

await build({ ...common, entryPoints: ['src/main.ts'], outfile: 'dist/main.cjs' })
await build({ ...common, entryPoints: ['src/preload.ts'], outfile: 'dist/preload.cjs' })
console.log(`dist/: opens ${server}, updates ${updates ? 'on' : 'off'}${e2e ? ', TEST BUILD' : ''}`)