Skip to content

Commit 1333406

Browse files
authored
feat(global-cli): add vp implode command to completely uninstall vite-plus (#761)
Implements a self-uninstall command that: - Removes ~/.vite-plus/ directory - Cleans shell profiles (.zshenv, .zshrc, .bashrc, .bash_profile, .profile, config.fish) by removing Vite+ sourcing lines - On Windows, removes .vite-plus\\bin from User PATH and handles locked binary via deferred cmd.exe deletion - Requires typing "uninstall" to confirm (or --yes/-y to skip) Adds CI verification in test-standalone-install.yml for all platforms (Unix + Windows) that tests implode followed by reinstall. closes VP-236 ![image.png](https://app.graphite.com/user-attachments/assets/8c1cbdaf-60f4-4beb-b1b4-977f891bd35a.png)
1 parent 58b2307 commit 1333406

10 files changed

Lines changed: 765 additions & 25 deletions

File tree

.github/workflows/ci.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,50 @@ jobs:
518518
exit /b 1
519519
)
520520
521+
- name: Test implode (bash)
522+
shell: bash
523+
run: |
524+
vp implode --yes
525+
ls -la ~/
526+
VP_HOME="${USERPROFILE:-$HOME}/.vite-plus"
527+
if [ -d "$VP_HOME" ]; then
528+
echo "Error: $VP_HOME still exists after implode"
529+
exit 1
530+
fi
531+
# Reinstall
532+
pnpm bootstrap-cli:ci
533+
vp --version
534+
535+
- name: Test implode (powershell)
536+
if: ${{ matrix.os == 'windows-latest' }}
537+
shell: pwsh
538+
run: |
539+
vp implode --yes
540+
Start-Sleep -Seconds 5
541+
dir "$env:USERPROFILE\"
542+
if (Test-Path "$env:USERPROFILE\.vite-plus") {
543+
Write-Error "~/.vite-plus still exists after implode"
544+
exit 1
545+
}
546+
pnpm bootstrap-cli:ci
547+
vp --version
548+
549+
- name: Test implode (cmd)
550+
if: ${{ matrix.os == 'windows-latest' }}
551+
shell: cmd
552+
run: |
553+
REM vp.exe renames its own parent directory; cmd.exe may report
554+
REM "The system cannot find the path specified" on exit — ignore it.
555+
vp implode --yes || ver >NUL
556+
timeout /T 5 /NOBREAK >NUL
557+
dir "%USERPROFILE%\"
558+
if exist "%USERPROFILE%\.vite-plus" (
559+
echo Error: .vite-plus still exists after implode
560+
exit /b 1
561+
)
562+
pnpm bootstrap-cli:ci
563+
vp --version
564+
521565
install-e2e-test:
522566
name: Local CLI `vp install` E2E test
523567
needs:

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/vite_global_cli/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ path = "src/main.rs"
1515
base64-simd = { workspace = true }
1616
chrono = { workspace = true }
1717
clap = { workspace = true, features = ["derive"] }
18+
directories = { workspace = true }
1819
flate2 = { workspace = true }
1920
serde = { workspace = true }
2021
serde_json = { workspace = true }

crates/vite_global_cli/src/cli.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,13 @@ pub enum Commands {
679679
#[arg(long)]
680680
registry: Option<String>,
681681
},
682+
683+
/// Remove vp and all related data
684+
Implode {
685+
/// Skip confirmation prompt
686+
#[arg(long, short = 'y')]
687+
yes: bool,
688+
},
682689
}
683690

684691
/// Arguments for the `env` command
@@ -1965,6 +1972,7 @@ pub async fn run_command_with_options(
19651972
})
19661973
.await
19671974
}
1975+
Commands::Implode { yes } => commands::implode::execute(yes),
19681976
}
19691977
}
19701978

0 commit comments

Comments
 (0)