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/script/src/index.ts at dev · jonBoone/opencode Expand file tree/ Copy pathindex.tsMore file actions 74 lines (65 loc) · 2.42 KB / Copy pathindex.tsFile metadata and controls74 lines (65 loc) · 2.42 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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 import { $ } from "bun" import semver from "semver" import path from "path" const rootPkgPath = path.resolve(import.meta.dir, "../../../package.json") const rootPkg = await Bun.file(rootPkgPath).json() const expectedBunVersion = rootPkg.packageManager?.split("@")[1] if (!expectedBunVersion) { throw new Error("packageManager field not found in root package.json") } // relax version requirement const expectedBunVersionRange = `^${expectedBunVersion}` if (!semver.satisfies(process.versions.bun, expectedBunVersionRange)) { throw new Error(`This script requires bun@${expectedBunVersionRange}, but you are using bun@${process.versions.bun}`) } const env = { OPENCODE_CHANNEL: process.env["OPENCODE_CHANNEL"], OPENCODE_VERSION: process.env["OPENCODE_VERSION"], } const CHANNEL = await (async () => { if (env.OPENCODE_CHANNEL) return env.OPENCODE_CHANNEL if (env.OPENCODE_VERSION && !env.OPENCODE_VERSION.startsWith("0.0.0-")) return "latest" const branch = await $`git branch --show-current`.text().then((x) => x.trim()) if (!branch) return "detached" const channel = branch.replace(/[^a-zA-Z0-9._-]/g, "-") if (/^[a-zA-Z0-9]/.test(channel)) return channel return `branch-${channel}` })() const IS_PREVIEW = CHANNEL !== "latest" // The release workflow's plan job owns release versions; builds only read them. const VERSION = (() => { if (env.OPENCODE_VERSION) return env.OPENCODE_VERSION if (!IS_PREVIEW) throw new Error("OPENCODE_VERSION is required for latest-channel builds") return `0.0.0-${CHANNEL}-${previewBuildNumber()}` })() function previewBuildNumber() { const runNumber = process.env["GITHUB_RUN_NUMBER"] if (!runNumber) return new Date().toISOString().slice(0, 16).replace(/[-:T]/g, "") const runAttempt = process.env["GITHUB_RUN_ATTEMPT"] if (runAttempt && runAttempt !== "1") return `${runNumber}.${runAttempt}` return runNumber } const bot = ["actions-user", "opencode", "opencode-agent[bot]"] const teamPath = path.resolve(import.meta.dir, "../../../.github/TEAM_MEMBERS") const team = [ ...(await Bun.file(teamPath) .text() .then((x) => x.split(/\r?\n/).map((x) => x.trim())) .then((x) => x.filter((x) => x && !x.startsWith("#")))), ...bot, ] export const Script = { get channel() { return CHANNEL }, get version() { return VERSION }, get preview() { return IS_PREVIEW }, get team() { return team }, } console.log(`opencode script`, JSON.stringify(Script, null, 2)) |
| 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. |