mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-08-30 17:14:40 +08:00
fix: fix publish legacy
This commit is contained in:
Executable
+80
@@ -0,0 +1,80 @@
|
||||
#!/usr/bin/env bun
|
||||
import { $ } from "bun"
|
||||
import pkg from "../package.json"
|
||||
import { Script } from "@opencode-ai/script"
|
||||
import { fileURLToPath } from "url"
|
||||
|
||||
const dir = fileURLToPath(new URL("..", import.meta.url))
|
||||
process.chdir(dir)
|
||||
|
||||
const { binaries } = await import("./build.ts")
|
||||
{
|
||||
const name = `${pkg.name}-${process.platform}-${process.arch}`
|
||||
console.log(`smoke test: running dist/${name}/bin/kilo --version`)
|
||||
await $`./dist/${name}/bin/kilo --version`
|
||||
}
|
||||
|
||||
await $`mkdir -p ./dist/${pkg.name}`
|
||||
await $`cp -r ./bin ./dist/${pkg.name}/bin`
|
||||
await $`cp ./script/postinstall.mjs ./dist/${pkg.name}/postinstall.mjs`
|
||||
|
||||
await Bun.file(`./dist/${pkg.name}/package.json`).write(
|
||||
JSON.stringify(
|
||||
{
|
||||
name: pkg.name,
|
||||
bin: {
|
||||
kilo: `./bin/kilo`,
|
||||
kilocode: `./bin/kilo`,
|
||||
},
|
||||
scripts: {
|
||||
postinstall: "bun ./postinstall.mjs || node ./postinstall.mjs",
|
||||
},
|
||||
version: Script.version,
|
||||
optionalDependencies: binaries,
|
||||
repository: {
|
||||
type: "git",
|
||||
url: "https://github.com/Kilo-Org/kilo",
|
||||
},
|
||||
},
|
||||
null,
|
||||
2,
|
||||
),
|
||||
)
|
||||
|
||||
const tags = [Script.channel]
|
||||
|
||||
const tasks = Object.entries(binaries).map(async ([name]) => {
|
||||
if (process.platform !== "win32") {
|
||||
await $`chmod -R 755 .`.cwd(`./dist/${name}`)
|
||||
}
|
||||
await $`bun pm pack`.cwd(`./dist/${name}`)
|
||||
for (const tag of tags) {
|
||||
await $`npm publish *.tgz --access public --tag ${tag} --provenance`.cwd(`./dist/${name}`)
|
||||
}
|
||||
})
|
||||
await Promise.all(tasks)
|
||||
for (const tag of tags) {
|
||||
await $`cd ./dist/${pkg.name} && bun pm pack && npm publish *.tgz --access public --tag ${tag} --provenance`
|
||||
}
|
||||
|
||||
if (!Script.preview) {
|
||||
// Create archives for GitHub release
|
||||
// kilocode_change start - use absolute paths to avoid issues with scoped package names containing '/'
|
||||
const archiveDir = `${dir}/dist/archives`
|
||||
await $`mkdir -p ${archiveDir}`
|
||||
for (const key of Object.keys(binaries)) {
|
||||
const archiveName = key.replace("/", "-") // @kilocode/cli-linux-arm64 → @kilocode-cli-linux-arm64
|
||||
if (key.includes("linux")) {
|
||||
await $`tar -czf ${archiveDir}/${archiveName}.tar.gz *`.cwd(`dist/${key}/bin`)
|
||||
} else {
|
||||
await $`zip -r ${archiveDir}/${archiveName}.zip *`.cwd(`dist/${key}/bin`)
|
||||
}
|
||||
}
|
||||
// kilocode_change end
|
||||
|
||||
const image = "ghcr.io/kilo-org/kilo" // kilocode_change
|
||||
const platforms = "linux/amd64,linux/arm64"
|
||||
const tags = [`${image}:${Script.version}`, `${image}:latest`]
|
||||
const tagFlags = tags.flatMap((t) => ["-t", t])
|
||||
await $`docker buildx build --platform ${platforms} ${tagFlags} --push .`
|
||||
}
|
||||
@@ -69,7 +69,7 @@ await Bun.file(extensionToml).write(toml)
|
||||
await $`bun install`
|
||||
|
||||
console.log("\n=== opencode ===\n")
|
||||
await import(`../packages/opencode/script/publish.ts`)
|
||||
await import(`../packages/opencode/script/legacy-publish.ts`)
|
||||
|
||||
console.log("\n=== sdk ===\n")
|
||||
await import(`../packages/sdk/js/script/publish.ts`)
|
||||
|
||||
Reference in New Issue
Block a user