GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — opencode/packages/cli/script/app-assets.ts at dev · jonBoone/opencode Expand file tree/ Copy pathapp-assets.tsMore file actions 39 lines (37 loc) · 1.64 KB / Copy pathapp-assets.tsFile metadata and controls39 lines (37 loc) · 1.64 KB 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 import { $ } from "bun" import path from "node:path" import { promisify } from "node:util" import { brotliCompress, constants } from "node:zlib" import { AppArchive } from "../src/app-archive" import { collectFiles } from "./files" export async function buildAppArchive(channel: string, options?: { skipBuild?: boolean }) { if (options?.skipBuild) return AppArchive.encode([]) const root = path.resolve(import.meta.dirname, "../../app") await $`bun run build` .cwd(root) .env({ ...process.env, OPENCODE_CHANNEL: channel, VITE_OPENCODE_SERVER_MODE: "origin" }) return AppArchive.encode( await Promise.all( (await collectFiles(path.join(root, "dist"))) .map((key) => key.replaceAll(path.sep, "/")) .filter((key) => !key.endsWith(".map")) .toSorted() .map(async (key) => { const body = Buffer.from(await Bun.file(path.join(root, "dist", key)).arrayBuffer()) // Independent entries let the server materialize only assets the browser requests. return [key, await compress(body, channel)] as const }), ), ) } // The assets compress once per release, so they take brotli's best quality: about 11% smaller than quality 6 for the // web UI. Each runs on the thread pool, which keeps the build to about a minute. Beta builds on every push and only // bundles the CLI into the desktop app, so it keeps quality 6, which takes a few seconds. function compress(body: Buffer, channel: string) { return promisify(brotliCompress)(body, { params: { [constants.BROTLI_PARAM_QUALITY]: channel === "beta" ? 6 : 11, [constants.BROTLI_PARAM_SIZE_HINT]: body.length, }, }) } |
| 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. |