summaryrefslogtreecommitdiffhomepage
path: root/packages/tauri/scripts/predev.ts
blob: bd9320a4a1c6aa61ea8029b78e8a55991d9d12dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import * as fs from "node:fs/promises"
import { $ } from "bun"

import { copyBinaryToSidecarFolder, getCurrentSidecar } from "./utils"

const RUST_TARGET = Bun.env.TAURI_ENV_TARGET_TRIPLE

const sidecarConfig = getCurrentSidecar(RUST_TARGET)

const binaryPath = `../opencode/dist/${sidecarConfig.ocBinary}/bin/opencode`

if (!(await fs.exists(binaryPath))) {
  console.log("opencode binary not found, building...")
  await $`cd ../opencode && bun run build --single`
}

await copyBinaryToSidecarFolder(binaryPath, RUST_TARGET)