summaryrefslogtreecommitdiffhomepage
path: root/packages/tauri/scripts/predev.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/tauri/scripts/predev.ts')
-rw-r--r--packages/tauri/scripts/predev.ts17
1 files changed, 17 insertions, 0 deletions
diff --git a/packages/tauri/scripts/predev.ts b/packages/tauri/scripts/predev.ts
new file mode 100644
index 000000000..bd9320a4a
--- /dev/null
+++ b/packages/tauri/scripts/predev.ts
@@ -0,0 +1,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)