Skip to content

Commit cfc8187

Browse files
committed
fix(global): materialize local package installs
1 parent 4e5fce2 commit cfc8187

4 files changed

Lines changed: 9 additions & 3 deletions

File tree

crates/vite_global_cli/src/commands/env/global_install.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,8 +359,14 @@ async fn install_one(
359359

360360
// 4. Run npm install with prefix set to staging directory
361361
// Pipe stdout/stderr so npm output is hidden on success, shown on failure
362+
let mut install_args = vec!["install", "-g", "--no-fund"];
363+
if is_local_package_spec(package_spec) {
364+
install_args.push("--install-links");
365+
}
366+
install_args.push(package_spec);
367+
362368
let output = Command::new(npm_path.as_path())
363-
.args(["install", "-g", "--no-fund", &package_spec])
369+
.args(install_args)
364370
.env("npm_config_prefix", staging_dir.as_path())
365371
.env("PATH", format_path_prepended(node_bin_dir.as_path()))
366372
.stdout(Stdio::piped())

packages/cli/snap-tests-global/command-env-install-parallel/parallel-pkg-a/cli.js

100644100755
File mode changed.

packages/cli/snap-tests-global/command-env-install-parallel/parallel-pkg-b/cli.js

100644100755
File mode changed.

packages/cli/snap-tests-global/command-env-install-parallel/snap.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
> vp install -g --concurrency 1 ./parallel-pkg-a ./parallel-pkg-b # Install multiple global packages
22
info: Installing 2 global packages with Node.js <semver>
3-
✓ Installed ./parallel-pkg-a <semver>
3+
✓ Installed parallel-pkg-a <semver>
44
Bins: parallel-a
55

6-
✓ Installed ./parallel-pkg-b <semver>
6+
✓ Installed parallel-pkg-b <semver>
77
Bins: parallel-b
88

99
> parallel-a && parallel-b # Both binaries should be callable

0 commit comments

Comments
 (0)