refactor: merge packages/global into packages/cli#607
Merged
Conversation
Member
Author
5ba62a3 to
468d79c
Compare
6345b05 to
277648f
Compare
a1d5818 to
bab6e21
Compare
Merge the global CLI package (vite-plus-cli) into the local CLI package (vite-plus), consolidating two npm packages into one. Key changes: - Move global source files into packages/cli/src/ with renames to avoid conflicts (global-entry.ts, global-utils/, global-types/) - Merge NAPI binding crates (migration.rs, package_manager.rs, global_utils.rs) into packages/cli/binding/ - Update rolldown config to bundle global entry with code splitting - Update Rust binary to reference global-entry.js instead of index.js - Update install scripts and wrapper.js for vite-plus package names - Update publish-native-addons.ts to include Rust vp binary - Remove packages/global/ entirely - Update CI workflows and root scripts to remove global-specific steps - Add snap-test-global script for running global CLI snap tests
…r.js - Rename binding/src/global_utils.rs to binding/src/utils.rs - Remove bin/wrapper.js (no longer referenced after merge)
Pass the Rust binary path via VITE_PLUS_LOCAL_BINARY env var to install scripts instead of embedding it in the npm tarball. This eliminates the vp-binary/ staging directory and keeps platform-specific binaries out of the main npm package. - install-global-cli.ts sets VITE_PLUS_LOCAL_BINARY from target/release/ - install.sh/install.ps1 copy binary from the env var path - Remove copy-vp-binary script from root package.json - Remove vp-binary from packages/cli files field and .gitignore - Remove CI step that copied binary to vp-binary/ - Add binding/ to install items_to_copy and MAIN_PACKAGE_ENTRIES
…l CLI Install the full vite-plus dependency tree in the global vp installation so that projects without a local vite-plus can use the global one. - install.sh/install.ps1: keep production deps (only strip dev/optional) - install-global-cli.ts: for local dev, skip vp install and symlink packages/cli/node_modules (avoids workspace:* → 0.0.0 npm issues) - local/bin.ts: when no local vite-plus found, try the global installation's vite-plus before prompting to install - Add VITE_PLUS_SKIP_DEPS_INSTALL env var for install scripts - Add binding/ to MAIN_PACKAGE_ENTRIES for upgrade command
Merge global-entry.ts into bin.ts so both local and global CLI share one entry point compiled by tsc. This eliminates the rolldown bundling step. - bin.ts: handles create/migrate/--version (global) and delegates everything else to the Rust core via NAPI binding (local) - Remove rolldown.config.ts and rolldown devDependency - Remove buildGlobalEntry() from build.ts, compile all src/ with tsc - Fix .ts imports in version.ts to .js for tsc compatibility - Update Rust binary to reference bin.js instead of global-entry.js
These packages are imported at runtime by the global CLI modules (create, migrate, version) and are no longer bundled by rolldown.
…report When `vp --version` delegated to a local node_modules copy, the JS `getGlobalVersion()` read the local package.json via `import.meta.dirname`, showing the local version as the global version. Now the Rust binary sets `VITE_PLUS_GLOBAL_VERSION` from `CARGO_PKG_VERSION` before delegation, and the JS side reads this env var instead.
Rolldown silently externalizes imports it can't resolve, producing output with bare specifiers that crash at runtime. Add post-bundle validation to detect unbundled @voidzero-dev/* imports in dist/global/.
When --tgz is passed (CI mode), the monorepo node_modules doesn't exist so symlinking fails. Instead, rewrite @voidzero-dev/* deps to file: protocol pointing at sibling tgz files and run npm install.
b19dc2a to
0bcd26f
Compare
…Windows Windows cmd.exe doesn't support `VAR=val command` syntax, causing snap-test-global to fail with 'SNAP_TEST_DIR is not recognized'. Replace with --dir and --bin-dir CLI args with ~ expansion via os.homedir().
Instead of extracting vite-plus internals (dist/, binding/, templates/,
rules/, package.json) directly into ~/.vite-plus/VERSION/, generate a
wrapper package.json that declares vite-plus as a dependency and let npm
install it into node_modules/. This decouples the vp binary from
vite-plus's internal file layout.
New structure: VERSION_DIR/{bin/vp, package.json, node_modules/vite-plus/}
- Update js_executor.rs to resolve scripts from node_modules/vite-plus/dist
- Remove extract_main_package, strip_dev_dependencies, MAIN_PACKAGE_ENTRIES
- Add generate_wrapper_package_json to upgrade/install.rs
- Remove main tarball download from upgrade flow (npm handles it)
- Remove .node file extraction (npm installs via optionalDeps)
- Simplify install.sh and install.ps1 to only extract binary + generate wrapper
- Rewrite setupLocalDevDeps to symlink packages/cli as node_modules/vite-plus
- Rewrite installCiDeps to generate wrapper with file: protocol refs
- Update CI get_cli_version to read from node_modules/vite-plus/package.json
0bcd26f to
f3bd656
Compare
aec3d67 to
ead6747
Compare
Publish vp binary in `@voidzero-dev/vite-plus-cli-{platform}` packages
instead of bundling it in NAPI `@voidzero-dev/vite-plus-{platform}`
packages. This reduces NAPI package size for devDependency installs
where the CLI binary is not needed.
- publish-native-addons.ts: stop copying vp binary into NAPI packages,
create and publish separate CLI packages per platform
- registry.rs: query CLI package directly instead of looking up
optionalDependencies, remove unused optional_dependencies field
- install.sh/install.ps1: construct CLI package suffix directly instead
of querying optionalDependencies from package metadata
…pretation GNU tar from Git Bash misinterprets drive letters (D:, C:) as remote host references in both the archive path and -C directory argument. Use the Windows system tar (bsdtar) which handles Windows paths natively.
Pass --registry after -- separator so it reaches the underlying package manager instead of being rejected by clap as an unknown argument to vp install.
npm does not support --no-git-checks (it's a pnpm-only flag), causing warnings in CI. npm publish has no git checks by default so the flag is unnecessary.
branchseer
approved these changes
Feb 24, 2026
Member
Author
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.

Merge the global CLI package (vite-plus-cli) into the local CLI package
(vite-plus), consolidating two npm packages into one.
Key changes:
conflicts (global-entry.ts, global-utils/, global-types/)
global_utils.rs) into packages/cli/binding/