mirror of
https://github.com/denoland/deno.git
synced 2024-11-21 15:04:11 -05:00
perf: hard link npm cache (#22773)
This commit is contained in:
parent
8df47882c9
commit
e0c9102b49
1 changed files with 6 additions and 2 deletions
|
@ -332,8 +332,12 @@ async fn sync_resolution_with_fs(
|
|||
.with_context(|| format!("Creating '{}'", folder_path.display()))?;
|
||||
let cache_folder = cache
|
||||
.package_folder_for_name_and_version(&package.id.nv, ®istry_url);
|
||||
// for now copy, but in the future consider hard linking
|
||||
copy_dir_recursive(&cache_folder, &package_path)?;
|
||||
if hard_link_dir_recursive(&cache_folder, &package_path).is_err() {
|
||||
// Fallback to copying the directory.
|
||||
//
|
||||
// Also handles EXDEV when when trying to hard link across volumes.
|
||||
copy_dir_recursive(&cache_folder, &package_path)?;
|
||||
}
|
||||
// write out a file that indicates this folder has been initialized
|
||||
fs::write(initialized_file, "")?;
|
||||
// finally stop showing the progress bar
|
||||
|
|
Loading…
Reference in a new issue