Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/zpm/src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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();

Expand Down
7 changes: 7 additions & 0 deletions packages/zpm/src/commands/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<InstallMode>,
}
Expand All @@ -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,
Expand Down
13 changes: 9 additions & 4 deletions packages/zpm/src/script.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>) -> Self {
self.stdin = stdin;
self
Expand Down Expand Up @@ -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()));
Expand All @@ -439,7 +444,7 @@ impl ScriptEnvironment {

self.cwd = project.project_cwd
.with_join(package_cwd_rel);

self.attach_package_variables(project, locator)?;

let binaries
Expand Down Expand Up @@ -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)?;
}
Expand Down Expand Up @@ -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;
Expand Down
7 changes: 5 additions & 2 deletions packages/zpm/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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,

Expand Down