Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(turborepo): Fix single package inference #5362

Merged
merged 4 commits into from
Jun 22, 2023
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
15 changes: 8 additions & 7 deletions crates/turborepo-lib/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -619,9 +619,6 @@ pub async fn run(
}
}

let single_package =
matches!(&repo_state, Some(repo_state) if repo_state.mode == RepoMode::SinglePackage);

let cwd = repo_state
.as_ref()
.map(|state| state.root.as_path())
Expand All @@ -638,11 +635,15 @@ pub async fn run(
// Save all the mutation for the end. In the future, we should refactor this
// into a "parse don't validate" scheme where we construct a config struct
// that is contains all of the normalized, validated, and defaulted values.
if let Command::Run(run_args) = &mut command {
if let Some(pkg_inference_root) = pkg_inference_root {
run_args.pkg_inference_root = Some(pkg_inference_root);
if let Some(repo_state) = repo_state {
if let Command::Run(run_args) = &mut command {
if let Some(pkg_inference_root) = pkg_inference_root {
run_args.pkg_inference_root = Some(pkg_inference_root);
}
// Don't overwrite the flag if it's already been set for whatever reason
run_args.single_package =
run_args.single_package || matches!(repo_state.mode, RepoMode::SinglePackage);
}
run_args.single_package = single_package;
}
cli_args.command = Some(command);
cli_args.cwd = Some(repo_root.as_path().to_owned());
Expand Down