mirror of
https://github.com/denoland/deno.git
synced 2025-03-03 17:34:47 -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()))?;
|
.with_context(|| format!("Creating '{}'", folder_path.display()))?;
|
||||||
let cache_folder = cache
|
let cache_folder = cache
|
||||||
.package_folder_for_name_and_version(&package.id.nv, ®istry_url);
|
.package_folder_for_name_and_version(&package.id.nv, ®istry_url);
|
||||||
// for now copy, but in the future consider hard linking
|
if hard_link_dir_recursive(&cache_folder, &package_path).is_err() {
|
||||||
copy_dir_recursive(&cache_folder, &package_path)?;
|
// 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
|
// write out a file that indicates this folder has been initialized
|
||||||
fs::write(initialized_file, "")?;
|
fs::write(initialized_file, "")?;
|
||||||
// finally stop showing the progress bar
|
// finally stop showing the progress bar
|
||||||
|
|
Loading…
Add table
Reference in a new issue