mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-29 11:42:17 +00:00
A new pack-npm job applies the release version rewrite and runs the 14 library publish scripts in a pack-only mode (OPENCODE_NPM_PACK_DIR), with their typecheck, ui tests and codemode smoke install, and uploads the tarballs. It has only contents: read and no secrets. publish downloads them and sets OPENCODE_NPM_TARBALLS. script/publish.ts checks that every tarball exists and holds the expected name and version before it publishes anything, and each library script keeps its npm view check and then publishes its carried tarball instead of building again. Without either variable the scripts behave as before. The version rewrite moves to script/release-files.ts so publish and pack-npm share it.
23 lines
774 B
TypeScript
23 lines
774 B
TypeScript
import { Script } from "@opencode/script"
|
|
import { $ } from "bun"
|
|
|
|
// Shared by script/publish.ts and script/pack-npm.ts, so the libraries pack-npm builds see the same package versions
|
|
// and install as a build in publish would.
|
|
export async function packageJsons() {
|
|
return Array.fromAsync(
|
|
new Bun.Glob("**/package.json").scan({
|
|
absolute: true,
|
|
}),
|
|
).then((arr) => arr.filter((x) => !x.includes("node_modules") && !x.includes("dist")))
|
|
}
|
|
|
|
export async function prepareReleaseFiles(files: string[]) {
|
|
for (const file of files) {
|
|
let pkg = await Bun.file(file).text()
|
|
pkg = pkg.replaceAll(/"version": "[^"]+"/g, `"version": "${Script.version}"`)
|
|
console.log("updated:", file)
|
|
await Bun.file(file).write(pkg)
|
|
}
|
|
|
|
await $`bun install`
|
|
}
|