From 36ebc03f177cc7db5deb93f4d403cafbed756eb5 Mon Sep 17 00:00:00 2001 From: Nathan Whitaker <17734409+nathanwhit@users.noreply.github.com> Date: Tue, 24 Sep 2024 12:23:57 -0700 Subject: fix(cli): Warn on not-run lifecycle scripts with global cache (#25786) Refactors the lifecycle scripts code to extract out the common functionality and then uses that to provide a warning in the global resolver. While ideally we would still support them with the global cache, for now a warning is at least better than the status quo (where people are unaware why their packages aren't working). --- cli/args/flags.rs | 3 ++- cli/args/mod.rs | 10 ++-------- 2 files changed, 4 insertions(+), 9 deletions(-) (limited to 'cli/args') diff --git a/cli/args/flags.rs b/cli/args/flags.rs index d325ce7bc..10fa07bed 100644 --- a/cli/args/flags.rs +++ b/cli/args/flags.rs @@ -544,7 +544,8 @@ pub enum CaData { #[derive(Clone, Debug, Eq, PartialEq, Default)] pub struct LifecycleScriptsConfig { pub allowed: PackagesAllowedScripts, - pub initial_cwd: Option, + pub initial_cwd: PathBuf, + pub root_dir: PathBuf, } #[derive(Debug, Clone, Eq, PartialEq, Default)] diff --git a/cli/args/mod.rs b/cli/args/mod.rs index b8a05f325..1c92777ae 100644 --- a/cli/args/mod.rs +++ b/cli/args/mod.rs @@ -1652,14 +1652,8 @@ impl CliOptions { pub fn lifecycle_scripts_config(&self) -> LifecycleScriptsConfig { LifecycleScriptsConfig { allowed: self.flags.allow_scripts.clone(), - initial_cwd: if matches!( - self.flags.allow_scripts, - PackagesAllowedScripts::None - ) { - None - } else { - Some(self.initial_cwd.clone()) - }, + initial_cwd: self.initial_cwd.clone(), + root_dir: self.workspace().root_dir_path(), } } } -- cgit v1.2.3