Skip to content

Commit fc3b773

Browse files
Copilothyf0
andauthored
feat: tweak short aliases: remove ddp, hide un/uninstall from help (#577)
- [x] Remove `ddp` alias from `dedupe` command (no longer works) - [x] Keep `un` and `uninstall` as visible aliases on `remove` (per reviewer feedback) - [x] Update custom help text to reflect alias changes - [x] Update snap tests that use `vp ddp` to use `vp dedupe` - [x] Update snap.txt files to reflect new help output - [x] Remove `ddp` references from RFC documentation - [x] Code review passed - [x] Security check passed (no alerts) <!-- START COPILOT ORIGINAL PROMPT --> <details> <summary>Original prompt</summary> > > ---- > > *This section details on the original issue you should resolve* > > <issue_title>Tweak short alias</issue_title> > <issue_description>> That said, I think we should support a few very common aliases like vp i - this is mostly to cater to established habits from users with existing package managers and ease migration. But only the common ones. i, rm, ln, ls and up should be enough (this aligns with pnpm). We should get rid of ddp for sure. > > side note: pnpm supports uninstall and un but doesn't list it in its help. We can probably do that too.</issue_description> > > ## Comments on the Issue (you are @copilot in this section) > > <comments> > </comments> > </details> <!-- START COPILOT CODING AGENT SUFFIX --> - Fixes #576 <!-- START COPILOT CODING AGENT TIPS --> --- ✨ Let Copilot coding agent [set things up for you](https://github.com/voidzero-dev/vite-plus/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo. Co-authored-by: Yunfei He <i.heyunfei@gmail.com>
1 parent 3262bda commit fc3b773

11 files changed

Lines changed: 12 additions & 23 deletions

File tree

crates/vite_global_cli/src/cli.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,6 @@ pub enum Commands {
311311
},
312312

313313
/// Deduplicate dependencies
314-
#[command(visible_alias = "ddp")]
315314
Dedupe {
316315
/// Check if deduplication would make changes
317316
#[arg(long)]
@@ -1617,7 +1616,7 @@ fn apply_custom_help(cmd: clap::Command) -> clap::Command {
16171616
{bold}install, i{reset} Install all dependencies, or add packages if package names are provided
16181617
{bold}add{reset} Add packages to dependencies
16191618
{bold}remove, rm, un, uninstall{reset} Remove packages from dependencies
1620-
{bold}dedupe, ddp{reset} Deduplicate dependencies by removing older versions
1619+
{bold}dedupe{reset} Deduplicate dependencies by removing older versions
16211620
{bold}dlx{reset} Execute a package binary without installing it as a dependency
16221621
{bold}info, view, show{reset} View package information from the registry
16231622
{bold}link, ln{reset} Link packages for local development

packages/cli/snap-tests-todo/exit-non-zero-on-cmd-not-exists/snap.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[2]> vite command-not-exists # should exit with non-zero code
22
error: 'vite' requires a subcommand but one was not provided
3-
[subcommands: run, lint, fmt, build, test, lib, dev, doc, cache, install, i, add, remove, rm, un, uninstall, update, up, dedupe, ddp, outdated, why, explain, link, ln, unlink, pm, help]
3+
[subcommands: run, lint, fmt, build, test, lib, dev, doc, cache, install, i, add, remove, rm, un, uninstall, update, up, dedupe, outdated, why, explain, link, ln, unlink, pm, help]
44

55
Usage: vite [OPTIONS] [TASK] [-- <TASK_ARGS>...] <COMMAND>
66

packages/global/snap-tests/cli-helper-message/snap.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Package Manager Commands:
2121
install, i Install all dependencies, or add packages if package names are provided
2222
add Add packages to dependencies
2323
remove, rm, un, uninstall Remove packages from dependencies
24-
dedupe, ddp Deduplicate dependencies by removing older versions
24+
dedupe Deduplicate dependencies by removing older versions
2525
dlx Execute a package binary without installing it as a dependency
2626
info, view, show View package information from the registry
2727
link, ln Link packages for local development

packages/global/snap-tests/command-dedupe-npm10/snap.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ up to date in <variable>ms
3434
"packageManager": "npm@<semver>"
3535
}
3636

37-
> vp ddp -- --loglevel=warn && cat package.json # support pass through arguments
37+
> vp dedupe -- --loglevel=warn && cat package.json # support pass through arguments
3838

3939
up to date in <variable>ms
4040
{

packages/global/snap-tests/command-dedupe-npm10/steps.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
"commands": [
66
"vp dedupe && cat package.json # should dedupe dependencies",
77
"vp dedupe --check && cat package.json # should check if deduplication would make changes",
8-
"vp ddp -- --loglevel=warn && cat package.json # support pass through arguments"
8+
"vp dedupe -- --loglevel=warn && cat package.json # support pass through arguments"
99
]
1010
}

packages/global/snap-tests/command-dedupe-pnpm10/snap.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Progress: resolved <variable>, reused <variable>, downloaded <variable>, added <
5656
"packageManager": "pnpm@<semver>"
5757
}
5858

59-
> vp ddp -- --loglevel=warn && cat package.json # support pass through arguments
59+
> vp dedupe -- --loglevel=warn && cat package.json # support pass through arguments
6060
{
6161
"name": "command-dedupe-pnpm10",
6262
"version": "1.0.0",

packages/global/snap-tests/command-dedupe-pnpm10/steps.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"vp dedupe --help # should show help",
77
"vp dedupe && cat package.json # should dedupe dependencies",
88
"vp dedupe --check && cat package.json # should check if deduplication would make changes",
9-
"vp ddp -- --loglevel=warn && cat package.json # support pass through arguments",
9+
"vp dedupe -- --loglevel=warn && cat package.json # support pass through arguments",
1010
"json-edit package.json '_.dependencies = {}' && cat package.json && vp dedupe --check # should check fails because no dependencies",
1111
"vp dedupe && cat package.json && vp dedupe --check # should dedupe fix the change by removing the dependencies"
1212
]

packages/global/snap-tests/command-dedupe-yarn4/snap.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"packageManager": "yarn@<semver>"
4646
}
4747

