diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2024-09-27 00:37:49 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-26 23:37:49 +0000 |
commit | eff64238b6c18ba3718c22c3b75a4618412c39e5 (patch) | |
tree | 3d657fc9003fd926a3214163c6c162aa0ba3d310 /cli/npm | |
parent | 7cccb7422bb9be7a2e87d71ca59c8dabd32c07ec (diff) |
feat: Don't warn about --allow-script when using esbuild (#25894)
`esbuild` can work fine without needing to run post-install script, so
to make it easier on users (especially people using Vite) we are not prompting to run with
`--allow-scripts` again.
We only do that for version >= 0.18.0 to be sure.
Diffstat (limited to 'cli/npm')
-rw-r--r-- | cli/npm/managed/resolvers/common/lifecycle_scripts.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/cli/npm/managed/resolvers/common/lifecycle_scripts.rs b/cli/npm/managed/resolvers/common/lifecycle_scripts.rs index 35040386c..f700d4bf9 100644 --- a/cli/npm/managed/resolvers/common/lifecycle_scripts.rs +++ b/cli/npm/managed/resolvers/common/lifecycle_scripts.rs @@ -4,6 +4,7 @@ use super::bin_entries::BinEntries; use crate::args::LifecycleScriptsConfig; use deno_npm::resolution::NpmResolutionSnapshot; use deno_semver::package::PackageNv; +use deno_semver::Version; use std::borrow::Cow; use std::rc::Rc; @@ -113,6 +114,17 @@ impl<'a> LifecycleScripts<'a> { } else if !self.strategy.has_run(package) && (self.config.explicit_install || !self.strategy.has_warned(package)) { + // Skip adding `esbuild` as it is known that it can work properly without lifecycle script + // being run, and it's also very popular - any project using Vite would raise warnings. + { + let nv = &package.id.nv; + if nv.name == "esbuild" + && nv.version >= Version::parse_standard("0.18.0").unwrap() + { + return; + } + } + self .packages_with_scripts_not_run .push((package, package_path.into_owned())); |