1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00

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.
This commit is contained in:
Bartek Iwańczuk 2024-09-27 00:37:49 +01:00 committed by GitHub
parent 7cccb7422b
commit eff64238b6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

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