From 08c1cba64877469f581cd859625bc826dc5ba172 Mon Sep 17 00:00:00 2001 From: Jake Runzer Date: Thu, 8 Jan 2026 16:37:30 -0500 Subject: [PATCH] feat: Add bun support to upgrade command Detect bun global installs by checking for .bun in path. Check must come before npm since bun uses node_modules internally. --- src/commands/upgrade.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/commands/upgrade.rs b/src/commands/upgrade.rs index db8385004..9751987d8 100644 --- a/src/commands/upgrade.rs +++ b/src/commands/upgrade.rs @@ -16,6 +16,7 @@ pub struct Args { enum InstallMethod { Homebrew, Npm, + Bun, Cargo, Shell, Scoop, @@ -39,6 +40,11 @@ impl InstallMethod { return InstallMethod::Homebrew; } + // Check for Bun global install (must be before npm since bun uses node_modules internally) + if path_str.contains(".bun") { + return InstallMethod::Bun; + } + // Check for npm global install if path_str.contains("node_modules") || path_str.contains("npm") @@ -74,6 +80,7 @@ impl InstallMethod { match self { InstallMethod::Homebrew => "Homebrew", InstallMethod::Npm => "npm", + InstallMethod::Bun => "Bun", InstallMethod::Cargo => "Cargo", InstallMethod::Shell => "Shell script", InstallMethod::Scoop => "Scoop", @@ -85,6 +92,7 @@ impl InstallMethod { match self { InstallMethod::Homebrew => Some("brew upgrade railway"), InstallMethod::Npm => Some("npm update -g @railway/cli"), + InstallMethod::Bun => Some("bun update -g @railway/cli"), InstallMethod::Cargo => Some("cargo install railwayapp"), InstallMethod::Scoop => Some("scoop update railway"), InstallMethod::Shell => Some("bash <(curl -fsSL cli.new)"), @@ -97,6 +105,7 @@ impl InstallMethod { self, InstallMethod::Homebrew | InstallMethod::Npm + | InstallMethod::Bun | InstallMethod::Cargo | InstallMethod::Scoop ) @@ -107,6 +116,7 @@ fn run_upgrade_command(method: InstallMethod) -> Result<()> { let (program, args): (&str, Vec<&str>) = match method { InstallMethod::Homebrew => ("brew", vec!["upgrade", "railway"]), InstallMethod::Npm => ("npm", vec!["update", "-g", "@railway/cli"]), + InstallMethod::Bun => ("bun", vec!["update", "-g", "@railway/cli"]), InstallMethod::Cargo => ("cargo", vec!["install", "railwayapp"]), InstallMethod::Scoop => ("scoop", vec!["update", "railway"]), InstallMethod::Shell | InstallMethod::Unknown => { @@ -173,6 +183,9 @@ pub async fn command(args: Args) -> Result<()> { println!(" {}", "npm:".bold()); println!(" npm update -g @railway/cli"); println!(); + println!(" {}", "Bun:".bold()); + println!(" bun update -g @railway/cli"); + println!(); println!(" {}", "Cargo:".bold()); println!(" cargo install railwayapp"); println!();