48-
> vp ddp -- --json && cat package.json # support pass through arguments
48+
> vp dedupe -- --json && cat package.json # support pass through arguments
4949
{
5050
"name": "command-dedupe-yarn4",
5151
"version": "1.0.0",

packages/global/snap-tests/command-dedupe-yarn4/steps.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
"commands": [
66
"vp dedupe && cat package.json # should dedupe dependencies",
77
"vp dedupe --check && cat package.json # should check if deduplication would make changes",
8-
"vp ddp -- --json && cat package.json # support pass through arguments"
8+
"vp dedupe -- --json && cat package.json # support pass through arguments"
99
]
1010
}

rfcs/dedupe-package-command.md

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Summary
44

5-
Add `vite dedupe` (alias: `vite ddp`) command that automatically adapts to the detected package manager (pnpm/npm/yarn) for optimizing dependency trees by removing duplicate packages and upgrading older dependencies to newer compatible versions in the lockfile. This helps reduce redundancy and improve project efficiency.
5+
Add `vite dedupe` command that automatically adapts to the detected package manager (pnpm/npm/yarn) for optimizing dependency trees by removing duplicate packages and upgrading older dependencies to newer compatible versions in the lockfile. This helps reduce redundancy and improve project efficiency.
66

77
## Motivation
88

@@ -40,7 +40,6 @@ yarn dedupe --check # yarn@2+ - check without modifying
4040
```bash
4141
# Works for all package managers
4242
vite dedupe # Deduplicate dependencies
43-
vite ddp # Alias
4443

4544
# Check mode (dry-run)
4645
vite dedupe --check # Check if deduplication would make changes
@@ -54,15 +53,13 @@ vite dedupe --check # Check if deduplication would make changes
5453

5554
```bash
5655
vite dedupe [OPTIONS]
57-
vite ddp [OPTIONS] # Alias
5856
```
5957

6058
**Examples:**
6159

6260
```bash
6361
# Basic deduplication
6462
vite dedupe
65-
vite ddp
6663

6764
# Check mode (preview changes without modifying)
6865
vite dedupe --check
@@ -97,10 +94,6 @@ vite dedupe --check
9794
- pnpm uses `--check` for dry-run, npm uses `--dry-run`, yarn@2+ uses `--check`
9895
- yarn@1 does not have dedupe command and is not supported
9996

100-
**Aliases:**
101-
102-
- `vite ddp` = `vite dedupe` (matches npm's `ddp` alias)
103-
10497
### Dedupe Behavior Differences Across Package Managers
10598

10699
#### pnpm
@@ -164,7 +157,7 @@ pub enum Commands {
164157
// ... existing commands
165158

166159
/// Deduplicate dependencies by removing older versions
167-
#[command(disable_help_flag = true, alias = "ddp")]
160+
#[command(disable_help_flag = true)]
168161
Dedupe {
169162
/// Check if deduplication would make changes (pnpm: --check, npm: --dry-run)
170163
#[arg(long)]
@@ -662,8 +655,6 @@ Deduplicate dependencies by removing older versions
662655
663656
Usage: vite dedupe [OPTIONS] [-- <PASS_THROUGH_ARGS>...]
664657
665-
Aliases: ddp
666-
667658
Options:
668659
--check Check if deduplication would make changes
669660
(pnpm: --check, npm: --dry-run, yarn@2+: --check)
@@ -677,7 +668,6 @@ Note: yarn@1 does not have a dedupe command and is not supported
677668
678669
Examples:
679670
vite dedupe # Deduplicate all dependencies
680-
vite ddp # Same as above (alias)
681671
vite dedupe --check # Check if changes would occur
682672
vite dedupe -- --some-flag # Pass custom flags to package manager
683673
```

0 commit comments

Comments
 (0)