From 543c687c3474233d674ba9938c40c9a33fab61e8 Mon Sep 17 00:00:00 2001 From: Nathan Whitaker <17734409+nathanwhit@users.noreply.github.com> Date: Thu, 26 Sep 2024 10:13:33 -0700 Subject: feat(install): warn repeatedly about not-run lifecycle scripts on explicit installs (#25878) Currently we only warn once. With this PR, we continue to warn about not-run scripts on explicit `deno install` (or cache). For `run` (or other subcommands) we only warn the once, as we do currently. --- cli/args/flags.rs | 2 ++ cli/args/mod.rs | 6 ++++++ cli/npm/managed/resolvers/common/lifecycle_scripts.rs | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) (limited to 'cli') diff --git a/cli/args/flags.rs b/cli/args/flags.rs index 74ccb512f..4e151d7d9 100644 --- a/cli/args/flags.rs +++ b/cli/args/flags.rs @@ -548,6 +548,8 @@ pub struct LifecycleScriptsConfig { pub allowed: PackagesAllowedScripts, pub initial_cwd: PathBuf, pub root_dir: PathBuf, + /// Part of an explicit `deno install` + pub explicit_install: bool, } #[derive(Debug, Clone, Eq, PartialEq, Default)] diff --git a/cli/args/mod.rs b/cli/args/mod.rs index 80b9afb24..a11d3bc10 100644 --- a/cli/args/mod.rs +++ b/cli/args/mod.rs @@ -1686,6 +1686,12 @@ impl CliOptions { allowed: self.flags.allow_scripts.clone(), initial_cwd: self.initial_cwd.clone(), root_dir: self.workspace().root_dir_path(), + explicit_install: matches!( + self.sub_command(), + DenoSubcommand::Install(_) + | DenoSubcommand::Cache(_) + | DenoSubcommand::Add(_) + ), } } } diff --git a/cli/npm/managed/resolvers/common/lifecycle_scripts.rs b/cli/npm/managed/resolvers/common/lifecycle_scripts.rs index a3c72634b..35040386c 100644 --- a/cli/npm/managed/resolvers/common/lifecycle_scripts.rs +++ b/cli/npm/managed/resolvers/common/lifecycle_scripts.rs @@ -111,7 +111,7 @@ impl<'a> LifecycleScripts<'a> { .push((package, package_path.into_owned())); } } else if !self.strategy.has_run(package) - && !self.strategy.has_warned(package) + && (self.config.explicit_install || !self.strategy.has_warned(package)) { self .packages_with_scripts_not_run -- cgit v1.2.3