predev.ts 527 B

1234567891011121314151617
  1. import * as fs from "node:fs/promises"
  2. import { $ } from "bun"
  3. import { copyBinaryToSidecarFolder, getCurrentSidecar } from "./utils"
  4. const RUST_TARGET = Bun.env.TAURI_ENV_TARGET_TRIPLE
  5. const sidecarConfig = getCurrentSidecar(RUST_TARGET)
  6. const binaryPath = `../opencode/dist/${sidecarConfig.ocBinary}/bin/opencode`
  7. if (!(await fs.exists(binaryPath))) {
  8. console.log("opencode binary not found, building...")
  9. await $`cd ../opencode && bun run build --single`
  10. }
  11. await copyBinaryToSidecarFolder(binaryPath, RUST_TARGET)