mirror of
https://github.com/anomalyco/opencode.git
synced 2026-09-29 17:09:40 +08:00
fix(cli): keep opencode2 as a working alias
This commit is contained in:
@@ -12,5 +12,5 @@ COPY dist/cli-linux-arm64-musl/bin/opencode /usr/local/bin/opencode
|
||||
|
||||
ARG TARGETARCH
|
||||
FROM build-${TARGETARCH}
|
||||
RUN opencode --version
|
||||
RUN ln -s opencode /usr/local/bin/opencode2 && opencode --version && opencode2 --version
|
||||
ENTRYPOINT ["opencode"]
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
console.log(
|
||||
'"opencode2" has been renamed to "opencode". Run "opencode" instead.\n\nIf you have OpenCode v1 installed, you may need to uninstall it so the "opencode" command launches the correct installation.',
|
||||
)
|
||||
process.exit(1)
|
||||
require("./opencode.cjs")
|
||||
|
||||
@@ -18,10 +18,7 @@ const dryRun = process.argv.includes("--dry-run")
|
||||
const pkgver = Script.version.replaceAll("-", ".")
|
||||
const license = Bun.file(path.join(dir, "..", "..", "LICENSE"))
|
||||
const shim = `#!/bin/sh
|
||||
echo '"opencode2" has been renamed to "opencode". Run "opencode" instead.'
|
||||
echo
|
||||
echo 'If you have OpenCode v1 installed, you may need to uninstall it so the "opencode" command launches the correct installation.'
|
||||
exit 1
|
||||
exec "$(dirname "$0")/opencode" "$@"
|
||||
`
|
||||
|
||||
await rm(outdir, { recursive: true, force: true })
|
||||
|
||||
@@ -60,17 +60,13 @@ async function publishDistribution(input: {
|
||||
"",
|
||||
].join("\n"),
|
||||
)
|
||||
if (input.legacyCommand)
|
||||
await Bun.file(`${input.root}/${input.name}/bin/${input.legacyCommand}.cjs`).write(
|
||||
`#!/usr/bin/env node\n\nconsole.log(${JSON.stringify(`"opencode2" has been renamed to "${input.command}". Run "${input.command}" instead.\n\nIf you have OpenCode v1 installed, you may need to uninstall it so the "${input.command}" command launches the correct installation.`)})\nprocess.exit(1)\n`,
|
||||
)
|
||||
await Bun.file(`${input.root}/${input.name}/package.json`).write(
|
||||
JSON.stringify(
|
||||
{
|
||||
name: input.name,
|
||||
bin: {
|
||||
[input.command]: `./bin/${input.command}.exe`,
|
||||
...(input.legacyCommand ? { [input.legacyCommand]: `./bin/${input.legacyCommand}.cjs` } : {}),
|
||||
...(input.legacyCommand ? { [input.legacyCommand]: `./bin/${input.command}.exe` } : {}),
|
||||
},
|
||||
...(input.command !== input.binary ? { opencodeSourceBinary: input.binary } : {}),
|
||||
scripts: { postinstall: "node ./postinstall.mjs" },
|
||||
|
||||
Reference in New Issue
Block a user