Skip to content

Commit de47ed9

Browse files
authored
refactor(pm): move install, add and remove to commands mod (#252)
### TL;DR Reorganized package manager command modules into a more structured directory layout. ### What changed? - Moved `add.rs`, `install.rs`, and `remove.rs` into the `commands` directory - Updated the `commands/mod.rs` file to expose these modules - Updated imports in `lib.rs` to reflect the new module structure - Fixed all references to these modules in the CLI binding code ### How to test? 1. Run the existing test suite to ensure all functionality still works 2. Try using the CLI to add, remove, and update packages to verify the commands still function properly 3. Verify that imports work correctly by building the project ### Why make this change? This change improves the code organization by grouping all command-related modules under a single `commands` directory. This creates a more logical structure where related functionality is grouped together, making the codebase easier to navigate and maintain.
1 parent c4088c9 commit de47ed9

8 files changed

Lines changed: 8 additions & 8 deletions

File tree

File renamed without changes.
File renamed without changes.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1+
pub mod add;
2+
mod install;
3+
pub mod remove;
14
pub mod update;
File renamed without changes.

crates/vite_package_manager/src/lib.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
pub mod add;
21
pub mod commands;
32
mod config;
4-
mod install;
53
pub mod package;
64
pub mod package_manager;
7-
pub mod remove;
85
mod request;
96
mod shim;
107

@@ -20,10 +17,8 @@ use vite_str::Str;
2017
use wax::Glob;
2118

2219
pub use crate::{
23-
add::{AddCommandOptions, SaveDependencyType},
2420
package::{DependencyType, PackageJson},
2521
package_manager::{WorkspaceFile, WorkspaceRoot, find_package_root, find_workspace_root},
26-
remove::RemoveCommandOptions,
2722
};
2823

2924
/// The workspace configuration for pnpm.

packages/cli/binding/src/cli.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use clap::{Parser, Subcommand};
99
use serde::{Deserialize, Serialize};
1010
use tokio::fs::write;
1111
use vite_error::Error;
12-
use vite_package_manager::SaveDependencyType;
12+
use vite_package_manager::commands::add::SaveDependencyType;
1313
use vite_path::AbsolutePathBuf;
1414
use vite_str::Str;
1515
use vite_task::{

packages/cli/binding/src/commands/add.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::process::ExitStatus;
22

33
use vite_package_manager::{
4-
add::{AddCommandOptions, SaveDependencyType},
4+
commands::add::{AddCommandOptions, SaveDependencyType},
55
package_manager::PackageManager,
66
};
77
use vite_path::AbsolutePathBuf;

packages/cli/binding/src/commands/remove.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
use std::process::ExitStatus;
22

3-
use vite_package_manager::{package_manager::PackageManager, remove::RemoveCommandOptions};
3+
use vite_package_manager::{
4+
commands::remove::RemoveCommandOptions, package_manager::PackageManager,
5+
};
46
use vite_path::AbsolutePathBuf;
57

68
use crate::Error;

0 commit comments

Comments
 (0)