Uh oh!
There was an error while loading. Please reload this page.
feat(pm): add dedupe command for dependency optimization - #256
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
4119c3d to
4cec2b4Comparec3d3a1e to
8386b5fCompare9b40d7f to
d2604eeCompare8386b5f to
3ece957Compared2604ee to
de47ed9Compare3ece957 to
cee3aadCompare3a9dbb6 to
1ed0db7Comparefc6dcc9 to
f0e4bb4Comparef0e4bb4 to
d291b23CompareThere 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.
Uh oh!
There was an error while loading. Please reload this page.
d291b23 to
596039eCompareUh oh!
There was an error while loading. Please reload this page.

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.