Commit c4088c9
authored
feat(pm): add update command for package dependencies (#238)
### TL;DR
Add `vite update` command to update packages across different package managers.
### What changed?
- Added a new `update.rs` module to handle package updates across pnpm, yarn, and npm
- Implemented `UpdateCommandOptions` to configure update behavior with various flags
- Added command resolution logic for each package manager with appropriate flags
- Created comprehensive test suite for all package managers and their versions
- Added snap tests for real-world usage scenarios
- Included documentation in RFC format
### How to test?
Test the new update command with different package managers:
```bash
# Basic update
vite update react
# Update to latest version
vite update react --latest
# Update all packages
vite update
# Update in specific workspace
vite update --filter app
# Update recursively in all workspaces
vite update -r
# Update only dev dependencies
vite update -D
# Interactive mode
vite update -i
```
### Why make this change?
This change provides a unified interface for updating packages across different package managers. It simplifies workflows by automatically detecting and using the correct package manager syntax, providing consistent commands regardless of the underlying tool. The implementation handles the differences between pnpm, yarn (v1 and v2+), and npm, making it easier for developers to maintain dependencies without remembering package manager-specific commands.1 parent c72922d commit c4088c9
37 files changed
Lines changed: 3085 additions & 2 deletions
File tree
- crates/vite_package_manager/src
- commands
- packages
- cli
- binding/src
- commands
- snap-tests/exit-non-zero-on-cmd-not-exists
- global/snap-tests
- cli-helper-message
- command-update-npm10-with-workspace
- packages
- app
- utils
- command-update-npm10
- command-update-pnpm10-with-workspace
- packages
- app
- utils
- command-update-pnpm10
- command-update-yarn4-with-workspace
- packages
- app
- utils
- command-update-yarn4
- tools/src
- __tests__
- __snapshots__
- rfcs
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
0 commit comments