23 lines
772 B
TypeScript
Raw Normal View History

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