feat(pm): add dedupe command for dependency optimization#256
Merged
Conversation
This was referenced Oct 24, 2025
Member
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
fengmk2
force-pushed
the
10-24-refactor_pm_move_install_add_and_remove_to_commands_mod
branch
from
October 24, 2025 15:16
4119c3d to
4cec2b4
Compare
fengmk2
force-pushed
the
10-24-feat_pm_add_dedupe_commands
branch
from
October 24, 2025 15:16
c3d3a1e to
8386b5f
Compare
fengmk2
force-pushed
the
10-24-refactor_pm_move_install_add_and_remove_to_commands_mod
branch
2 times, most recently
from
October 25, 2025 04:35
9b40d7f to
d2604ee
Compare
fengmk2
force-pushed
the
10-24-feat_pm_add_dedupe_commands
branch
from
October 25, 2025 04:35
8386b5f to
3ece957
Compare
fengmk2
changed the base branch from
10-24-refactor_pm_move_install_add_and_remove_to_commands_mod
to
graphite-base/256
October 25, 2025 04:46
fengmk2
force-pushed
the
graphite-base/256
branch
from
October 25, 2025 04:47
d2604ee to
de47ed9
Compare
fengmk2
force-pushed
the
10-24-feat_pm_add_dedupe_commands
branch
from
October 25, 2025 04:47
3ece957 to
cee3aad
Compare
fengmk2
force-pushed
the
10-24-feat_pm_add_dedupe_commands
branch
3 times, most recently
from
October 27, 2025 11:33
3a9dbb6 to
1ed0db7
Compare
fengmk2
force-pushed
the
10-24-feat_pm_add_dedupe_commands
branch
3 times, most recently
from
October 28, 2025 06:36
fc6dcc9 to
f0e4bb4
Compare
fengmk2
marked this pull request as ready for review
October 28, 2025 07:40
fengmk2
requested review from
Brooooooklyn,
Copilot and
wan9chi
and removed request for
Copilot
October 28, 2025 07:40
wan9chi
approved these changes
Oct 28, 2025
fengmk2
force-pushed
the
10-24-feat_pm_add_dedupe_commands
branch
from
October 28, 2025 08:23
f0e4bb4 to
d291b23
Compare
Member
Author
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a new vite dedupe command that provides a unified interface for dependency deduplication across pnpm, npm, and yarn@2+. The command automatically detects the package manager and translates the dedupe operation to the appropriate package manager-specific syntax, with support for check mode (dry-run) and pass-through arguments.
- Adds new
dedupecommand (alias:ddp) that adapts to detected package manager - Implements package manager-specific flag mapping (--check for pnpm/yarn, --dry-run for npm)
- Includes comprehensive test coverage and RFC documentation
Reviewed Changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| rfcs/dedupe-package-command.md | RFC documentation explaining design decisions and implementation details |
| packages/tools/src/utils.ts | Enhanced output replacement patterns to handle npm audit log variations |
| packages/tools/src/tests/utils.spec.ts | Added test cases for new npm audit log patterns |
| packages/tools/src/tests/snapshots/utils.spec.ts.snap | Updated snapshots for new test cases |
| packages/global/snap-tests/command-dedupe-yarn4/* | Integration tests for dedupe command with Yarn 4 |
| packages/global/snap-tests/command-dedupe-pnpm10/* | Integration tests for dedupe command with pnpm 10 |
| packages/global/snap-tests/command-dedupe-npm10/* | Integration tests for dedupe command with npm 10 |
| packages/global/snap-tests/cli-helper-message/snap.txt | Updated CLI help output to include dedupe command |
| packages/cli/snap-tests/exit-non-zero-on-cmd-not-exists/snap.txt | Updated error message to include dedupe subcommands |
| packages/cli/binding/src/commands/mod.rs | Added dedupe module export |
| packages/cli/binding/src/commands/dedupe.rs | Implementation of DedupeCommand struct |
| packages/cli/binding/src/cli.rs | CLI integration with dedupe command and argument parsing |
| crates/vite_install/src/commands/mod.rs | Added dedupe module export |
| crates/vite_install/src/commands/dedupe.rs | Core dedupe command logic with package manager adaptations |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
fengmk2
force-pushed
the
10-24-feat_pm_add_dedupe_commands
branch
from
October 28, 2025 09:56
d291b23 to
596039e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

TL;DR
Added a new
vite dedupecommand (withddpalias) that automatically adapts to the detected package manager to optimize dependency trees by removing duplicate packages.What changed?
dedupecommand to the CLI that works with pnpm, npm, and yarn@2+pnpm dedupe,npm dedupe, oryarn dedupebased on detected package manager--checkflag that maps to the appropriate dry-run flag for each package managercrates/vite_package_manager/src/commands/dedupe.rspackages/cli/binding/src/commands/dedupe.rsHow to test?
vite dedupe vite ddp # aliasWhy make this change?
This change simplifies dependency optimization by providing a unified interface across all supported package managers. Previously, developers had to manually use package manager-specific commands with different syntaxes:
pnpm dedupe --checknpm dedupe --dry-runyarn dedupe --check(yarn@2+ only)The new command automatically detects the package manager and uses the appropriate syntax, reducing friction in dependency management workflows and improving project efficiency by making it easier to remove redundant packages.