GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — opencode/packages/desktop/script/dev-electron.ts at dev · erickwill/opencode

Expand file tree

/

dev-electron.ts

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
42 lines (34 loc) · 1.76 KB
/

dev-electron.ts

Copy path

File metadata and controls

42 lines (34 loc) · 1.76 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { $ } from "bun"
import { dirname, join } from "node:path"
import { fileURLToPath } from "node:url"
export async function prepareDevElectron() {
const electron = dirname(fileURLToPath(import.meta.resolve("electron/package.json")))
const icon = Bun.file(join(import.meta.dirname, "../icons/dev/icon.icns"))
const hash = new Bun.CryptoHasher("sha256")
.update(electron)
.update(process.arch)
.update(await Bun.file(join(electron, "package.json")).text())
.update(await icon.arrayBuffer())
.update(await Bun.file(import.meta.filename).text())
.digest("hex")
.slice(0, 16)
const root = join(import.meta.dirname, "../node_modules/.cache/opencode-dev", hash)
const bundle = join(root, "OpenCode Dev.app")
// Electron uses the executable's name to distinguish development from packaged apps.
const executable = join(bundle, "Contents/MacOS/Electron")
if (await Bun.file(join(root, "ready")).exists()) return executable
// macOS reads the Dock and app-switcher identity from the bundle, even after app.setName().
await $`mkdir -p ${root}`
await $`ditto ${join(electron, "dist/Electron.app")} ${bundle}`
const plist = join(bundle, "Contents/Info.plist")
for (const key of ["CFBundleName", "CFBundleDisplayName"]) {
await $`plutil -replace ${key} -string ${"OpenCode Dev"} ${plist}`
}
await $`plutil -replace CFBundleIdentifier -string ai.opencode.desktop.dev ${plist}`
await $`plutil -insert NSAutoFillRequiresTextContentTypeForOneTimeCodeOnMac -bool true ${plist}`
await Bun.write(join(bundle, "Contents/Resources/electron.icns"), icon)
// Changing the bundle resources invalidates Electron's signature.
await $`codesign --force --deep --sign - ${bundle}`
await Bun.write(join(root, "ready"), "")
return executable
}
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.