fix(task): do not eagerly auto-install packages in package.json when "nodeModulesDir": false (#21858)

There's no need to auto-install the package.json if the user is not
using a node_modules directory.

Closes #21850
This commit is contained in:
David Sherret 2024-01-08 19:30:36 -05:00 committed by GitHub
parent 0efb17b2cb
commit be888c068c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 33 additions and 4 deletions

View file

@ -88,10 +88,13 @@ pub async fn execute_script(
}
}
// install the npm packages if we're using a managed resolver
if let Some(npm_resolver) = npm_resolver.as_managed() {
npm_resolver.ensure_top_level_package_json_install().await?;
npm_resolver.resolve_pending().await?;
// ensure the npm packages are installed if using a node_modules
// directory and managed resolver
if cli_options.has_node_modules_dir() {
if let Some(npm_resolver) = npm_resolver.as_managed() {
npm_resolver.ensure_top_level_package_json_install().await?;
npm_resolver.resolve_pending().await?;
}
}
let cwd = match task_flags.cwd {