fix(macos): install gateway via npm
This commit is contained in:
@@ -164,10 +164,21 @@ enum GatewayEnvironment {
|
|||||||
static func installGlobal(version: Semver?, statusHandler: @escaping @Sendable (String) -> Void) async {
|
static func installGlobal(version: Semver?, statusHandler: @escaping @Sendable (String) -> Void) async {
|
||||||
let preferred = CommandResolver.preferredPaths().joined(separator: ":")
|
let preferred = CommandResolver.preferredPaths().joined(separator: ":")
|
||||||
let target = version?.description ?? "latest"
|
let target = version?.description ?? "latest"
|
||||||
let pnpm = CommandResolver.findExecutable(named: "pnpm") ?? "pnpm"
|
let npm = CommandResolver.findExecutable(named: "npm")
|
||||||
let cmd = [pnpm, "add", "-g", "clawdis@\(target)"]
|
let pnpm = CommandResolver.findExecutable(named: "pnpm")
|
||||||
|
let bun = CommandResolver.findExecutable(named: "bun")
|
||||||
|
let (label, cmd): (String, [String]) =
|
||||||
|
if let npm {
|
||||||
|
("npm", [npm, "install", "-g", "clawdis@\(target)"])
|
||||||
|
} else if let pnpm {
|
||||||
|
("pnpm", [pnpm, "add", "-g", "clawdis@\(target)"])
|
||||||
|
} else if let bun {
|
||||||
|
("bun", [bun, "add", "-g", "clawdis@\(target)"])
|
||||||
|
} else {
|
||||||
|
("npm", ["npm", "install", "-g", "clawdis@\(target)"])
|
||||||
|
}
|
||||||
|
|
||||||
statusHandler("Installing clawdis@\(target) via pnpm…")
|
statusHandler("Installing clawdis@\(target) via \(label)…")
|
||||||
let response = await ShellExecutor.run(command: cmd, cwd: nil, env: ["PATH": preferred], timeout: 300)
|
let response = await ShellExecutor.run(command: cmd, cwd: nil, env: ["PATH": preferred], timeout: 300)
|
||||||
if response.ok {
|
if response.ok {
|
||||||
statusHandler("Installed clawdis@\(target)")
|
statusHandler("Installed clawdis@\(target)")
|
||||||
|
|||||||
@@ -291,7 +291,8 @@ struct OnboardingView: View {
|
|||||||
.foregroundStyle(.secondary)
|
.foregroundStyle(.secondary)
|
||||||
.lineLimit(2)
|
.lineLimit(2)
|
||||||
} else {
|
} else {
|
||||||
Text("Uses \"pnpm add -g clawdis@<version>\" on your PATH. We keep the gateway on port 18789.")
|
Text(
|
||||||
|
"Uses \"npm install -g clawdis@<version>\" on your PATH. We keep the gateway on port 18789.")
|
||||||
.font(.caption)
|
.font(.caption)
|
||||||
.foregroundStyle(.secondary)
|
.foregroundStyle(.secondary)
|
||||||
.lineLimit(2)
|
.lineLimit(2)
|
||||||
|
|||||||
Reference in New Issue
Block a user