@@ -59,6 +59,7 @@ rustup provides `rustup-init.exe` — a single console binary that users downloa
5959rustup uses one binary for everything — ` rustup-init.exe ` copies itself to ` ~/.cargo/bin/rustup.exe ` and changes behavior based on ` argv[0] ` . This works because rustup IS the toolchain manager.
6060
6161** Not suitable for vp** because:
62+
6263- ` vp.exe ` is downloaded from the npm registry as a platform-specific package
6364- The installer cannot copy itself as ` vp.exe ` — they are fundamentally different binaries
6465- ` vp.exe ` links ` vite_js_runtime ` , ` vite_workspace ` , ` oxc_resolver ` (~ 15-20 MB) — the installer needs none of these
@@ -75,6 +76,7 @@ crates/vite_installer/ — standalone installer binary
7576` vite_setup ` extracts the reusable installation logic currently in ` vite_global_cli/src/commands/upgrade/ ` . Both ` vp upgrade ` and ` vp-setup.exe ` call into ` vite_setup ` .
7677
7778** Benefits:**
79+
7880- Installer binary stays small (3-5 MB)
7981- ` vp upgrade ` and ` vp-setup.exe ` share identical installation logic — no drift
8082- Clear separation of concerns
@@ -83,17 +85,17 @@ crates/vite_installer/ — standalone installer binary
8385
8486### What Gets Extracted
8587
86- | Current location in ` upgrade/ ` | Extracted to ` vite_setup:: ` | Purpose |
87- | ---| ---| ---|
88- | ` platform.rs ` → ` detect_platform_suffix() ` | ` platform ` | OS/arch detection |
89- | ` registry.rs ` → ` resolve_version() ` , ` resolve_platform_package() ` | ` registry ` | npm registry queries |
90- | ` integrity.rs ` → ` verify_integrity() ` | ` integrity ` | SHA-512 verification |
91- | ` install.rs ` → ` extract_platform_package() ` | ` extract ` | Tarball extraction |
92- | ` install.rs ` → ` generate_wrapper_package_json() ` | ` package_json ` | Wrapper package.json |
93- | ` install.rs ` → ` write_release_age_overrides() ` | ` npmrc ` | .npmrc overrides |
94- | ` install.rs ` → ` install_production_deps() ` | ` deps ` | Run ` vp install --silent ` |
95- | ` install.rs ` → ` swap_current_link() ` | ` link ` | Symlink/junction swap |
96- | ` install.rs ` → ` cleanup_old_versions() ` | ` cleanup ` | Old version cleanup |
88+ | Current location in ` upgrade/ ` | Extracted to ` vite_setup:: ` | Purpose |
89+ | ----------------------------------------------------------------- | --------------------------- | ------------------------- |
90+ | ` platform.rs ` → ` detect_platform_suffix() ` | ` platform ` | OS/arch detection |
91+ | ` registry.rs ` → ` resolve_version() ` , ` resolve_platform_package() ` | ` registry ` | npm registry queries |
92+ | ` integrity.rs ` → ` verify_integrity() ` | ` integrity ` | SHA-512 verification |
93+ | ` install.rs ` → ` extract_platform_package() ` | ` extract ` | Tarball extraction |
94+ | ` install.rs ` → ` generate_wrapper_package_json() ` | ` package_json ` | Wrapper package.json |
95+ | ` install.rs ` → ` write_release_age_overrides() ` | ` npmrc ` | .npmrc overrides |
96+ | ` install.rs ` → ` install_production_deps() ` | ` deps ` | Run ` vp install --silent ` |
97+ | ` install.rs ` → ` swap_current_link() ` | ` link ` | Symlink/junction swap |
98+ | ` install.rs ` → ` cleanup_old_versions() ` | ` cleanup ` | Old version cleanup |
9799
98100### What Stays in ` vite_global_cli `
99101
@@ -176,24 +178,24 @@ vp-setup.exe -y --version 0.3.0 --no-node-manager --registry https://registry.np
176178
177179### CLI Flags
178180
179- | Flag | Description | Default |
180- | ---| ---| ---|
181- | ` -y ` / ` --yes ` | Accept defaults, no prompts | interactive |
182- | ` -q ` / ` --quiet ` | Suppress output except errors | false |
183- | ` --version <VER> ` | Install specific version | latest |
184- | ` --tag <TAG> ` | npm dist-tag | latest |
185- | ` --install-dir <PATH> ` | Installation directory | ` %USERPROFILE%\.vite-plus ` |
186- | ` --registry <URL> ` | npm registry URL | ` https://registry.npmjs.org ` |
187- | ` --no-node-manager ` | Skip Node.js manager setup | auto-detect |
188- | ` --no-modify-path ` | Don't modify User PATH | modify |
181+ | Flag | Description | Default |
182+ | ---------------------- | ----------------------------- | ---------------------------- |
183+ | ` -y ` / ` --yes ` | Accept defaults, no prompts | interactive |
184+ | ` -q ` / ` --quiet ` | Suppress output except errors | false |
185+ | ` --version <VER> ` | Install specific version | latest |
186+ | ` --tag <TAG> ` | npm dist-tag | latest |
187+ | ` --install-dir <PATH> ` | Installation directory | ` %USERPROFILE%\.vite-plus ` |
188+ | ` --registry <URL> ` | npm registry URL | ` https://registry.npmjs.org ` |
189+ | ` --no-node-manager ` | Skip Node.js manager setup | auto-detect |
190+ | ` --no-modify-path ` | Don't modify User PATH | modify |
189191
190192### Environment Variables (compatible with ` install.ps1 ` )
191193
192- | Variable | Maps to |
193- | ---| ---|
194- | ` VP_VERSION ` | ` --version ` |
195- | ` VP_HOME ` | ` --install-dir ` |
196- | ` NPM_CONFIG_REGISTRY ` | ` --registry ` |
194+ | Variable | Maps to |
195+ | ------------------------- | ------------------- |
196+ | ` VP_VERSION ` | ` --version ` |
197+ | ` VP_HOME ` | ` --install-dir ` |
198+ | ` NPM_CONFIG_REGISTRY ` | ` --registry ` |
197199| ` VP_NODE_MANAGER=yes\|no ` | ` --no-node-manager ` |
198200
199201CLI flags take precedence over environment variables.
@@ -300,13 +302,13 @@ The binary uses the console subsystem (default for Rust binaries on Windows). Wh
300302
301303### Existing Installation Handling
302304
303- | Scenario | Behavior |
304- | ---| ---|
305- | No existing install | Fresh install |
306- | Same version installed | Print "already up to date", exit 0 |
307- | Different version installed | Upgrade to target version |
308- | Corrupt/partial install (broken junction) | Recreate directory structure |
309- | Running ` vp.exe ` in bin/ | Rename to ` .old ` , copy new (same as trampoline pattern) |
305+ | Scenario | Behavior |
306+ | ----------------------------------------- | ------------------------------------------------------- |
307+ | No existing install | Fresh install |
308+ | Same version installed | Print "already up to date", exit 0 |
309+ | Different version installed | Upgrade to target version |
310+ | Corrupt/partial install (broken junction) | Recreate directory structure |
311+ | Running ` vp.exe ` in bin/ | Rename to ` .old ` , copy new (same as trampoline pattern) |
310312
311313## Add/Remove Programs Registration
312314
@@ -402,17 +404,17 @@ Target: 3-5 MB (release, stripped, LTO).
402404
403405Key dependencies and their approximate contribution :
404406
405- | Dependency | Purpose | Size impact |
406- |---| ---| ---|
407- | `reqwest` + `native-tls-vendored` | HTTP + TLS | ~1.5 MB |
408- | `flate2` + `tar` | Tarball extraction | ~200 KB |
409- | `clap` | CLI parsing | ~300 KB |
410- | `tokio` (minimal features) | Async runtime | ~400 KB |
411- | `indicatif` | Progress bars | ~100 KB |
412- | `sha2` | Integrity verification | ~50 KB |
413- | `serde_json` | Registry JSON parsing | ~200 KB |
414- | `winreg` | Windows registry | ~50 KB |
415- | Rust std + overhead | | ~500 KB |
407+ | Dependency | Purpose | Size impact |
408+ | --------------------------------- | ---------------------- | ----------- |
409+ | `reqwest` + `native-tls-vendored` | HTTP + TLS | ~1.5 MB |
410+ | `flate2` + `tar` | Tarball extraction | ~200 KB |
411+ | `clap` | CLI parsing | ~300 KB |
412+ | `tokio` (minimal features) | Async runtime | ~400 KB |
413+ | `indicatif` | Progress bars | ~100 KB |
414+ | `sha2` | Integrity verification | ~50 KB |
415+ | `serde_json` | Registry JSON parsing | ~200 KB |
416+ | `winreg` | Windows registry | ~50 KB |
417+ | Rust std + overhead | | ~500 KB |
416418
417419Use `opt-level = "z"` (optimize for size) in package profile override, matching the trampoline approach.
418420
@@ -421,6 +423,7 @@ Use `opt-level = "z"` (optimize for size) in package profile override, matching
421423# ## 1. MSI/NSIS/Inno Setup Installer (Rejected)
422424
423425Traditional Windows installers provide GUI, Add/Remove Programs, and Start Menu integration. However :
426+
424427- Adds build-time dependency on external tooling (WiX, NSIS)
425428- GUI is unnecessary for a developer CLI tool
426429- MSI has complex authoring requirements
@@ -478,11 +481,13 @@ Embed the PowerShell script in a self-extracting exe. Fragile, still requires Po
478481# # Testing Strategy
479482
480483# ## Unit Tests
484+
481485- Platform detection (mock different architectures)
482486- PATH modification logic (registry read/write)
483487- Version comparison and existing install detection
484488
485489# ## Integration Tests (CI)
490+
486491- Fresh install from cmd.exe, PowerShell, Git Bash
487492- Silent mode (`-y`) installation
488493- Custom registry, custom install dir
@@ -491,6 +496,7 @@ Embed the PowerShell script in a self-extracting exe. Fragile, still requires Po
491496- Verify PATH is modified correctly
492497
493498# ## Manual Tests
499+
494500- Double-click from Downloads folder
495501- SmartScreen behavior (signed vs unsigned)
496502- Windows Defender scan behavior
0 commit comments