Commit 23d7e68
authored
feat(install): support VP_PR_VERSION for pkg.pr.new testing (#1578)
## Summary
Add `VP_PR_VERSION` env var to both `install.sh` and `install.ps1` so
users can install an unreleased PR build (or any commit) via pkg.pr.new
for temporary testing. Since npm releases only ship from `main`,
pkg.pr.new is the only available testing channel for in-flight changes.
When `VP_PR_VERSION` is set, the installer:
- Bypasses the npm registry (no metadata fetch)
- Downloads the CLI platform tarball from
`https://pkg.pr.new/voidzero-dev/vite-plus/@voidzero-dev/vite-plus-cli-{platform}@{PR_or_SHA}`
- Writes `vite-plus` in the wrapper `package.json` as
`https://pkg.pr.new/voidzero-dev/vite-plus@{PR_or_SHA}` — the published
pkg.pr.new tarball already rewrites scoped workspace deps to matching
pkg.pr.new URLs by commit SHA, so pnpm pulls in a coherent PR build.
- Installs into `~/.vite-plus/pkg-pr-new-{PR_or_SHA}/` — a non-semver
dir name so `cleanup_old_versions` won't auto-delete it.
- Errors early if combined with `VP_LOCAL_TGZ`.
## Usage
```bash
# bash / macOS / Linux
curl -fsSL https://vite.plus | VP_PR_VERSION=1569 bash
```
```powershell
# Windows
$env:VP_PR_VERSION = "1569"; irm https://vite.plus/ps1 | iex
```
`VP_PR_VERSION` accepts either a PR number (e.g. `1569`) or a commit
SHA.
## Test plan
End-to-end verified against #1569 in a sandboxed `HOME`:
- [x] `vp --version` reports `v0.0.0-pkg-pr-new.c178e90` (matches PR
#1569 commit)
- [x] `node_modules/vite-plus/package.json` version matches the PR build
- [x] Transitive `@voidzero-dev/vite-plus-core` resolves via pkg.pr.new
URL with the same commit SHA
- [x] `pnpm-lock.yaml` records `vite-plus.specifier:
https://pkg.pr.new/voidzero-dev/vite-plus@1569`
- [x] Normal (no `VP_PR_VERSION`) flow unchanged — still hits npm
registry
- [x] `VP_PR_VERSION` + `VP_LOCAL_TGZ` errors early as expected
- [x] `bash -n` passes on `install.sh`
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Changes the installation path and download sources in the
cross-platform installers, which could break installs or pull unintended
artifacts if the new URL construction/branching logic is wrong. Scope is
limited to `install.sh`/`install.ps1` and guarded by an opt-in env var.
>
> **Overview**
> Adds `VP_PR_VERSION` to `install.sh` and `install.ps1` to install
unreleased PR/commit builds via `pkg.pr.new`, bypassing npm
metadata/version resolution.
>
> When set, the installers (1) refuse to run alongside `VP_LOCAL_TGZ`,
(2) download the platform CLI tarball from `pkg.pr.new`, (3) install
into a synthetic non-semver version directory (`pkg-pr-new-...`) to
avoid old-version cleanup, and (4) write the wrapper `package.json`
dependency as a `pkg.pr.new` URL so `pnpm` pulls a coherent PR build of
`vite-plus` and its workspace deps.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
247c17e. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 5a40c19 commit 23d7e68
2 files changed
Lines changed: 62 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
12 | 15 | | |
13 | 16 | | |
14 | 17 | | |
| |||
20 | 23 | | |
21 | 24 | | |
22 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
23 | 30 | | |
24 | 31 | | |
25 | 32 | | |
| |||
418 | 425 | | |
419 | 426 | | |
420 | 427 | | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
421 | 432 | | |
422 | 433 | | |
423 | 434 | | |
| |||
434 | 445 | | |
435 | 446 | | |
436 | 447 | | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
437 | 454 | | |
438 | 455 | | |
439 | 456 | | |
| |||
465 | 482 | | |
466 | 483 | | |
467 | 484 | | |
468 | | - | |
| 485 | + | |
469 | 486 | | |
470 | | - | |
471 | | - | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
472 | 494 | | |
473 | 495 | | |
474 | 496 | | |
| |||
506 | 528 | | |
507 | 529 | | |
508 | 530 | | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
509 | 534 | | |
510 | 535 | | |
511 | 536 | | |
512 | 537 | | |
513 | 538 | | |
514 | 539 | | |
515 | | - | |
| 540 | + | |
516 | 541 | | |
517 | 542 | | |
518 | 543 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
14 | 17 | | |
15 | 18 | | |
16 | 19 | | |
| |||
31 | 34 | | |
32 | 35 | | |
33 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
34 | 41 | | |
35 | 42 | | |
36 | 43 | | |
| |||
842 | 849 | | |
843 | 850 | | |
844 | 851 | | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
845 | 856 | | |
846 | 857 | | |
847 | 858 | | |
| |||
857 | 868 | | |
858 | 869 | | |
859 | 870 | | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
860 | 877 | | |
861 | 878 | | |
862 | 879 | | |
| |||
896 | 913 | | |
897 | 914 | | |
898 | 915 | | |
899 | | - | |
| 916 | + | |
900 | 917 | | |
901 | | - | |
902 | | - | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
903 | 926 | | |
904 | 927 | | |
905 | 928 | | |
| |||
920 | 943 | | |
921 | 944 | | |
922 | 945 | | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
923 | 952 | | |
924 | 953 | | |
925 | 954 | | |
926 | 955 | | |
927 | 956 | | |
928 | 957 | | |
929 | 958 | | |
930 | | - | |
| 959 | + | |
931 | 960 | | |
932 | 961 | | |
933 | 962 | | |
| |||
0 commit comments