Skip to content

feat(pm): add remove command for package dependencies#237

Merged
fengmk2 merged 1 commit intomainfrom
10-20-feat_pm_support_remove_package
Oct 23, 2025
Merged

feat(pm): add remove command for package dependencies#237
fengmk2 merged 1 commit intomainfrom
10-20-feat_pm_support_remove_package

Conversation

@fengmk2
Copy link
Copy Markdown
Member

@fengmk2 fengmk2 commented Oct 20, 2025

TL;DR

Added a new remove command to the package manager to uninstall dependencies with support for npm, yarn, and pnpm.

What changed?

  • Added a new remove.rs module to vite_package_manager crate that implements package removal functionality
  • Implemented RemoveCommandOptions struct to handle various removal options (workspace, recursive, global, etc.)
  • Added support for translating the remove command to the appropriate syntax for npm, yarn, and pnpm
  • Added the remove command to the CLI with aliases (rm, un, uninstall)
  • Added comprehensive tests for all package managers and scenarios
  • Added snap tests to verify the command works correctly in real-world scenarios

How to test?

You can test the new command with:

# Basic usage
vite remove lodash

# Remove dev dependencies
vite remove -D typescript

# Remove from workspace root
vite remove -w lodash

# Remove recursively from all workspaces
vite remove -r lodash

# Remove from specific workspace
vite remove --filter=app lodash

# Remove global packages
vite remove -g typescript

Why make this change?

This complements the existing add command, providing a complete package management experience within the Vite CLI. Users can now both add and remove dependencies without having to remember the specific syntax for different package managers. The implementation handles the differences between npm, yarn, and pnpm, making it easier for users to work with monorepos and different dependency types.

@fengmk2 fengmk2 changed the title feat(pm): support remove package feat(pm): add remove command for package dependencies Oct 20, 2025
Copy link
Copy Markdown
Member Author

fengmk2 commented Oct 20, 2025

