mirror of
https://github.com/aljazceru/opencode.git
synced 2026-01-09 10:54:59 +01:00
fix: false positive package manager detection in upgrade (#3181)
This commit is contained in:
@@ -27,9 +27,19 @@ export const UpgradeCommand = {
|
|||||||
const detectedMethod = await Installation.method()
|
const detectedMethod = await Installation.method()
|
||||||
const method = (args.method as Installation.Method) ?? detectedMethod
|
const method = (args.method as Installation.Method) ?? detectedMethod
|
||||||
if (method === "unknown") {
|
if (method === "unknown") {
|
||||||
prompts.log.error(`opencode is installed to ${process.execPath} and seems to be managed by a package manager`)
|
prompts.log.error(`opencode is installed to ${process.execPath} and may be managed by a package manager`)
|
||||||
prompts.outro("Done")
|
const install = await prompts.select({
|
||||||
return
|
message: "Install anyways?",
|
||||||
|
options: [
|
||||||
|
{ label: "Yes", value: true },
|
||||||
|
{ label: "No", value: false },
|
||||||
|
],
|
||||||
|
initialValue: false,
|
||||||
|
})
|
||||||
|
if (!install) {
|
||||||
|
prompts.outro("Done")
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
prompts.log.info("Using method: " + method)
|
prompts.log.info("Using method: " + method)
|
||||||
const target = args.target ? args.target.replace(/^v/, "") : await Installation.latest()
|
const target = args.target ? args.target.replace(/^v/, "") : await Installation.latest()
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ export namespace Installation {
|
|||||||
|
|
||||||
export async function method() {
|
export async function method() {
|
||||||
if (process.execPath.includes(path.join(".opencode", "bin"))) return "curl"
|
if (process.execPath.includes(path.join(".opencode", "bin"))) return "curl"
|
||||||
|
if (process.execPath.includes(path.join(".local", "bin"))) return "curl"
|
||||||
const exec = process.execPath.toLowerCase()
|
const exec = process.execPath.toLowerCase()
|
||||||
|
|
||||||
const checks = [
|
const checks = [
|
||||||
|
|||||||
Reference in New Issue
Block a user