Skip to content

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

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

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

Conversation

@fengmk2

@fengmk2fengmk2 commented Oct 20, 2025

Copy link
Copy Markdown
Member

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.

@fengmk2fengmk2 changed the title feat(pm): support remove packagefeat(pm): add remove command for package dependenciesOct 20, 2025
@fengmk2Graphite App

fengmk2 commented Oct 20, 2025

Copy link
Copy Markdown
MemberAuthor

@fengmk2fengmk2 self-assigned this Oct 20, 2025
@fengmk2
fengmk2 marked this pull request as ready for review October 20, 2025 13:23
@fengmk2
fengmk2force-pushed the 10-20-feat_pm_support_remove_package branch from 59f8647 to 88d9620CompareOctober 21, 2025 02:58
@fengmk2
fengmk2force-pushed the 10-11-feat_pm_support_add_package branch 3 times, most recently from f8f51e7 to ead3479CompareOctober 21, 2025 07:02
@fengmk2
fengmk2force-pushed the 10-20-feat_pm_support_remove_package branch from 88d9620 to 4d14157CompareOctober 21, 2025 11:41
@fengmk2
fengmk2 changed the base branch from 10-11-feat_pm_support_add_package to graphite-base/237October 22, 2025 05:42
This was referenced Oct 22, 2025
@fengmk2
fengmk2force-pushed the 10-20-feat_pm_support_remove_package branch from 4d14157 to 0da1898CompareOctober 23, 2025 01:55
@fengmk2
fengmk2 changed the base branch from graphite-base/237 to 10-11-feat_pm_support_add_packageOctober 23, 2025 01:55
@fengmk2
fengmk2force-pushed the 10-20-feat_pm_support_remove_package branch from 0da1898 to a082d7dCompareOctober 23, 2025 02:03
@fengmk2
fengmk2force-pushed the 10-11-feat_pm_support_add_package branch from 1776b0f to 777bd7cCompareOctober 23, 2025 02:03
@fengmk2
fengmk2force-pushed the 10-20-feat_pm_support_remove_package branch from a082d7d to 80f4466CompareOctober 23, 2025 03:05
@fengmk2
fengmk2force-pushed the 10-11-feat_pm_support_add_package branch 2 times, most recently from 20d51ba to 23ad827CompareOctober 23, 2025 05:02
@fengmk2
fengmk2force-pushed the 10-20-feat_pm_support_remove_package branch from 80f4466 to 9c80889CompareOctober 23, 2025 05:02
@fengmk2
fengmk2force-pushed the 10-11-feat_pm_support_add_package branch from 23ad827 to 320d654CompareOctober 23, 2025 07:32
@fengmk2
fengmk2force-pushed the 10-20-feat_pm_support_remove_package branch 2 times, most recently from c7552de to 419e76dCompareOctober 23, 2025 08:01
@fengmk2
fengmk2force-pushed the 10-11-feat_pm_support_add_package branch from 320d654 to c6a3c8cCompareOctober 23, 2025 08:01
@fengmk2
fengmk2force-pushed the 10-20-feat_pm_support_remove_package branch from 419e76d to 2d3b5b1CompareOctober 23, 2025 08:16
@fengmk2
fengmk2force-pushed the 10-11-feat_pm_support_add_package branch 2 times, most recently from 25352cf to 805bfaeCompareOctober 23, 2025 08:24
@fengmk2
fengmk2force-pushed the 10-20-feat_pm_support_remove_package branch from 2d3b5b1 to 6ad482cCompareOctober 23, 2025 08:24
@fengmk2
fengmk2force-pushed the 10-11-feat_pm_support_add_package branch from 805bfae to 5004b6bCompareOctober 23, 2025 08:38
@fengmk2
fengmk2force-pushed the 10-20-feat_pm_support_remove_package branch 2 times, most recently from 5412a3b to e66535fCompareOctober 23, 2025 08:41
@fengmk2
fengmk2force-pushed the 10-11-feat_pm_support_add_package branch from 5004b6b to 6086205CompareOctober 23, 2025 08:41
@fengmk2
fengmk2force-pushed the 10-20-feat_pm_support_remove_package branch from e66535f to 693ceedCompareOctober 23, 2025 11:11
@fengmk2
fengmk2force-pushed the 10-11-feat_pm_support_add_package branch from 6086205 to cce1331CompareOctober 23, 2025 11:11
@fengmk2
fengmk2force-pushed the 10-20-feat_pm_support_remove_package branch from 693ceed to cba738cCompareOctober 23, 2025 11:17
@fengmk2
fengmk2force-pushed the 10-11-feat_pm_support_add_package branch from cce1331 to 1f4e6a9CompareOctober 23, 2025 11:17
@fengmk2
fengmk2 changed the base branch from 10-11-feat_pm_support_add_package to graphite-base/237October 23, 2025 11:25
@fengmk2
fengmk2force-pushed the 10-20-feat_pm_support_remove_package branch from cba738c to 8a0976eCompareOctober 23, 2025 11:26
@graphite-app
graphite-appBot changed the base branch from graphite-base/237 to mainOctober 23, 2025 11:27
@fengmk2
fengmk2force-pushed the 10-20-feat_pm_support_remove_package branch 2 times, most recently from 8f1cdb9 to d14b33bCompareOctober 23, 2025 11:41
CopilotAI review requested due to automatic review settings October 23, 2025 11:41

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

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
FileDescription
rfcs/add-remove-package-commands.mdUpdated command mapping table to reflect correct syntax for yarn and npm workspace operations
packages/cli/binding/src/commands/remove.rsNew module implementing the RemoveCommand struct with execution logic
packages/cli/binding/src/cli.rsIntegrated remove command into CLI with argument parsing and command dispatching
crates/vite_package_manager/src/remove.rsCore 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 threadpackages/cli/binding/src/cli.rs
Comment threadcrates/vite_package_manager/src/remove.rs
Comment threadcrates/vite_package_manager/src/remove.rs
Comment threadcrates/vite_package_manager/src/remove.rs
Comment threadcrates/vite_package_manager/src/remove.rs
@fengmk2
fengmk2force-pushed the 10-20-feat_pm_support_remove_package branch from d14b33b to 89fcdb4CompareOctober 23, 2025 14:58
@fengmk2Graphite App

fengmk2 commented Oct 23, 2025

Copy link
Copy Markdown
MemberAuthor

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 mainOct 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 freeto 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

@fengmk2@wan9chi