feat(installer): add standalone Windows .exe installer (vp-setup.exe)#1293
Draft
feat(installer): add standalone Windows .exe installer (vp-setup.exe)#1293
Conversation
✅ Deploy Preview for viteplus-preview canceled.
|
Member
Author
How to use the Graphite Merge QueueAdd the label auto-merge to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
Add a standalone `vp-setup.exe` Windows installer binary that installs the vp CLI without requiring PowerShell, complementing the existing `irm https://vite.plus/ps1 | iex` script-based installer. - Create `vite_setup` shared library crate extracting installation logic (platform detection, registry queries, integrity verification, tarball extraction, symlink/junction management) from `vite_global_cli` - Create `vite_installer` binary crate producing `vp-setup.exe` with interactive prompts, silent mode (-y), progress bars, and Windows PATH modification via direct registry API (no PowerShell dependency) - Update `vite_global_cli` to use `vite_setup` instead of inline upgrade modules, ensuring upgrade and installer share identical logic - Add CI build/upload steps for installer in release workflow, attached as GitHub Release assets - Add RFC document at rfcs/windows-installer.md
- Remove dirs_home() and dead fallback in resolve_install_dir(), use get_vp_home() directly - Resolve install dir once in run() and pass through to all functions - Extract read_current_version() into vite_setup as a public function, reuse in save_previous_version() and the installer - Merge Cli/Options structs into single Options struct in cli.rs - Extract replace_windows_exe() helper to eliminate copy-paste in setup_bin_shims() - Remove unused LPWSTR type alias from windows_path.rs - Remove excessive "Step N" comments - Fix mixed path separator in interactive menu display
- Add interactive "Customize installation" submenu (option 2) allowing users to change version, registry, Node.js manager, and PATH settings - Add env file creation via `vp env setup --env-only` when Node.js manager is skipped (ensures shell env files exist in all code paths) - Add build.rs with /DEPENDENTLOADFLAG:0x800 linker flag for DLL hijacking prevention at load time (complements runtime mitigation) - Add test-vp-setup-exe CI job to test-standalone-install.yml testing silent installation from cmd, pwsh, and bash on Windows
The junction crate was moved to vite_setup when extracting the shared installation logic. cargo-shear correctly flagged it as unused.
Replace the flat numbered list with a phased ASCII diagram grouped into Resolve, Download & Verify, Install, Activate, and Configure phases. Add a function-to-crate mapping table and document the failure recovery boundary (pre/post Activate phase). Annotate conditional steps (save_previous_version only on upgrade, modify PATH gated by --no-modify-path).
1b3a6a3 to
4dc36b5
Compare
- Update status from "Draft" to "Implemented" - Fix Code Sharing table: all install functions are in vite_setup::install, not separate submodules - Fix Dependency Graph: remove junction (indirect via vite_setup), add actual deps (vite_path, owo-colors) - Fix Customization submenu to match code (numbered items, no install dir) - Replace winreg code sample with raw FFI description (matches implementation) - Replace windows_sys DLL sample with raw FFI (matches implementation) - Remove winreg from Binary Size Budget, add raw FFI note - Fix Alternatives #4: raw FFI, not winreg - Fix CI snippets: rename vite-init to vp-setup, update test workflow to match actual test-vp-setup-exe job - Mark Implementation Phases 1-3 as done, Phase 4 as future
…ccess The zero-dependency pattern made sense for vite_trampoline (copied 5-10 times as shim files) but not for a single downloadable installer where readability matters more. Switch from 225 lines of unsafe raw Win32 FFI to ~80 lines of safe Rust using the winreg crate (~50-100 KB after LTO). WM_SETTINGCHANGE broadcast still uses a single raw FFI call since winreg doesn't wrap SendMessageTimeoutW.
- Extract VP_BINARY_NAME constant to avoid duplicated cfg!(windows) binary name literals - Remove redundant exists() check in replace_windows_exe — just attempt the rename unconditionally (rename failure is already ignored) - Trim verbose WHAT-comments to concise single-line doc comments
fengmk2
commented
Apr 4, 2026
| fn main() { | ||
| // On Windows, set DEPENDENTLOADFLAG to only search system32 for DLLs at load time. | ||
| // This prevents DLL hijacking when the installer is downloaded to a folder | ||
| // containing malicious DLLs (e.g. Downloads). Matches rustup's approach. |
Member
Author
There was a problem hiding this comment.
Fix all high/P1/P2 issues from both adversarial and standard reviews: 1. Node.js manager auto-detect: port the full auto-detect logic from install.ps1/install.sh instead of unconditionally enabling shims. Checks VP_NODE_MANAGER env, existing shims, CI/devcontainer, system node availability — and prompts interactively when system node exists (matching install.ps1 behavior). Silent mode (-y) skips the prompt and does not enable shims when system node is present. 2. Same-version repair: when the target version is already installed, skip download/extract/deps but still run all post-activation setup (shims, Node.js manager, PATH, env files). This allows rerunning the installer to repair a broken installation. 3. Rollback protection: include the previous version in protected_versions during cleanup, matching the vp upgrade implementation. Prevents cleanup from deleting the rollback target. 4. Post-activation best-effort: setup_bin_shims, refresh_shims, and modify_path are now wrapped in if-let-Err with warnings instead of propagating errors. After activation (current junction swap), the core install has succeeded — configuration failures should not cause exit code 1.
- Move same-version check before platform package HTTP request: use
resolve_version_string (1 HTTP call) first, then skip
resolve_platform_package (2nd HTTP call) when version matches.
Saves 1 HTTP request for tag matches, both for exact version matches.
- Fix else { if let → else if let (clippy collapsible_else_if)
- Consolidate VP_NODE_MANAGER handling: both "yes" and "no" now checked
in should_enable_node_manager instead of split across cli.rs and main.rs
- Make create_env_files return Result and report via print_warn,
consistent with other best-effort post-activation steps
Move all user prompts to the menu phase — do_install is now prompt-free.
The auto_detect_node_manager() function is pure logic (no I/O) that
resolves the Node.js manager default based on: VP_NODE_MANAGER env,
existing shims, CI/devcontainer, system node presence. The result is
stored in opts.no_node_manager before showing the interactive menu,
so the user sees the resolved value ("enabled"/"disabled") and can
toggle it in the customize submenu before installation begins.
When system node is present and no other signal overrides, the default
is "disabled" — the user can enable it via the customize menu.
In silent mode (-y), this means shims are not created unless explicitly
requested via VP_NODE_MANAGER=yes or auto-detected (CI, no system node).
…tive mode When system node is present: - Interactive mode: default to enabled (matching install.ps1's Y/n prompt where Enter = yes). User can disable via customize menu. - Silent mode (-y): default to disabled (don't silently take over). This matches install.ps1 behavior where most interactive users who press Enter get node management enabled by default.
Replace dynamic matrix.shell in shell: field with explicit shell values per step. The matrix.shell expression was not recognized by the GitHub Actions YAML parser when used in the shell: context. Use a single job that verifies installation from pwsh, cmd, and bash sequentially.
- Update interactive menu examples to show "enabled"/"disabled" instead of "auto-detect" (value is now pre-computed) - Add Node.js Manager Auto-Detection section with priority table documenting the full auto-detect logic matching install.ps1/install.sh - Restructure Installation Flow diagram: local version check before HTTP, split resolve_version into resolve_version_string + resolve_platform_package, same-version repair path skips to CONFIGURE, cleanup moved to ACTIVATE - Update Existing Installation Handling: same version now repairs instead of exiting early - Document best-effort post-activation behavior and failure recovery - Update function mapping table with split registry functions - Update Test Workflow snippet to match actual single-job structure - Update Phase 2 description (winreg, pre-computed node manager, repair)
This function follows the same pattern as refresh_shims (spawn vp with different args) and belongs in the shared library alongside it.
672909f to
816d7f1
Compare
… builds Use setup-dev-drive with ReFS (matching ci.yml) to speed up cargo build. Windows Defender skips ReFS dev drives, which significantly reduces build times on GitHub Actions Windows runners.
fengmk2
commented
Apr 4, 2026
|
|
||
| - **Binary name**: `vp-setup.exe` | ||
| - **Uninstall**: Rely on `vp implode` — no `--uninstall` flag in the installer | ||
| - **Minimum Windows version**: Windows 10 1809+ (same as Rust's MSVC target) |
Member
Author
There was a problem hiding this comment.
The version information is not clear enough; at minimum, you need to specify when the version was released.
fengmk2
commented
Apr 4, 2026
|
|
||
| ### Phase 2: Direct Download URL | ||
|
|
||
| Host at `https://vite.plus/vp-setup.exe` with architecture auto-detection (default x64). |
Member
Author
There was a problem hiding this comment.
should use void worker to handle the architecture detect logic.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Add a standalone
vp-setup.exeWindows installer binary that installsthe vp CLI without requiring PowerShell, complementing the existing
irm https://vite.plus/ps1 | iexscript-based installer.vite_setupshared library crate extracting installation logic(platform detection, registry queries, integrity verification, tarball
extraction, symlink/junction management) from
vite_global_clivite_installerbinary crate producingvp-setup.exewithinteractive prompts, silent mode (-y), progress bars, and Windows PATH
modification via direct registry API (no PowerShell dependency)
vite_global_clito usevite_setupinstead of inline upgrademodules, ensuring upgrade and installer share identical logic
as GitHub Release assets