opencode_offline/packages/plugin/script/publish.ts

22 lines
730 B
TypeScript
Raw Normal View History

2025-08-03 06:50:19 +08:00
#!/usr/bin/env bun
2025-10-16 07:53:14 +08:00
import { Script } from "@opencode-ai/script"
import { $ } from "bun"
2025-08-03 06:50:19 +08:00
const dir = new URL("..", import.meta.url).pathname
process.chdir(dir)
await $`bun tsc`
2025-09-29 13:06:12 +08:00
const pkg = await import("../package.json").then((m) => m.default)
2025-09-29 13:22:39 +08:00
const original = JSON.parse(JSON.stringify(pkg))
2025-09-27 16:10:56 +08:00
for (const [key, value] of Object.entries(pkg.exports)) {
2025-09-29 13:22:39 +08:00
const file = value.replace("./src/", "./dist/").replace(".ts", "")
2025-10-16 07:53:14 +08:00
// @ts-ignore
2025-09-27 16:10:56 +08:00
pkg.exports[key] = {
import: file + ".js",
types: file + ".d.ts",
}
}
2025-09-29 13:22:39 +08:00
await Bun.write("package.json", JSON.stringify(pkg, null, 2))
2025-12-10 10:06:57 +08:00
await $`bun pm pack && npm publish *.tgz --tag ${Script.channel} --access public`
2025-09-29 13:22:39 +08:00
await Bun.write("package.json", JSON.stringify(original, null, 2))