diff options
Diffstat (limited to 'cli/npm')
-rw-r--r-- | cli/npm/resolution/snapshot.rs | 5 | ||||
-rw-r--r-- | cli/npm/resolvers/local.rs | 4 |
2 files changed, 9 insertions, 0 deletions
diff --git a/cli/npm/resolution/snapshot.rs b/cli/npm/resolution/snapshot.rs index e986294ec..e8df8286e 100644 --- a/cli/npm/resolution/snapshot.rs +++ b/cli/npm/resolution/snapshot.rs @@ -127,6 +127,11 @@ mod map_to_vec { } impl NpmResolutionSnapshot { + /// Gets if this snapshot is empty. + pub fn is_empty(&self) -> bool { + self.packages.is_empty() && self.pending_unresolved_packages.is_empty() + } + /// Resolve a package from a package requirement. pub fn resolve_pkg_from_pkg_req( &self, diff --git a/cli/npm/resolvers/local.rs b/cli/npm/resolvers/local.rs index 89f5decd8..3e2710165 100644 --- a/cli/npm/resolvers/local.rs +++ b/cli/npm/resolvers/local.rs @@ -236,6 +236,10 @@ async fn sync_resolution_with_fs( registry_url: &Url, root_node_modules_dir_path: &Path, ) -> Result<(), AnyError> { + if snapshot.is_empty() { + return Ok(()); // don't create the directory + } + let deno_local_registry_dir = root_node_modules_dir_path.join(".deno"); fs::create_dir_all(&deno_local_registry_dir).with_context(|| { format!("Creating '{}'", deno_local_registry_dir.display()) |