Skip to content

Commit ddfdda9

Browse files
authored
Merge pull request #1670 from rytmis/feature/yarnpkg-shim
feat: support yarnpkg as an alias for yarn
2 parents d1d4139 + 7544015 commit ddfdda9

File tree

6 files changed

+26
-2
lines changed

6 files changed

+26
-2
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ fn get_executor(
9696
binary::command(exe, args, session)
9797
}
9898
}
99-
Some("yarn") => yarn::command(args, session),
99+
Some("yarn") | Some("yarnpkg") => yarn::command(args, session),
100100
_ => binary::command(exe, args, session),
101101
}
102102
}

crates/volta-core/src/shim.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ fn get_shim_list_deduped(dir: &Path) -> Fallible<HashSet<String>> {
3636
shims.insert("npx".into());
3737
shims.insert("pnpm".into());
3838
shims.insert("yarn".into());
39+
shims.insert("yarnpkg".into());
3940
Ok(shims)
4041
}
4142

dev/unix/install.sh.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ volta_create_binaries() {
9292
ln -s "${INSTALL_DIR}"/shim "${INSTALL_DIR}"/bin/npm
9393
ln -s "${INSTALL_DIR}"/shim "${INSTALL_DIR}"/bin/npx
9494
ln -s "${INSTALL_DIR}"/shim "${INSTALL_DIR}"/bin/yarn
95+
ln -s "${INSTALL_DIR}"/shim "${INSTALL_DIR}"/bin/yarnpkg
9596

9697
chmod 755 "${INSTALL_DIR}/"/volta "${INSTALL_DIR}/bin"/* "${INSTALL_DIR}"/shim
9798
}

dev/unix/volta-install-legacy.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ create_symlinks() {
7474
local install_dir="$1"
7575

7676
info 'Creating' "symlinks and shims"
77-
local main_shims=( node npm npx yarn )
77+
local main_shims=( node npm npx yarn yarnpkg )
7878
local shim_exec="$install_dir/shim"
7979
local main_exec="$install_dir/volta"
8080

tests/acceptance/volta_run.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,12 @@ fn command_line_yarn_1() {
370370
.with_status(ExitCode::Success as i32)
371371
.with_stderr_contains("[..]Yarn: 1.7.71 from command-line configuration")
372372
);
373+
assert_that!(
374+
s.volta("run --node 10.99.1040 --yarn 1.7.71 yarnpkg --version"),
375+
execs()
376+
.with_status(ExitCode::Success as i32)
377+
.with_stderr_contains("[..]Yarn: 1.7.71 from command-line configuration")
378+
);
373379
}
374380

375381
#[test]

wix/main.wxs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,22 @@
170170
Source='wix\shim.cmd'
171171
KeyPath='yes'/>
172172
</Component>
173+
<Component Id='yarnPkgBinary' Guid='*' Win64='$(var.Win64)'>
174+
<File
175+
Id='yarnpgkEXE'
176+
Name='yarnpkg.exe'
177+
DiskId='1'
178+
Source='target\release\volta-shim.exe'
179+
KeyPath='yes'/>
180+
</Component>
181+
<Component Id='yarnPkgScript' Guid='*' Win64='$(var.Win64)'>
182+
<File
183+
Id='yarnpkgCMD'
184+
Name='yarnpkg.cmd'
185+
DiskId='1'
186+
Source='wix\shim.cmd'
187+
KeyPath='yes'/>
188+
</Component>
173189
</ComponentGroup>
174190

175191
<Feature Id='MainProgram'>

0 commit comments

Comments
 (0)