summaryrefslogtreecommitdiffhomepage
path: root/packages/desktop-electron/scripts/prepare.ts
diff options
context:
space:
mode:
authorBrendan Allan <[email protected]>2026-03-04 15:12:34 +0800
committerGitHub <[email protected]>2026-03-04 15:12:34 +0800
commit5cf235fa6cf7b4c890c68f8ff68a96fcae992abf (patch)
tree25fdfd8ce95ad048fb097822995dcf060e8d6d8b /packages/desktop-electron/scripts/prepare.ts
parente4f0825c56300286ec0aa82b1006e4006a17e1e1 (diff)
downloadopencode-5cf235fa6cf7b4c890c68f8ff68a96fcae992abf.tar.gz
opencode-5cf235fa6cf7b4c890c68f8ff68a96fcae992abf.zip
desktop: add electron version (#15663)
Diffstat (limited to 'packages/desktop-electron/scripts/prepare.ts')
-rwxr-xr-xpackages/desktop-electron/scripts/prepare.ts24
1 files changed, 24 insertions, 0 deletions
diff --git a/packages/desktop-electron/scripts/prepare.ts b/packages/desktop-electron/scripts/prepare.ts
new file mode 100755
index 000000000..3764db921
--- /dev/null
+++ b/packages/desktop-electron/scripts/prepare.ts
@@ -0,0 +1,24 @@
+#!/usr/bin/env bun
+import { $ } from "bun"
+
+import { Script } from "@opencode-ai/script"
+import { copyBinaryToSidecarFolder, getCurrentSidecar, resolveChannel, windowsify } from "./utils"
+
+const channel = resolveChannel()
+await $`bun ./scripts/copy-icons.ts ${channel}`
+
+const pkg = await Bun.file("./package.json").json()
+pkg.version = Script.version
+await Bun.write("./package.json", JSON.stringify(pkg, null, 2) + "\n")
+console.log(`Updated package.json version to ${Script.version}`)
+
+const sidecarConfig = getCurrentSidecar()
+
+const dir = "resources/opencode-binaries"
+
+await $`mkdir -p ${dir}`
+await $`gh run download ${Bun.env.GITHUB_RUN_ID} -n opencode-cli`.cwd(dir)
+
+await copyBinaryToSidecarFolder(windowsify(`${dir}/${sidecarConfig.ocBinary}/bin/opencode`))
+
+await $`rm -rf ${dir}`