Skip to content

Commit

Permalink
feat(extract): remove existing modules as needed
Browse files Browse the repository at this point in the history
  • Loading branch information
zkat committed Mar 11, 2023
1 parent 0e22a5f commit d3303b0
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions crates/node-maintainer/src/maintainer.rs
Expand Up @@ -312,6 +312,19 @@ impl NodeMaintainer {

let start = std::time::Instant::now();

if target_dir.exists() {
for entry in std::fs::read_dir(&target_dir)? {
let entry = entry?;
if entry.file_name() == "node_modules" {
continue;
} else if entry.file_type()?.is_dir() {
async_std::fs::remove_dir_all(entry.path()).await?;
} else {
async_std::fs::remove_file(entry.path()).await?;
}
}
}

me.graph[child_idx]
.package
.extract_to_dir(&target_dir, prefer_copy, validate)
Expand Down

0 comments on commit d3303b0

Please sign in to comment.