summaryrefslogtreecommitdiff
path: root/cli/graph_util.rs
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2023-04-11 18:10:51 -0400
committerGitHub <noreply@github.com>2023-04-11 18:10:51 -0400
commit8820f6e922d3332d0fdd035b504897503d4cdf3a (patch)
treee7e858bdcc2019812987199e9da5a96b09764652 /cli/graph_util.rs
parent805214626f1058ef3114be302ad7deb6aa834a6d (diff)
fix(npm): do not "npm install" when npm specifier happens to match package.json entry (#18660)
Diffstat (limited to 'cli/graph_util.rs')
-rw-r--r--cli/graph_util.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/cli/graph_util.rs b/cli/graph_util.rs
index 8ea48702a..df4e5132d 100644
--- a/cli/graph_util.rs
+++ b/cli/graph_util.rs
@@ -187,6 +187,7 @@ pub async fn create_graph_and_maybe_check(
let mut graph = ModuleGraph::default();
build_graph_with_npm_resolution(
&mut graph,
+ &cli_resolver,
&ps.npm_resolver,
roots,
&mut cache,
@@ -249,6 +250,7 @@ pub async fn create_graph_and_maybe_check(
pub async fn build_graph_with_npm_resolution<'a>(
graph: &mut ModuleGraph,
+ cli_graph_resolver: &CliGraphResolver,
npm_resolver: &NpmPackageResolver,
roots: Vec<ModuleSpecifier>,
loader: &mut dyn deno_graph::source::Loader,
@@ -256,6 +258,12 @@ pub async fn build_graph_with_npm_resolution<'a>(
) -> Result<(), AnyError> {
graph.build(roots, loader, options).await;
+ // ensure that the top level package.json is installed if a
+ // specifier was matched in the package.json
+ cli_graph_resolver
+ .top_level_package_json_install_if_necessary()
+ .await?;
+
// resolve the dependencies of any pending dependencies
// that were inserted by building the graph
npm_resolver.resolve_pending().await?;