From eff64238b6c18ba3718c22c3b75a4618412c39e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Fri, 27 Sep 2024 00:37:49 +0100 Subject: [PATCH] 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. --- .../managed/resolvers/common/lifecycle_scripts.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cli/npm/managed/resolvers/common/lifecycle_scripts.rs b/cli/npm/managed/resolvers/common/lifecycle_scripts.rs index 35040386c050a4..f700d4bf91def9 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()));