summaryrefslogtreecommitdiffhomepage
path: root/script
diff options
context:
space:
mode:
authorDax Raad <[email protected]>2025-08-03 12:37:59 -0400
committerDax Raad <[email protected]>2025-08-03 13:12:35 -0400
commitd4bac5cdbd54b92eda5e1f8e8e0a892047fa7765 (patch)
tree8395e72e543a580c3c31dfea78b6f655257f7c7a /script
parent263b26647619afe84970b12bd3d013cd4282a080 (diff)
downloadopencode-d4bac5cdbd54b92eda5e1f8e8e0a892047fa7765.tar.gz
opencode-d4bac5cdbd54b92eda5e1f8e8e0a892047fa7765.zip
ci: ignore
Diffstat (limited to 'script')
-rwxr-xr-xscript/publish.ts23
1 files changed, 14 insertions, 9 deletions
diff --git a/script/publish.ts b/script/publish.ts
index 33813a984..970cbb717 100755
--- a/script/publish.ts
+++ b/script/publish.ts
@@ -2,6 +2,8 @@
import { $ } from "bun"
+console.log("=== publishing ===\n")
+
const snapshot = process.env["OPENCODE_SNAPSHOT"] === "true"
const version = snapshot
? `0.0.0-${new Date().toISOString().slice(0, 16).replace(/[-:T]/g, "")}`
@@ -10,24 +12,29 @@ if (!version) {
throw new Error("OPENCODE_VERSION is required")
}
process.env["OPENCODE_VERSION"] = version
+console.log("version:", version)
const pkgjsons = await Array.fromAsync(
new Bun.Glob("**/package.json").scan({
absolute: true,
}),
-)
+).then((arr) => arr.filter((x) => !x.includes("node_modules") && !x.includes("dist")))
const tree = await $`git add . && git write-tree`.text().then((x) => x.trim())
-for await (const file of new Bun.Glob("**/package.json").scan({
- absolute: true,
-})) {
+for (const file of pkgjsons) {
let pkg = await Bun.file(file).text()
pkg = pkg.replaceAll(/"version": "[^"]+"/g, `"version": "${version}"`)
+ console.log("updated:", file)
await Bun.file(file).write(pkg)
}
-await import(`../packages/opencode/script/publish.ts`)
+console.log("\n=== opencode ===\n")
+// await import(`../packages/opencode/script/publish.ts`)
+
+console.log("\n=== sdk ===\n")
await import(`../packages/sdk/js/script/publish.ts`)
+
+console.log("\n=== plugin ===\n")
await import(`../packages/plugin/script/publish.ts`)
// await import(`../packages/sdk/stainless/generate.ts`)
@@ -43,9 +50,7 @@ if (snapshot) {
await $`git push origin v${version} --no-verify`
await $`git checkout dev`
await $`git branch -D snapshot-${version}`
- for await (const file of new Bun.Glob("**/package.json").scan({
- absolute: true,
- })) {
- $`await git checkout ${tree} ${file}`
+ for (const file of pkgjsons) {
+ await $`git checkout ${tree} ${file}`
}
}