mirror of
https://github.com/denoland/deno.git
synced 2025-01-03 12:58:54 -05:00
fix(deno/upgrade): allow --version vX.Y.Z (#19139)
Instead of just supporting X.Y.Z, support vX.Y.Z. Otherwise we'll try to download something like vvX.Y.Z
This commit is contained in:
parent
27303ef688
commit
ab9a17eeee
1 changed files with 7 additions and 3 deletions
|
@ -294,6 +294,10 @@ pub async fn upgrade(
|
|||
let install_version = match upgrade_flags.version {
|
||||
Some(passed_version) => {
|
||||
let re_hash = lazy_regex::regex!("^[0-9a-f]{40}$");
|
||||
let passed_version = passed_version
|
||||
.strip_prefix('v')
|
||||
.unwrap_or(&passed_version)
|
||||
.to_string();
|
||||
|
||||
if upgrade_flags.canary && !re_hash.is_match(&passed_version) {
|
||||
bail!("Invalid commit hash passed");
|
||||
|
@ -317,9 +321,9 @@ pub async fn upgrade(
|
|||
{
|
||||
log::info!("Version {} is already installed", crate::version::deno());
|
||||
return Ok(());
|
||||
} else {
|
||||
passed_version
|
||||
}
|
||||
|
||||
passed_version
|
||||
}
|
||||
None => {
|
||||
let latest_version = if upgrade_flags.canary {
|
||||
|
@ -363,7 +367,7 @@ pub async fn upgrade(
|
|||
|
||||
let download_url = if upgrade_flags.canary {
|
||||
if env!("TARGET") == "aarch64-apple-darwin" {
|
||||
bail!("Canary builds are not available for M1");
|
||||
bail!("Canary builds are not available for M1/M2");
|
||||
}
|
||||
|
||||
format!(
|
||||
|
|
Loading…
Reference in a new issue