Skip to content

Commit 7544015

Browse files
committed
feat: map yarnpkg to yarn, so it works across yarn versions
1 parent cb7cbc5 commit 7544015

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

crates/volta-core/src/run/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,7 @@ fn get_executor(
9696
binary::command(exe, args, session)
9797
}
9898
}
99-
Some("yarn") => yarn::command(args, session, "yarn"),
100-
Some("yarnpkg") => yarn::command(args, session, "yarnpkg"),
99+
Some("yarn") | Some("yarnpkg") => yarn::command(args, session),
101100
_ => binary::command(exe, args, session),
102101
}
103102
}

crates/volta-core/src/run/yarn.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,7 @@ use crate::session::{ActivityKind, Session};
1616
///
1717
/// If the command is _not_ a global add / remove or we don't have a default platform, then
1818
/// we will allow Yarn to execute the command as usual.
19-
pub(super) fn command(
20-
args: &[OsString],
21-
session: &mut Session,
22-
yarn_executable: &str,
23-
) -> Fallible<Executor> {
19+
pub(super) fn command(args: &[OsString], session: &mut Session) -> Fallible<Executor> {
2420
session.add_event_start(ActivityKind::Yarn);
2521
// Don't re-evaluate the context or global install interception if this is a recursive call
2622
let platform = match env::var_os(RECURSION_ENV_VAR) {
@@ -37,7 +33,7 @@ pub(super) fn command(
3733
}
3834
};
3935

40-
Ok(ToolCommand::new(yarn_executable, args, platform, ToolKind::Yarn).into())
36+
Ok(ToolCommand::new("yarn", args, platform, ToolKind::Yarn).into())
4137
}
4238

4339
/// Determine the execution context (PATH and failure error message) for Yarn

0 commit comments

Comments
 (0)