Skip to content

Commit

Permalink
feat: Don't warn about --allow-script when using esbuild (#25894)
Browse files Browse the repository at this point in the history
`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.
  • Loading branch information
bartlomieju authored Sep 26, 2024
1 parent 7cccb74 commit eff6423
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions cli/npm/managed/resolvers/common/lifecycle_scripts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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()));
Expand Down

0 comments on commit eff6423

Please sign in to comment.