diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2023-09-30 12:06:38 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-30 12:06:38 -0400 |
commit | 8d24be1a59714761665516e0d78d25059608c29b (patch) | |
tree | aed0140b63441008cb9b549d44948f7a36a4f5f1 /cli/graph_util.rs | |
parent | 1cda3840ff673512f7c6d58fa8402c35c760bc3b (diff) |
refactor(npm): create `cli::npm::managed` module (#20740)
Creates the `cli::npm::managed` module and starts moving more
functionality into it.
Diffstat (limited to 'cli/graph_util.rs')
-rw-r--r-- | cli/graph_util.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/cli/graph_util.rs b/cli/graph_util.rs index a4a5dcab1..17437ca99 100644 --- a/cli/graph_util.rs +++ b/cli/graph_util.rs @@ -322,7 +322,9 @@ impl ModuleGraphBuilder { // ensure an "npm install" is done if the user has explicitly // opted into using a node_modules directory if self.options.node_modules_dir_enablement() == Some(true) { - self.resolver.force_top_level_package_json_install().await?; + if let Some(npm_resolver) = self.npm_resolver.as_managed() { + npm_resolver.ensure_top_level_package_json_install().await?; + } } // add the lockfile redirects to the graph if it's the first time executing @@ -393,10 +395,9 @@ impl ModuleGraphBuilder { if let Some(npm_resolver) = self.npm_resolver.as_managed() { // ensure that the top level package.json is installed if a // specifier was matched in the package.json - self - .resolver - .top_level_package_json_install_if_necessary() - .await?; + if self.resolver.found_package_json_dep() { + npm_resolver.ensure_top_level_package_json_install().await?; + } // resolve the dependencies of any pending dependencies // that were inserted by building the graph |