Skip to content

Commit ebf4dfa

Browse files
authored
feat(cli): upgrade
feat(cli): upgrade
2 parents a60b7c2 + 5b11b81 commit ebf4dfa

File tree

5 files changed

+475
-4
lines changed

5 files changed

+475
-4
lines changed

Cargo.lock

Lines changed: 107 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ authors = ["the Andromeda team"]
77
edition = "2024"
88
license = "Mozilla Public License 2.0"
99
repository = "https://github.com/tryandromeda/andromeda"
10-
version = "0.1.0"
10+
version = "0.1.0-draft1"
1111

1212
[workspace.dependencies]
1313
andromeda-core = { path = "core" }
@@ -43,6 +43,7 @@ ring = "0.17.8"
4343
serde = { version = "1.0.219", features = ["derive"] }
4444
thiserror = "2.0.12"
4545
tokio = { version = "1.45.1", features = ["rt", "sync", "time"] }
46+
ureq = { version = "2.12.1", features = ["json"] }
4647
url = { version = "2.5.4", features = ["serde", "expose_internals"] }
4748
wgpu = { version = "25.0.2", features = ["wgsl", "webgpu"] }
4849

cli/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ nu-ansi-term.workspace = true
2121
nova_vm.workspace = true
2222
andromeda-core.workspace = true
2323
andromeda-runtime.workspace = true
24+
anyhow.workspace = true
2425
oxc_ast.workspace = true
2526
oxc_allocator.workspace = true
2627
oxc_parser.workspace = true
@@ -30,6 +31,8 @@ oxc-miette.workspace = true
3031
oxc_diagnostics.workspace = true
3132
owo-colors.workspace = true
3233
thiserror.workspace = true
34+
ureq.workspace = true
35+
serde.workspace = true
3336
regex.workspace = true
3437
anymap.workspace = true
3538
tokio.workspace = true

cli/src/main.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ mod format;
2222
use format::format_file;
2323
mod helper;
2424
use helper::find_formattable_files;
25+
mod upgrade;
2526

2627
/// A JavaScript runtime
2728
#[derive(Debug, ClapParser)]
@@ -90,6 +91,20 @@ enum Command {
9091
#[arg(value_enum)]
9192
shell: Option<Shell>,
9293
},
94+
/// Upgrade Andromeda to the latest version
95+
Upgrade {
96+
/// Force upgrade even if already on latest version
97+
#[arg(short, long)]
98+
force: bool,
99+
100+
/// Upgrade to a specific version instead of latest
101+
#[arg(short, long)]
102+
version: Option<String>,
103+
104+
/// Show what would be upgraded without actually upgrading
105+
#[arg(long)]
106+
dry_run: bool,
107+
},
93108
}
94109

95110
fn main() {
@@ -181,6 +196,19 @@ fn run_main() -> Result<()> {
181196
generate_completions(shell);
182197
Ok(())
183198
}
199+
Command::Upgrade {
200+
force,
201+
version,
202+
dry_run,
203+
} => upgrade::run_upgrade(force, version, dry_run).map_err(|e| {
204+
AndromedaError::runtime_error(
205+
format!("Upgrade failed: {}", e),
206+
None,
207+
None,
208+
None,
209+
None,
210+
)
211+
}),
184212
}
185213
});
186214
match rt.block_on(nova_thread) {

0 commit comments

Comments
 (0)