summaryrefslogtreecommitdiff
path: root/cli/main.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2022-10-21 01:50:55 +0200
committerGitHub <noreply@github.com>2022-10-21 01:50:55 +0200
commit4b6168d5e3a990e7982bcb1a8fb525f1141d8839 (patch)
treec37f464b2e7c7f621be907eddba6985d345063bc /cli/main.rs
parente825022c8262d5152c9919976eeab56d636c859b (diff)
feat(update): prompt for new version once per day (#16375)
<!-- Before submitting a PR, please read http://deno.land/manual/contributing 1. Give the PR a descriptive title. Examples of good title: - fix(std/http): Fix race condition in server - docs(console): Update docstrings - feat(doc): Handle nested reexports Examples of bad title: - fix #7123 - update docs - fix bugs 2. Ensure there is a related issue and it is referenced in the PR text. 3. Ensure there are tests that cover the changes. 4. Ensure `cargo test` passes. 5. Ensure `./tools/format.js` passes without changing files. 6. Ensure `./tools/lint.js` passes. -->
Diffstat (limited to 'cli/main.rs')
-rw-r--r--cli/main.rs29
1 files changed, 5 insertions, 24 deletions
diff --git a/cli/main.rs b/cli/main.rs
index 5faf9c401..f192bea5e 100644
--- a/cli/main.rs
+++ b/cli/main.rs
@@ -807,29 +807,6 @@ async fn run_with_watch(flags: Flags, script: String) -> Result<i32, AnyError> {
Ok(0)
}
-fn check_for_upgrades(cache_dir: PathBuf) {
- // Run a background task that checks for available upgrades. If an earlier
- // run of this background task found a new version of Deno, the new version
- // number (or commit hash for canary builds) is returned.
- let maybe_upgrade_version = tools::upgrade::check_for_upgrades(cache_dir);
-
- // Print a message if an update is available, unless:
- // * stderr is not a tty
- // * we're already running the 'deno upgrade' command.
- if let Some(upgrade_version) = maybe_upgrade_version {
- if atty::is(atty::Stream::Stderr) {
- eprint!(
- "{} ",
- colors::green(format!("Deno {upgrade_version} has been released."))
- );
- eprintln!(
- "{}",
- colors::italic_gray("Run `deno upgrade` to install it.")
- );
- }
- }
-}
-
async fn run_command(
flags: Flags,
run_flags: RunFlags,
@@ -847,7 +824,11 @@ async fn run_command(
// map specified and bare specifier is used on the command line - this should
// probably call `ProcState::resolve` instead
let ps = ProcState::build(flags).await?;
- check_for_upgrades(ps.dir.root.clone());
+
+ // Run a background task that checks for available upgrades. If an earlier
+ // run of this background task found a new version of Deno.
+ tools::upgrade::check_for_upgrades(ps.dir.root.clone());
+
let main_module = if NpmPackageReference::from_str(&run_flags.script).is_ok()
{
ModuleSpecifier::parse(&run_flags.script)?