Skip to content

Commit

Permalink
chore(turborepo): print the turbo version on start up (#8841)
Browse files Browse the repository at this point in the history
### Description

I realized that we don't ever print the version of turborepo that's
running. This could be helpful for users and also for our testing.

### Testing Instructions

<!--
  Give a quick description of steps to test your changes.
-->
  • Loading branch information
NicholasLYang authored Jul 25, 2024
1 parent a812571 commit 40a331f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
9 changes: 8 additions & 1 deletion crates/turborepo-lib/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use turborepo_telemetry::{
},
init_telemetry, track_usage, TelemetryHandle,
};
use turborepo_ui::UI;
use turborepo_ui::{GREY, UI};

use crate::{
cli::error::print_potential_tasks,
Expand Down Expand Up @@ -991,6 +991,13 @@ pub async fn run(
}
}

let should_print_version = env::var("TURBO_PRINT_VERSION_DISABLED")
.map_or(true, |disable| !matches!(disable.as_str(), "1" | "true"));

if should_print_version {
eprintln!("{}\n", GREY.apply_to(format!("turbo {}", get_version())));
}

// If there is no command, we set the command to `Command::Run` with
// `self.parsed_args.run_args` as arguments.
let mut command = if let Some(command) = mem::take(&mut cli_args.command) {
Expand Down
1 change: 1 addition & 0 deletions turborepo-tests/helpers/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ fi
export TURBO_TELEMETRY_MESSAGE_DISABLED=1
export TURBO_GLOBAL_WARNING_DISABLED=1
export TURBO_DOWNLOAD_LOCAL_ENABLED=0
export TURBO_PRINT_VERSION_DISABLED=1
TURBO=${MONOREPO_ROOT_DIR}/target/debug/turbo${EXT}
1 change: 1 addition & 0 deletions turborepo-tests/helpers/setup_integration_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ fi

export TURBO_TELEMETRY_MESSAGE_DISABLED=1
export TURBO_GLOBAL_WARNING_DISABLED=1
export TURBO_PRINT_VERSION_DISABLED=1
export TURBO=${MONOREPO_ROOT_DIR}/target/debug/turbo${EXT}

# Undo the set -eo pipefail at the top of this script
Expand Down

0 comments on commit 40a331f

Please sign in to comment.