Skip to content

Commit

Permalink
Switch to ancestors method
Browse files Browse the repository at this point in the history
  • Loading branch information
cd-work committed Oct 2, 2023
1 parent 6a607ec commit 48849ea
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions lockfile_generator/src/npm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,7 @@ pub(crate) fn find_workspace_root(manifest_path: impl AsRef<Path>) -> Result<Pat
.canonicalize()?;

// Search parent directories for workspace manifests.
let mut path = original_root.as_path();
for _ in 0..WORKSPACE_ROOT_RECURSION_LIMIT {
path = match path.parent() {
Some(root_dir) => root_dir,
None => break,
};

for path in original_root.ancestors().skip(1).take(WORKSPACE_ROOT_RECURSION_LIMIT) {
// Check if directory has an NPM manifest.
let manifest_path = path.join("package.json");
if !manifest_path.exists() {
Expand Down

0 comments on commit 48849ea

Please sign in to comment.