Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion crates/turborepo-lib/src/shim/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,36 @@ fn run_correct_turbo(
debug!("Running command as global turbo");
let should_warn_on_global = env::var(TURBO_GLOBAL_WARNING_DISABLED)
.map_or(true, |disable| !matches!(disable.as_str(), "1" | "true"));

let declared_version = repo_state
.root_package_json
.dependencies
.as_ref()
.and_then(|deps| deps.get("turbo"))
.or_else(|| {
repo_state
.root_package_json
.dev_dependencies
.as_ref()
.and_then(|deps| deps.get("turbo"))
});

if should_warn_on_global {
warn!("No locally installed `turbo` found. Using version: {version}.");
if let Some(declared_version) = declared_version {
warn!(
"No locally installed `turbo` found in your repository. Using globally \
installed version ({version}), which can cause unexpected \
behavior.\n\nInstalling the version in your repository ({declared_version}) \
before calling `turbo` will result in more predictable behavior across \
environments."
);
} else {
warn!(
"No locally installed `turbo` found in your repository. Using globally \
installed version ({version}). Using a specified version in your repository \
will result in more predictable behavior."
);
}
}
Ok(cli::run(Some(repo_state), subscriber, ui)?)
}
Expand Down
Loading