@fengmk2 fengmk2 self-assigned this Oct 20, 2025
@fengmk2 fengmk2 marked this pull request as ready for review October 20, 2025 13:23
@fengmk2 fengmk2 force-pushed the 10-20-feat_pm_support_remove_package branch from 59f8647 to 88d9620 Compare October 21, 2025 02:58
@fengmk2 fengmk2 force-pushed the 10-11-feat_pm_support_add_package branch 3 times, most recently from f8f51e7 to ead3479 Compare October 21, 2025 07:02
@fengmk2 fengmk2 force-pushed the 10-20-feat_pm_support_remove_package branch from 88d9620 to 4d14157 Compare October 21, 2025 11:41
@fengmk2 fengmk2 changed the base branch from 10-11-feat_pm_support_add_package to graphite-base/237 October 22, 2025 05:42
@fengmk2 fengmk2 force-pushed the 10-20-feat_pm_support_remove_package branch from 4d14157 to 0da1898 Compare October 23, 2025 01:55
@fengmk2 fengmk2 changed the base branch from graphite-base/237 to 10-11-feat_pm_support_add_package October 23, 2025 01:55
@fengmk2 fengmk2 force-pushed the 10-20-feat_pm_support_remove_package branch from 0da1898 to a082d7d Compare October 23, 2025 02:03
@fengmk2 fengmk2 force-pushed the 10-11-feat_pm_support_add_package branch from 1776b0f to 777bd7c Compare October 23, 2025 02:03
@fengmk2 fengmk2 force-pushed the 10-20-feat_pm_support_remove_package branch from a082d7d to 80f4466 Compare October 23, 2025 03:05
@fengmk2 fengmk2 force-pushed the 10-11-feat_pm_support_add_package branch 2 times, most recently from 20d51ba to 23ad827 Compare October 23, 2025 05:02
@fengmk2 fengmk2 force-pushed the 10-20-feat_pm_support_remove_package branch from 80f4466 to 9c80889 Compare October 23, 2025 05:02
@fengmk2 fengmk2 force-pushed the 10-11-feat_pm_support_add_package branch from 23ad827 to 320d654 Compare October 23, 2025 07:32
@fengmk2 fengmk2 force-pushed the 10-20-feat_pm_support_remove_package branch 2 times, most recently from c7552de to 419e76d Compare October 23, 2025 08:01
@fengmk2 fengmk2 force-pushed the 10-11-feat_pm_support_add_package branch from 320d654 to c6a3c8c Compare October 23, 2025 08:01
@fengmk2 fengmk2 force-pushed the 10-20-feat_pm_support_remove_package branch from 419e76d to 2d3b5b1 Compare October 23, 2025 08:16
@fengmk2 fengmk2 force-pushed the 10-11-feat_pm_support_add_package branch 2 times, most recently from 25352cf to 805bfae Compare October 23, 2025 08:24
@fengmk2 fengmk2 force-pushed the 10-20-feat_pm_support_remove_package branch from 2d3b5b1 to 6ad482c Compare October 23, 2025 08:24
@fengmk2 fengmk2 force-pushed the 10-11-feat_pm_support_add_package branch from 805bfae to 5004b6b Compare October 23, 2025 08:38
@fengmk2 fengmk2 force-pushed the 10-20-feat_pm_support_remove_package branch 2 times, most recently from 5412a3b to e66535f Compare October 23, 2025 08:41
@fengmk2 fengmk2 force-pushed the 10-11-feat_pm_support_add_package branch from 5004b6b to 6086205 Compare October 23, 2025 08:41
@fengmk2 fengmk2 force-pushed the 10-20-feat_pm_support_remove_package branch from e66535f to 693ceed Compare October 23, 2025 11:11
@fengmk2 fengmk2 force-pushed the 10-11-feat_pm_support_add_package branch from 6086205 to cce1331 Compare October 23, 2025 11:11
@fengmk2 fengmk2 force-pushed the 10-20-feat_pm_support_remove_package branch from 693ceed to cba738c Compare October 23, 2025 11:17
@fengmk2 fengmk2 force-pushed the 10-11-feat_pm_support_add_package branch from cce1331 to 1f4e6a9 Compare October 23, 2025 11:17
@fengmk2 fengmk2 changed the base branch from 10-11-feat_pm_support_add_package to graphite-base/237 October 23, 2025 11:25
@fengmk2 fengmk2 force-pushed the 10-20-feat_pm_support_remove_package branch from cba738c to 8a0976e Compare October 23, 2025 11:26
@graphite-app graphite-app Bot changed the base branch from graphite-base/237 to main October 23, 2025 11:27
@fengmk2 fengmk2 force-pushed the 10-20-feat_pm_support_remove_package branch 2 times, most recently from 8f1cdb9 to d14b33b Compare October 23, 2025 11:41
Copilot AI review requested due to automatic review settings October 23, 2025 11:41
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a remove command to the Vite CLI for uninstalling package dependencies, providing a unified interface that automatically translates to the appropriate syntax for npm, yarn, and pnpm.

Key changes:

  • Implements a remove command with support for workspace operations, dependency type filtering, and global packages
  • Adds comprehensive test coverage for all three package managers (npm, yarn, pnpm) in both standalone and workspace scenarios
  • Updates CLI to include the new command with aliases (rm, un, uninstall)

Reviewed Changes

Copilot reviewed 34 out of 34 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
rfcs/add-remove-package-commands.md Updated command mapping table to reflect correct syntax for yarn and npm workspace operations
packages/cli/binding/src/commands/remove.rs New module implementing the RemoveCommand struct with execution logic
packages/cli/binding/src/cli.rs Integrated remove command into CLI with argument parsing and command dispatching
crates/vite_package_manager/src/remove.rs Core implementation translating remove options to package manager-specific commands
packages/global/snap-tests/* Comprehensive snap tests validating remove command behavior across all package managers

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread packages/cli/binding/src/cli.rs
Comment thread crates/vite_package_manager/src/remove.rs
Comment thread crates/vite_package_manager/src/remove.rs
Comment thread crates/vite_package_manager/src/remove.rs
Comment thread crates/vite_package_manager/src/remove.rs
@fengmk2 fengmk2 force-pushed the 10-20-feat_pm_support_remove_package branch from d14b33b to 89fcdb4 Compare October 23, 2025 14:58
Copy link
Copy Markdown
Member Author

fengmk2 commented Oct 23, 2025

Merge activity

  • Oct 23, 2:59 PM UTC: Graphite rebased this pull request as part of a merge.
  • Oct 23, 3:04 PM UTC: @fengmk2 merged this pull request with Graphite.

@fengmk2 fengmk2 merged commit 5857a0f into main Oct 23, 2025
10 checks passed
@fengmk2 fengmk2 deleted the 10-20-feat_pm_support_remove_package branch October 23, 2025 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants