Commit 194c0dc
authored
feat(env): implement vp env command for Node.js version management (#524)
Add shim-based Node.js version management with the following features:
- `vp env setup`: Create shims (node, npm, npx) in ~/.vite-plus/bin
- `vp env doctor`: Diagnostics for environment configuration
- `vp env default [VERSION]`: Set/show global default Node.js version
- `vp env which <TOOL>`: Show path to tool binary
- `vp env --current [--json]`: Show current environment info
- `vp env --print`: Print shell snippet for session
The shims intercept node/npm/npx commands and automatically resolve
the correct Node.js version based on:
1. .node-version file
2. package.json#engines.node
3. package.json#devEngines.runtime
4. User default from config
5. Latest LTS fallback
Implementation includes:
- Shim detection via argv[0] or VITE_PLUS_SHIM_TOOL env var
- Resolution cache with mtime validation for fast repeated invocations
- Platform-specific execution (execve on Unix, spawn on Windows)
- Conflict detection for other version managers (nvm, fnm, volta, etc.)
- Updated install.sh with shim setup and PATH configuration prompt1 parent 2c1aa1a commit 194c0dc
146 files changed
Lines changed: 13663 additions & 1005 deletions
File tree
- .github/workflows
- crates
- vite_command/src
- vite_global_cli
- src
- commands
- env
- shim
- vite_install/src
- vite_js_runtime/src
- providers
- docs/vite/guide
- packages
- cli
- binding/src
- bin
- snap-tests
- command-vp-alias
- yarn-install-with-options
- global
- snap-tests-todo
- command-env-use-shell-wrapper
- new-create-tsdown
- snap-tests
- cli-helper-message
- command-add-npm10
- command-add-npm11
- command-add-pnpm10
- command-add-pnpm9
- command-add-yarn4
- command-env-install-conflict
- conflict-pkg
- command-env-install-fail
- command-env-install-no-arg-fail
- command-env-install-no-arg
- command-env-install-node-version
- command-env-install-node-version-pkg
- command-env-install-version-alias
- command-env-install-version-alias-pkg
- command-env-run-shim-mode
- command-env-run
- command-env-use
- command-env-which
- command-link-pnpm10
- command-list-no-package-json
- command-owner-pnpm10
- command-remove-npm10
- command-remove-pnpm10
- command-remove-yarn4
- env-install-binary-conflict
- env-binary-conflict-pkg-a
- env-binary-conflict-pkg-b
- shim-recursive-npm-run
- shim-recursive-package-binary
- recursive-cli-pkg
- tools/src
- __tests__
- __snapshots__
- rfcs
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
136 | | - | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
137 | 139 | | |
138 | 140 | | |
139 | 141 | | |
| |||
195 | 197 | | |
196 | 198 | | |
197 | 199 | | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
198 | 208 | | |
199 | 209 | | |
200 | 210 | | |
| |||
212 | 222 | | |
213 | 223 | | |
214 | 224 | | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
215 | 356 | | |
216 | 357 | | |
217 | 358 | | |
| |||
255 | 396 | | |
256 | 397 | | |
257 | 398 | | |
258 | | - | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
259 | 402 | | |
260 | 403 | | |
261 | 404 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | | - | |
| 106 | + | |
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
| |||
263 | 263 | | |
264 | 264 | | |
265 | 265 | | |
266 | | - | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
267 | 273 | | |
268 | 274 | | |
269 | | - | |
270 | | - | |
271 | 275 | | |
272 | 276 | | |
273 | 277 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| 81 | + | |
81 | 82 | | |
82 | 83 | | |
83 | 84 | | |
| |||
265 | 266 | | |
266 | 267 | | |
267 | 268 | | |
268 | | - | |
269 | | - | |
| 269 | + | |
| 270 | + | |
270 | 271 | | |
271 | | - | |
272 | | - | |
| 272 | + | |
| 273 | + | |
273 | 274 | | |
274 | 275 | | |
275 | 276 | | |
| |||
326 | 327 | | |
327 | 328 | | |
328 | 329 | | |
329 | | - | |
330 | | - | |
| 330 | + | |
| 331 | + | |
331 | 332 | | |
This file was deleted.
0 commit comments