Skip to content

Commit bf51bcc

Browse files
authored
chore: remove dead global logic for update command (#1478)
1 parent de26dd6 commit bf51bcc

3 files changed

Lines changed: 0 additions & 30 deletions

File tree

crates/vite_global_cli/src/cli.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1840,7 +1840,6 @@ pub async fn run_command_with_options(
18401840
.execute(
18411841
&packages,
18421842
latest,
1843-
global,
18441843
recursive,
18451844
filter.as_deref(),
18461845
workspace_root,

crates/vite_global_cli/src/commands/update.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ impl UpdateCommand {
2424
self,
2525
packages: &[String],
2626
latest: bool,
27-
global: bool,
2827
recursive: bool,
2928
filters: Option<&[String]>,
3029
workspace_root: bool,
@@ -43,7 +42,6 @@ impl UpdateCommand {
4342
let update_command_options = UpdateCommandOptions {
4443
packages,
4544
latest,
46-
global,
4745
recursive,
4846
filters,
4947
workspace_root,

crates/vite_install/src/commands/update.rs

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ use crate::package_manager::{
1414
pub struct UpdateCommandOptions<'a> {
1515
pub packages: &'a [String],
1616
pub latest: bool,
17-
pub global: bool,
1817
pub recursive: bool,
1918
pub filters: Option<&'a [String]>,
2019
pub workspace_root: bool,
@@ -48,19 +47,6 @@ impl PackageManager {
4847
let envs = HashMap::from([("PATH".to_string(), format_path_env(self.get_bin_prefix()))]);
4948
let mut args: Vec<String> = Vec::new();
5049

51-
// global packages should use npm cli only
52-
if options.global {
53-
bin_name = "npm".into();
54-
args.push("update".into());
55-
args.push("--global".into());
56-
if let Some(pass_through_args) = options.pass_through_args {
57-
args.extend_from_slice(pass_through_args);
58-
}
59-
args.extend_from_slice(options.packages);
60-
61-
return ResolveCommandResult { bin_path: bin_name, args, envs };
62-
}
63-
6450
match self.client {
6551
PackageManagerType::Pnpm => {
6652
bin_name = "pnpm".into();
@@ -249,7 +235,6 @@ mod tests {
249235
let result = pm.resolve_update_command(&UpdateCommandOptions {
250236
packages: &["react".to_string()],
251237
latest: false,
252-
global: false,
253238
recursive: false,
254239
filters: None,
255240
workspace_root: false,
@@ -539,18 +524,6 @@ mod tests {
539524
assert_eq!(result.bin_path, "npm");
540525
}
541526

542-
#[test]
543-
fn test_global_update() {
544-
let pm = create_mock_package_manager(PackageManagerType::Pnpm, "10.0.0");
545-
let result = pm.resolve_update_command(&UpdateCommandOptions {
546-
packages: &["typescript".to_string()],
547-
global: true,
548-
..Default::default()
549-
});
550-
assert_eq!(result.args, vec!["update", "--global", "typescript"]);
551-
assert_eq!(result.bin_path, "npm");
552-
}
553-
554527
#[test]
555528
fn test_pnpm_update_multiple_packages() {
556529
let pm = create_mock_package_manager(PackageManagerType::Pnpm, "10.0.0");

0 commit comments

Comments
 (0)