diff --git a/packages/zpm/src/build.rs b/packages/zpm/src/build.rs index 3c7066ff..ef6db22a 100644 --- a/packages/zpm/src/build.rs +++ b/packages/zpm/src/build.rs @@ -58,6 +58,8 @@ impl BuildRequest { .with_project(project) .with_package(project, &self.locator)? .with_env_variable("INIT_CWD", cwd_abs.as_str()) + // TODO: Use streams prefixed with STDOUT / STDERR just like in Yarn. + .with_shell_forwarding(project.config.project.enable_inline_builds.value) .with_cwd(cwd_abs.clone()); let res = with_context_result(ReportContext::Locator(self.locator.clone()), async { @@ -308,7 +310,7 @@ impl<'a> BuildManager<'a> { } self.trigger(project, &build_state_in); - + let mut current_build_state_out = self.build_state_out.clone(); diff --git a/packages/zpm/src/commands/install.rs b/packages/zpm/src/commands/install.rs index f69fca05..a8b67b66 100644 --- a/packages/zpm/src/commands/install.rs +++ b/packages/zpm/src/commands/install.rs @@ -22,6 +22,9 @@ pub struct Install { #[cli::option("--refresh-lockfile", default = false)] refresh_lockfile: bool, + #[cli::option("--inline-builds", default = false)] + inline_builds: bool, + #[cli::option("--mode")] mode: Option, } @@ -40,6 +43,10 @@ impl Install { project.config.project.enable_immutable_cache.value = true; } + if self.inline_builds { + project.config.project.enable_inline_builds.value = true; + } + project.run_install(RunInstallOptions { check_checksums: self.check_checksums, check_resolutions: self.check_resolutions, diff --git a/packages/zpm/src/script.rs b/packages/zpm/src/script.rs index fc369b97..b2ea23cc 100644 --- a/packages/zpm/src/script.rs +++ b/packages/zpm/src/script.rs @@ -353,6 +353,11 @@ impl ScriptEnvironment { self } + pub fn with_shell_forwarding(mut self, shell_forwarding: bool) -> Self { + self.shell_forwarding = shell_forwarding; + self + } + pub fn with_stdin(mut self, stdin: Option) -> Self { self.stdin = stdin; self @@ -421,7 +426,7 @@ impl ScriptEnvironment { let manifest_location_abs = project.project_cwd .with_join(package_location_rel) .with_join_str("package.json"); - + self.env.insert("npm_package_name".to_string(), Some(locator.ident.to_file_string())); self.env.insert("npm_package_version".to_string(), Some(resolution.version.to_file_string())); self.env.insert("npm_package_json".to_string(), Some(manifest_location_abs.to_file_string())); @@ -439,7 +444,7 @@ impl ScriptEnvironment { self.cwd = project.project_cwd .with_join(package_cwd_rel); - + self.attach_package_variables(project, locator)?; let binaries @@ -490,7 +495,7 @@ impl ScriptEnvironment { for binary in &self.binaries.binaries { make_path_wrapper(&temp_dir, &binary.name, &binary.argv0, &binary.args)?; } - + temp_dir .fs_rename(&dir)?; } @@ -555,7 +560,7 @@ impl ScriptEnvironment { let mut child = cmd.spawn().unwrap(); - + if let Some(stdin) = &self.stdin { if let Some(mut child_stdin) = child.stdin.take() { use tokio::io::AsyncWriteExt; diff --git a/packages/zpm/src/settings.rs b/packages/zpm/src/settings.rs index da65d23d..1a040747 100644 --- a/packages/zpm/src/settings.rs +++ b/packages/zpm/src/settings.rs @@ -6,7 +6,7 @@ use zpm_semver::RangeKind; use zpm_utils::{FromFileString, Path, ToFileString, ToHumanString}; use crate::{ - config::ConfigPaths, + config::ConfigPaths, config_fields::{BoolField, DictField, EnumField, GlobField, PathField, StringField, UintField, VecField}, primitives::{ descriptor::{descriptor_map_deserializer, descriptor_map_serializer}, @@ -75,7 +75,7 @@ pub enum NodeLinker { /** * Configuration settings obtained from the environment variables only. Those * variables are extracted whenever the program starts and are never updated. - * + * * In general you only want to use this for one-off debugging settings. */ #[yarn_config] @@ -144,6 +144,9 @@ pub struct ProjectConfig { #[default(false)] pub enable_immutable_installs: BoolField, + #[default(|_| zpm_ci::is_ci().is_some())] + pub enable_inline_builds: BoolField, + #[default(true)] pub enable_scripts: BoolField,