opencode/script/release-files.ts
Filip Hejmowski a26b0a73e4 fix(ci): keep dev previews and published libraries working with pack-npm
- when pack-npm fails on a non-release run, publish builds the libraries
  in place as before, so the CLI dev preview still ships after client
- library scripts skip versions already on npm in pack mode too, and
  NpmLibraries.verify accepts a missing tarball only for a published
  version, so a re-dispatched release does not rerun every check
- trim comments that restated code and correct inaccurate ones
2026-10-19 15:15:48 +02:00

21 lines
717 B
TypeScript

import { Script } from "@opencode/script"
import { $ } from "bun"
// Shared with script/pack-npm.ts so its libraries build against the same versions and install as publish's 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) {
const pkg = (await Bun.file(file).text()).replaceAll(/"version": "[^"]+"/g, `"version": "${Script.version}"`)
console.log("updated:", file)
await Bun.file(file).write(pkg)
}
await $`bun install`
}