From ee23043d644d7b87c2834b09e4d1b372ae820611 Mon Sep 17 00:00:00 2001 From: Brendan Allan Date: Thu, 9 Apr 2026 13:18:46 +0800 Subject: Remove CLI from electron app (#17803) Co-authored-by: LukeParkerDev <10430890+Hona@users.noreply.github.com> --- packages/desktop-electron/scripts/prebuild.ts | 9 +++++++++ packages/desktop-electron/scripts/predev.ts | 14 +------------- packages/desktop-electron/scripts/prepare.ts | 18 +----------------- 3 files changed, 11 insertions(+), 30 deletions(-) create mode 100644 packages/desktop-electron/scripts/prebuild.ts (limited to 'packages/desktop-electron/scripts') diff --git a/packages/desktop-electron/scripts/prebuild.ts b/packages/desktop-electron/scripts/prebuild.ts new file mode 100644 index 000000000..46a2475ea --- /dev/null +++ b/packages/desktop-electron/scripts/prebuild.ts @@ -0,0 +1,9 @@ +#!/usr/bin/env bun +import { $ } from "bun" + +import { resolveChannel } from "./utils" + +const channel = resolveChannel() +await $`bun ./scripts/copy-icons.ts ${channel}` + +await $`cd ../opencode && bun script/build-node.ts` diff --git a/packages/desktop-electron/scripts/predev.ts b/packages/desktop-electron/scripts/predev.ts index a688d0e7f..37c31d7ee 100644 --- a/packages/desktop-electron/scripts/predev.ts +++ b/packages/desktop-electron/scripts/predev.ts @@ -1,17 +1,5 @@ import { $ } from "bun" -import { copyBinaryToSidecarFolder, getCurrentSidecar, windowsify } from "./utils" - await $`bun ./scripts/copy-icons.ts ${process.env.OPENCODE_CHANNEL ?? "dev"}` -const RUST_TARGET = Bun.env.RUST_TARGET - -const sidecarConfig = getCurrentSidecar(RUST_TARGET) - -const binaryPath = windowsify(`../opencode/dist/${sidecarConfig.ocBinary}/bin/opencode`) - -await (sidecarConfig.ocBinary.includes("-baseline") - ? $`cd ../opencode && bun run build --single --baseline` - : $`cd ../opencode && bun run build --single`) - -await copyBinaryToSidecarFolder(binaryPath, RUST_TARGET) +await $`cd ../opencode && bun script/build-node.ts` diff --git a/packages/desktop-electron/scripts/prepare.ts b/packages/desktop-electron/scripts/prepare.ts index 3704b2e61..0dfd5a35c 100755 --- a/packages/desktop-electron/scripts/prepare.ts +++ b/packages/desktop-electron/scripts/prepare.ts @@ -1,25 +1,9 @@ #!/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}` +await import("./prebuild") 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 artifact = process.env.OPENCODE_CLI_ARTIFACT ?? "opencode-cli" - -const dir = "resources/opencode-binaries" - -await $`mkdir -p ${dir}` -await $`gh run download ${process.env.GITHUB_RUN_ID} -n ${artifact}`.cwd(dir) - -await copyBinaryToSidecarFolder(windowsify(`${dir}/${sidecarConfig.ocBinary}/bin/opencode`)) - -await $`rm -rf ${dir}` -- cgit v1.2.3