Skip to content

Commit 311d71b

Browse files
committed
fix: forward --registry to vp install during upgrade
1 parent c23947e commit 311d71b

2 files changed

Lines changed: 15 additions & 4 deletions

File tree

crates/vite_global_cli/src/commands/upgrade/install.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,11 @@ pub async fn generate_wrapper_package_json(
109109

110110
/// Install production dependencies using the new version's binary.
111111
///
112-
/// Spawns: `{version_dir}/bin/vp install --silent` with `CI=true`.
113-
pub async fn install_production_deps(version_dir: &AbsolutePath) -> Result<(), Error> {
112+
/// Spawns: `{version_dir}/bin/vp install --silent [--registry <url>]` with `CI=true`.
113+
pub async fn install_production_deps(
114+
version_dir: &AbsolutePath,
115+
registry: Option<&str>,
116+
) -> Result<(), Error> {
114117
let vp_binary = version_dir.join("bin").join(if cfg!(windows) { "vp.exe" } else { "vp" });
115118

116119
if !tokio::fs::try_exists(&vp_binary).await.unwrap_or(false) {
@@ -121,8 +124,14 @@ pub async fn install_production_deps(version_dir: &AbsolutePath) -> Result<(), E
121124

122125
tracing::debug!("Running vp install in {}", version_dir.as_path().display());
123126

127+
let mut args = vec!["install", "--silent"];
128+
if let Some(registry_url) = registry {
129+
args.push("--registry");
130+
args.push(registry_url);
131+
}
132+
124133
let output = tokio::process::Command::new(vp_binary.as_path())
125-
.args(["install", "--silent"])
134+
.args(&args)
126135
.current_dir(version_dir)
127136
.env("CI", "true")
128137
.output()

crates/vite_global_cli/src/commands/upgrade/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ pub async fn execute(options: UpgradeOptions) -> Result<ExitStatus, Error> {
119119
&resolved.version,
120120
current_version,
121121
options.silent,
122+
options.registry.as_deref(),
122123
)
123124
.await;
124125

@@ -140,6 +141,7 @@ async fn install_platform_and_main(
140141
new_version: &str,
141142
current_version: &str,
142143
silent: bool,
144+
registry: Option<&str>,
143145
) -> Result<ExitStatus, Error> {
144146
// Extract platform package (binary only; .node files installed via npm optionalDeps)
145147
install::extract_platform_package(platform_data, version_dir).await?;
@@ -157,7 +159,7 @@ async fn install_platform_and_main(
157159
install::generate_wrapper_package_json(version_dir, new_version).await?;
158160

159161
// Install production dependencies (npm installs vite-plus + all transitive deps)
160-
install::install_production_deps(version_dir).await?;
162+
install::install_production_deps(version_dir, registry).await?;
161163

162164
// Save previous version for rollback
163165
let previous_version = install::save_previous_version(install_dir).await?;

0 commit comments

Comments
 (0)