Skip to content

Commit

Permalink
fix(turborepo): Fix single package inference (#5362)
Browse files Browse the repository at this point in the history
Co-authored-by: Greg Soltis <Greg Soltis>
  • Loading branch information
Greg Soltis authored Jun 22, 2023
1 parent b0649f6 commit 98d898b
Showing 1 changed file with 8 additions and 7 deletions.
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

0 comments on commit 98d898b

Please sign in to comment.