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
test(cli): add snap tests for vp self-update command
- Add self-update help to cli-helper-message snap test
- Add command-self-update-check test (--check flag and upgrade alias)
- Add command-self-update-rollback test (error when no previous version)
- Rename help section to "Maintenance Commands" for consistency
- Fix description alignment to match other sections
-**Junctions** (`mklink /J`) are used instead of symlinks — junctions don't require admin privileges
291
296
- Junctions only work for directories (which `current` is), and use absolute paths internally
292
297
- The swap is **not atomic** — there's a brief window (~milliseconds) where `current` doesn't exist
@@ -311,6 +316,7 @@ The running `vp` process is **not** the binary being replaced. The flow is:
311
316
```
312
317
313
318
After the `current` link swap, any **new** invocation of `vp` will use the new binary. The currently running process continues to execute from the old version's binary file on disk:
319
+
314
320
-**Unix**: The old binary remains valid because Unix doesn't delete open files until all file descriptors are closed
315
321
-**Windows**: The old `.exe` file is locked while running, but since we install to a **new version directory** (not overwriting in-place), there's no conflict. The old version directory is preserved (kept in the "last 5" cleanup policy)
316
322
@@ -319,26 +325,28 @@ After the `current` link swap, any **new** invocation of `vp` will use the new b
319
325
The `--rollback` flag switches the `current` symlink to the previously active version.
320
326
321
327
To track the previous version, we can:
328
+
322
329
1. Read the `current` symlink target before updating
323
330
2. After the update, write the previous version to `~/.vite-plus/.previous-version`
324
331
325
332
For `--rollback`:
333
+
326
334
1. Read `~/.vite-plus/.previous-version`
327
335
2. Verify that version directory still exists
328
336
3. Swap `current` symlink to point to it
329
337
4. Update `.previous-version` to point to the version we just rolled back from
330
338
331
339
### Error Handling
332
340
333
-
| Error | Recovery |
334
-
|-------|----------|
335
-
| Network failure during download | Clean up partial temp files, exit with helpful message |
336
-
| Integrity mismatch (SHA-512) | Delete downloaded file, report expected vs actual hash, abort |
337
-
| Corrupted tarball | Verify extraction success, clean up version dir if partial |
338
-
|`vp install` fails | Remove the version dir, keep current version unchanged |
339
-
| Disk full | Detect and report, clean up partial state |
340
-
| Permission denied | Report with suggestion to check directory ownership |
0 commit comments