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-workflows/scripts/build-gui.ts at main · rphang/opencode-workflows

Expand file tree

/

build-gui.ts

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
57 lines (53 loc) · 2.39 KB
/

build-gui.ts

Copy path

File metadata and controls

57 lines (53 loc) · 2.39 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Builds the desktop app companion (src/gui/index.tsx) into one CommonJS file,
// dist/gui-experimental.cjs (X28–X30), the package's `./gui-experimental` export.
//
// It uses opencode's own preset, `gui()` from @opencode/plugin/gui/vite (Vite + vite-plugin-solid): Solid
// JSX compiled for the DOM, every dynamic import inlined (the app loads no second chunk), and the modules
// the app provides (GUI_PROVIDED: solid-js, @opencode/plugin/gui, …) kept external, so the bundle shares
// the app's instances. The shared client logic (src/client) is bundled in. The preset fails the build on
// an Effect, Solid or OpenCode module the app does not provide, but not on others (e.g. @opentui/*):
// tests/unit/install-docs.test.ts checks the output.
import path from "node:path"
import { gui } from "@opencode/plugin/gui/vite"
import { build } from "vite"
/** The GUI entry, relative to the repo root. */
export const GUI_ENTRY = "src/gui/index.tsx"
/**
* The modules the app provides to a `./gui-experimental` bundle (a copy of the preset's
* pluginSharedModules + pluginWindowModules, which @opencode/plugin does not export; a test keeps them
* equal). Nothing else may be required at runtime.
*/
export const GUI_PROVIDED: readonly string[] = [
"effect",
"@opencode/plugin/gui",
"@opencode/plugin/gui/main",
"@opencode/plugin/rpc",
"@opencode/schema/rpc",
"@opencode/client",
"@opencode/client/effect",
"solid-js",
"solid-js/web",
"solid-js/store",
"@opencode/plugin/gui/file",
"@opencode/plugin/gui/review",
"@opencode/plugin/gui/browser",
"@opencode/client/solid",
]
/** Writes the bundle to `outFile` (an absolute path) and returns it. */
export async function buildGui(outFile: string): Promise<string> {
const root = path.resolve(import.meta.dir, "..")
await build({
root,
configFile: false,
envFile: false,
publicDir: false,
logLevel: "warn",
plugins: gui({ entry: path.join(root, GUI_ENTRY), outFile }),
// The `@jsxImportSource solid-js` pragma is for tsc (the root tsconfig defaults to opentui's JSX);
// vite-plugin-solid compiles the JSX, so esbuild's note about the pragma is noise.
esbuild: { logOverride: { "unsupported-jsx-comment": "silent" } },
// Readable output: the bundle is small, and a stack trace from the app should point somewhere.
build: { minify: false, reportCompressedSize: false, copyPublicDir: false },
})
return outFile
}
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.