Skip to content

Commit 01bcb18

Browse files
committed
feat(env): add cleanup for legacy completion directory
1 parent f78eaab commit 01bcb18

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

  • crates/vite_global_cli/src/commands/env

crates/vite_global_cli/src/commands/env/setup.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ pub async fn execute(refresh: bool, env_only: bool) -> Result<ExitStatus, Error>
4040
// Ensure home directory exists (env files are written here)
4141
tokio::fs::create_dir_all(&vite_plus_home).await?;
4242

43+
// TODO: remove this cleanup logic before the beta release
44+
cleanup_legacy_completion_dir(&vite_plus_home).await;
45+
4346
// Create env files with PATH guard (prevents duplicate PATH entries)
4447
create_env_files(&vite_plus_home).await?;
4548

@@ -369,6 +372,17 @@ pub(crate) async fn cleanup_legacy_windows_shim(bin_dir: &vite_path::AbsolutePat
369372
}
370373
}
371374

375+
/// Remove `~/.vite-plus/completion` directory
376+
///
377+
/// In older versions, static completion scripts were generated in `~/.vite-plus/completion/`.
378+
/// This is no longer needed with dynamic completion support.
379+
async fn cleanup_legacy_completion_dir(vite_plus_home: &vite_path::AbsolutePath) {
380+
let completion_dir = vite_plus_home.join("completion");
381+
if tokio::fs::remove_dir_all(&completion_dir).await.is_ok() {
382+
tracing::debug!("Removed legacy completion directory: {:?}", completion_dir);
383+
}
384+
}
385+
372386
/// Create env files with PATH guard (prevents duplicate PATH entries).
373387
///
374388
/// Creates:

0 commit comments

Comments
 (0)