feat(ui): publish ui package (#33681)
This commit is contained in:
parent
e6c45134ab
commit
f4103f5c3a
7 changed files with 90 additions and 6 deletions
26
packages/ui/script/publish.ts
Normal file
26
packages/ui/script/publish.ts
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#!/usr/bin/env bun
|
||||
|
||||
import { Script } from "@opencode-ai/script"
|
||||
import { $ } from "bun"
|
||||
import { rm } from "node:fs/promises"
|
||||
import { fileURLToPath } from "node:url"
|
||||
|
||||
process.chdir(fileURLToPath(new URL("..", import.meta.url)))
|
||||
|
||||
const pkg = (await Bun.file("package.json").json()) as { name: string; version: string }
|
||||
const tarball = `${pkg.name.replace("@", "").replace("/", "-")}-${pkg.version}.tgz`
|
||||
|
||||
if ((await $`npm view ${pkg.name}@${pkg.version} version`.nothrow()).exitCode === 0) {
|
||||
console.log(`already published ${pkg.name}@${pkg.version}`)
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
try {
|
||||
await $`bun run typecheck`
|
||||
await $`bun run test`
|
||||
await rm(tarball, { force: true })
|
||||
await $`bun pm pack`
|
||||
await $`npm publish ${tarball} --access public --tag ${Script.channel}`
|
||||
} finally {
|
||||
await rm(tarball, { force: true })
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue