From cceaeb3799486b5c970837ee4f7ba90c0c37f77a Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 7 Oct 2025 17:17:51 +0000 Subject: [PATCH] feat: Conditionally skip update notifications Move update notification check to shim to respect NO_UPDATE_NOTIFIER env var. Co-authored-by: anthony.shew --- crates/turborepo-lib/src/shim/mod.rs | 4 ++-- crates/turborepo-updater/src/lib.rs | 7 +------ 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/crates/turborepo-lib/src/shim/mod.rs b/crates/turborepo-lib/src/shim/mod.rs index 9d4e805ed2b80..7d147d682a5a2 100644 --- a/crates/turborepo-lib/src/shim/mod.rs +++ b/crates/turborepo-lib/src/shim/mod.rs @@ -14,7 +14,7 @@ use thiserror::Error; use tiny_gradient::{GradientStr, RGB}; use tracing::{debug, warn}; pub use turbo_state::TurboState; -use turbo_updater::display_update_check; +use turbo_updater::{display_update_check, should_skip_notification}; use turbopath::AbsoluteSystemPathBuf; use turborepo_repository::{ inference::{RepoMode, RepoState}, @@ -316,7 +316,7 @@ fn try_check_for_updates( ) { let package_manager = package_manager.unwrap_or(&PackageManager::Npm); - if args.should_check_for_update() && !config.no_update_notifier() { + if args.should_check_for_update() && !config.no_update_notifier() && !should_skip_notification() { // custom footer for update message let footer = format!( "Follow {username} for updates: {url}", diff --git a/crates/turborepo-updater/src/lib.rs b/crates/turborepo-updater/src/lib.rs index 553dd3c644c64..6657b84247aad 100644 --- a/crates/turborepo-updater/src/lib.rs +++ b/crates/turborepo-updater/src/lib.rs @@ -83,7 +83,7 @@ fn get_tag_from_version(pre: &semver::Prerelease) -> VersionTag { } } -fn should_skip_notification() -> bool { +pub fn should_skip_notification() -> bool { NOTIFIER_DISABLE_VARS .iter() .chain(ENVIRONMENTAL_DISABLE_VARS.iter()) @@ -100,11 +100,6 @@ pub fn display_update_check( interval: Option, package_manager: &PackageManager, ) -> Result<(), UpdateNotifierError> { - // bail early if the user has disabled update notifications - if should_skip_notification() { - return Ok(()); - } - let version = check_for_updates(package_name, current_version, timeout, interval); if let Ok(Some(version)) = version {