summaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
Diffstat (limited to 'cli')
-rw-r--r--cli/tools/upgrade.rs66
1 files changed, 65 insertions, 1 deletions
diff --git a/cli/tools/upgrade.rs b/cli/tools/upgrade.rs
index 1b51e9034..d5bd2b3bb 100644
--- a/cli/tools/upgrade.rs
+++ b/cli/tools/upgrade.rs
@@ -162,6 +162,14 @@ impl<TEnvironment: UpdateCheckerEnvironment> UpdateChecker<TEnvironment> {
}
}
+fn get_minor_version(version: &str) -> &str {
+ version.rsplitn(2, '.').collect::<Vec<&str>>()[1]
+}
+
+fn has_same_minor_version(current_version: &str, new_version: &str) -> bool {
+ get_minor_version(current_version) == get_minor_version(new_version)
+}
+
pub fn check_for_upgrades(http_client: HttpClient, cache_file_path: PathBuf) {
if env::var("DENO_NO_UPDATE_CHECK").is_ok() {
return;
@@ -199,12 +207,26 @@ pub fn check_for_upgrades(http_client: HttpClient, cache_file_path: PathBuf) {
"{} {} → {} ",
colors::green("A new release of Deno is available:"),
colors::cyan(version::deno()),
- colors::cyan(upgrade_version)
+ colors::cyan(&upgrade_version)
);
eprintln!(
"{}",
colors::italic_gray("Run `deno upgrade` to install it.")
);
+ eprint!(
+ "{}{}",
+ colors::yellow(
+ "Release notes: https://github.com/denoland/deno/releases/tag/v"
+ ),
+ colors::yellow(&upgrade_version),
+ );
+ if !has_same_minor_version(&version::deno(), &upgrade_version) {
+ eprint!(
+ "{}{}",
+ colors::yellow("Blog post: https://deno.com/blog/v"),
+ colors::yellow(get_minor_version(&upgrade_version)),
+ );
+ }
}
update_checker.store_prompted();
@@ -290,6 +312,16 @@ pub async fn upgrade(
&& current_is_passed
{
log::info!("Version {} is already installed", crate::version::deno());
+ log::info!(
+ "{}{}",
+ "Release notes: https://github.com/denoland/deno/releases/tag/v",
+ crate::version::deno(),
+ );
+ log::info!(
+ "{}{}",
+ "Blog post: https://deno.com/blog/v",
+ get_minor_version(&crate::version::deno())
+ );
return Ok(());
} else {
passed_version
@@ -327,6 +359,18 @@ pub async fn upgrade(
crate::version::deno()
}
);
+ if !upgrade_flags.canary {
+ log::info!(
+ "{}{}",
+ "Release notes: https://github.com/denoland/deno/releases/tag/v",
+ crate::version::deno(),
+ );
+ log::info!(
+ "{}{}",
+ "Blog post: https://deno.com/blog/v",
+ get_minor_version(&crate::version::deno())
+ );
+ }
return Ok(());
} else {
log::info!("Found latest version {}", latest_version);
@@ -364,6 +408,16 @@ pub async fn upgrade(
if upgrade_flags.dry_run {
fs::remove_file(&new_exe_path)?;
log::info!("Upgraded successfully (dry run)");
+ log::info!(
+ "{}{}",
+ "Release notes: https://github.com/denoland/deno/releases/tag/v",
+ install_version,
+ );
+ log::info!(
+ "{}{}",
+ "Blog post: https://deno.com/blog/v",
+ get_minor_version(&install_version)
+ );
} else {
let output_exe_path =
upgrade_flags.output.as_ref().unwrap_or(&current_exe_path);
@@ -395,6 +449,16 @@ pub async fn upgrade(
}
}
log::info!("Upgraded successfully");
+ log::info!(
+ "{}{}",
+ "Release notes: https://github.com/denoland/deno/releases/tag/v",
+ &install_version,
+ );
+ log::info!(
+ "{}{}",
+ "Blog post: https://deno.com/blog/v",
+ get_minor_version(&install_version)
+ );
}
Ok(())