You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
chore(install): reduce retained vp versions from 5 to 3 (#1716)
## What
Lower the global `vp` version-retention limit from **5 → 3** across all
three install paths that manage `~/.vite-plus`:
| Path | Location |
|------|----------|
| Rust (installer binary + `vp upgrade`) |
`crates/vite_setup/src/lib.rs` — `MAX_VERSIONS_KEEP` |
| Shell bootstrap (`curl … \| sh`) | `packages/cli/install.sh` —
`max_versions` |
| PowerShell bootstrap (`irm … \| iex`) | `packages/cli/install.ps1` —
`$maxVersions` |
## Why
The `5` was an undocumented default. Keeping 3 cuts `~/.vite-plus` disk
usage (~60–90MB instead of ~100–150MB) while still leaving rollback
headroom. The cleanup logic is fully parameterized and the
**protected-versions safeguard is unchanged** — the active and previous
versions are never pruned regardless of the limit, so a
downgrade/rollback target is always preserved.
Behavior change applies to **future** cleanup runs only (next install /
`vp upgrade`); it does not retroactively prune existing machines.
## Also updated
- **RFCs** synced to the new number: `rfcs/global-cli-rust-binary.md`,
`rfcs/upgrade-command.md` (incl. the disk-math line),
`rfcs/windows-installer.md`.
- **Docs**: added a concise *Rollback* section to
`docs/guide/upgrade.md` documenting the 3-version retention and `vp
upgrade --rollback`.
## Testing
- `cargo test -p vite_setup` → 14/14 passing. The existing
`cleanup_old_versions` tests pass explicit `max_keep` values, so they
exercise the generic logic independently of the constant.
- Doc/RFC edits are text-only.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Config and documentation only; cleanup semantics and protected-version
safeguards are unchanged, so rollback safety is preserved with slightly
less disk headroom.
>
> **Overview**
> **Retained global `vp` versions drop from 5 → 3** everywhere
post-install cleanup runs: `MAX_VERSIONS_KEEP` in `vite_setup` (used by
`vp upgrade` and `vp-setup.exe`), plus `max_versions` / `$maxVersions`
in `install.sh` and `install.ps1`. Pruning still only targets semver
dirs under `~/.vite-plus`; **active and previous versions stay
protected** for rollback—the limit only caps how many *other* old copies
remain.
>
> **Docs:** `docs/guide/upgrade.md` now documents `vp upgrade --check`,
a **Rollback** subsection (`vp upgrade --rollback`, 3-version
retention), and clarifies upgrade command examples.
>
> **RFCs** (`global-cli-rust-binary`, `upgrade-command`,
`windows-installer`) are updated to say “keep max 3” and the lower disk
estimate (~60–90MB vs ~100–150MB). Behavior change applies on the
**next** install or upgrade, not as a one-time migration on existing
machines.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
b933a20. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Copy file name to clipboardExpand all lines: docs/guide/upgrade.md
+12-1Lines changed: 12 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,9 +14,20 @@ You can upgrade both of them independently.
14
14
## Global `vp`
15
15
16
16
```bash
17
-
vp upgrade
17
+
vp upgrade # upgrade to the latest version
18
+
vp upgrade --check # check for updates without installing
18
19
```
19
20
21
+
### Rollback
22
+
23
+
Vite+ keeps the **3 most recent** versions installed so you can revert quickly:
24
+
25
+
```bash
26
+
vp upgrade --rollback
27
+
```
28
+
29
+
Older versions are pruned automatically after each upgrade. The active version and the previous version are always kept, so a rollback target is never removed.
30
+
20
31
## Local `vite-plus`
21
32
22
33
Update the project dependency with the package manager commands in Vite+:
After the symlink swap (the **point of no return**), post-update operations are treated as non-fatal. Errors are printed to stderr as warnings but do not trigger the outer error handler (which would delete the now-active version directory).
304
304
305
305
1.**Refresh shims**: Run the equivalent of `vp env setup --refresh` to ensure node/npm/npx shims point to the new version. This also refreshes trampoline `.exe` files for globally installed package shims (e.g., `corepack.exe`, `tsc.exe`) by scanning `BinConfig` entries. If this fails, the user can run it manually.
306
-
2.**Cleanup old versions**: Remove old version directories, keeping the 5 most recent by **creation time** (matching `install.sh` behavior). The new version and the previous version are always protected from cleanup, even if they fall outside the top 5 (e.g., after a downgrade via `--rollback`).
306
+
2.**Cleanup old versions**: Remove old version directories, keeping the 3 most recent by **creation time** (matching `install.sh` behavior). The new version and the previous version are always protected from cleanup, even if they fall outside the top 3 (e.g., after a downgrade via `--rollback`).
307
307
308
308
#### Step 7: Running Binary Consideration
309
309
@@ -501,15 +501,15 @@ Upgrade {
501
501
- Users can opt into periodic checks via their own cron/launchd if desired
502
502
- This can be revisited as a future enhancement with proper opt-in
503
503
504
-
### 5. Keep 5 Versions for Rollback
504
+
### 5. Keep 3 Versions for Rollback
505
505
506
-
**Decision**: Maintain the same cleanup policy as `install.sh` (keep 5 most recent versions by creation time, with protected versions).
506
+
**Decision**: Maintain the same cleanup policy as `install.sh` (keep 3 most recent versions by creation time, with protected versions).
507
507
508
508
**Rationale**:
509
509
510
510
- Consistent with existing `install.sh` behavior (sorts by creation time, not semver)
511
511
- Provides rollback safety net without unbounded disk usage
512
-
- Each version is ~20-30MB, so 5 versions is ~100-150MB total
512
+
- Each version is ~20-30MB, so 3 versions is ~60-90MB total
513
513
- The active version and previous version are always protected from cleanup, preventing accidental deletion after a downgrade
514
514
515
515
## Implementation Phases
@@ -522,7 +522,7 @@ Upgrade {
522
522
-`vp upgrade <version>` — installs a specific version
0 commit comments