feat: expose package manager detection and download APIs#308
Merged
Conversation
Member
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
fengmk2
changed the base branch from
11-11-feat_run_command_with_fspy
to
graphite-base/308
November 15, 2025 08:32
fengmk2
force-pushed
the
11-15-feat_export_download_package_manager_helper
branch
from
November 15, 2025 08:39
f9b8d8e to
fead428
Compare
fengmk2
force-pushed
the
graphite-base/308
branch
from
November 15, 2025 08:39
2e9276a to
06cf754
Compare
fengmk2
changed the base branch from
graphite-base/308
to
11-11-feat_run_command_with_fspy
November 15, 2025 08:39
fengmk2
force-pushed
the
11-15-feat_export_download_package_manager_helper
branch
2 times, most recently
from
November 15, 2025 09:51
e9e6dac to
57029f1
Compare
fengmk2
force-pushed
the
11-11-feat_run_command_with_fspy
branch
2 times, most recently
from
November 15, 2025 09:57
21916a3 to
1db7b58
Compare
fengmk2
force-pushed
the
11-15-feat_export_download_package_manager_helper
branch
from
November 15, 2025 09:57
57029f1 to
ebce813
Compare
fengmk2
force-pushed
the
11-15-feat_export_download_package_manager_helper
branch
from
November 19, 2025 06:27
ebce813 to
8bf1272
Compare
fengmk2
force-pushed
the
11-11-feat_run_command_with_fspy
branch
from
November 19, 2025 06:27
1db7b58 to
f3cb301
Compare
fengmk2
force-pushed
the
11-15-feat_export_download_package_manager_helper
branch
from
November 19, 2025 06:53
8bf1272 to
d1a3ebb
Compare
fengmk2
force-pushed
the
11-11-feat_run_command_with_fspy
branch
2 times, most recently
from
November 19, 2025 07:04
c315cb6 to
f409ec7
Compare
fengmk2
force-pushed
the
11-15-feat_export_download_package_manager_helper
branch
from
November 19, 2025 07:04
d1a3ebb to
8a3eb33
Compare
fengmk2
force-pushed
the
11-11-feat_run_command_with_fspy
branch
from
November 19, 2025 07:09
f409ec7 to
dbd0974
Compare
fengmk2
force-pushed
the
11-15-feat_export_download_package_manager_helper
branch
2 times, most recently
from
November 19, 2025 08:21
b34995d to
74cd86e
Compare
fengmk2
force-pushed
the
11-11-feat_run_command_with_fspy
branch
2 times, most recently
from
November 19, 2025 08:24
af40762 to
bc1410d
Compare
fengmk2
force-pushed
the
11-15-feat_export_download_package_manager_helper
branch
2 times, most recently
from
November 19, 2025 09:00
5859dd3 to
b0f8412
Compare
fengmk2
force-pushed
the
11-11-feat_run_command_with_fspy
branch
from
November 19, 2025 09:00
bc1410d to
d258eb1
Compare
fengmk2
force-pushed
the
11-15-feat_export_download_package_manager_helper
branch
2 times, most recently
from
November 19, 2025 10:03
a41588e to
d5a6269
Compare
fengmk2
force-pushed
the
11-11-feat_run_command_with_fspy
branch
2 times, most recently
from
November 19, 2025 11:05
59f106d to
4fd6e56
Compare
fengmk2
force-pushed
the
11-15-feat_export_download_package_manager_helper
branch
from
November 19, 2025 11:05
d5a6269 to
37853c1
Compare
fengmk2
marked this pull request as ready for review
November 19, 2025 12:56
fengmk2
changed the base branch from
11-11-feat_run_command_with_fspy
to
graphite-base/308
November 20, 2025 07:07
fengmk2
force-pushed
the
11-15-feat_export_download_package_manager_helper
branch
from
November 20, 2025 07:07
37853c1 to
e94dab5
Compare
fengmk2
force-pushed
the
graphite-base/308
branch
from
November 20, 2025 07:07
4fd6e56 to
bb0f097
Compare
fengmk2
force-pushed
the
11-15-feat_export_download_package_manager_helper
branch
from
November 20, 2025 07:08
e94dab5 to
1dfda67
Compare
wan9chi
approved these changes
Nov 21, 2025
fengmk2
force-pushed
the
11-15-feat_export_download_package_manager_helper
branch
from
November 21, 2025 03:40
1dfda67 to
810a8d5
Compare
Member
Author
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR exposes package manager detection and download functionality through the CLI binding API, enabling external tools to leverage Vite's package manager capabilities without reimplementing the logic.
Key Changes:
- Added
detectWorkspaceanddownloadPackageManagerfunctions to the public API - Refactored
download_package_managerin the Rust crate to return package metadata (install_dir, package_name, version) - Created comprehensive test suites with fixtures for pnpm and npm monorepos
Reviewed Changes
Copilot reviewed 13 out of 15 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/cli/binding/src/package_manager.rs | New module implementing the NAPI bindings for workspace detection and package manager download |
| packages/cli/binding/src/lib.rs | Exports the new public functions |
| packages/cli/binding/index.js | Exports the new functions to JavaScript |
| packages/cli/binding/index.d.ts | TypeScript type definitions for the new API |
| crates/vite_install/src/package_manager.rs | Refactored download_package_manager to return tuple with metadata and made functions public |
| crates/vite_install/src/lib.rs | Exports newly public functions |
| packages/cli/binding/tests/detect-workspace.spec.ts | Test suite for workspace detection |
| packages/cli/binding/tests/download-package-manager.spec.ts | Test suite for package manager download |
| packages/cli/binding/tests/fixtures/* | Test fixtures for pnpm-monorepo, npm-monorepo, and npm-project |
| packages/cli/binding/Cargo.toml | Added vite_workspace dependency |
| Cargo.lock | Updated with new dependency |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
fengmk2
commented
Nov 21, 2025
fengmk2
deleted the
11-15-feat_export_download_package_manager_helper
branch
November 21, 2025 05:08
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.

TL;DR
Expose package manager detection and download functionality through the CLI binding API.
What changed?
detectWorkspace: Detects the workspace root, package manager type, version, and whether it's a monorepodownloadPackageManager: Downloads a specified package manager versionvite_installto make it more modular and reusableHow to test?
Run the new tests:
Try using the new API in a project:
Why make this change?
This change enables external tools and plugins to leverage Vite's package manager detection and download capabilities. By exposing these functions through the CLI binding API, other tools can reliably determine the project structure and ensure the correct package manager is available without reimplementing this logic.