Skip to content

refactor: merge packages/global into packages/cli - #607

Merged
fengmk2 merged 51 commits into
mainfrom
merge-global-and-local-cli-into-one-v2
Feb 24, 2026
Merged

refactor: merge packages/global into packages/cli#607
fengmk2 merged 51 commits into
mainfrom
merge-global-and-local-cli-into-one-v2

Conversation

@fengmk2

Copy link
Copy Markdown
Member

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

@fengmk2fengmk2 self-assigned this Feb 20, 2026
@fengmk2
fengmk2 changed the base branch from fix-vp-node-version to graphite-base/607February 20, 2026 04:47
@fengmk2
fengmk2force-pushed the merge-global-and-local-cli-into-one-v2 branch from 5ba62a3 to 468d79cCompareFebruary 20, 2026 04:48
@graphite-app
graphite-appBot changed the base branch from graphite-base/607 to mainFebruary 20, 2026 04:48
@fengmk2
fengmk2force-pushed the merge-global-and-local-cli-into-one-v2 branch 7 times, most recently from a1d5818 to bab6e21CompareFebruary 21, 2026 03:03
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.
@fengmk2
fengmk2force-pushed the merge-global-and-local-cli-into-one-v2 branch from b19dc2a to 0bcd26fCompareFebruary 21, 2026 16:11
…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
@fengmk2
fengmk2force-pushed the merge-global-and-local-cli-into-one-v2 branch from 0bcd26f to f3bd656CompareFebruary 22, 2026 06:12
@fengmk2
fengmk2force-pushed the merge-global-and-local-cli-into-one-v2 branch from aec3d67 to ead6747CompareFebruary 22, 2026 07:13
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.
@fengmk2Graphite App

fengmk2 commented Feb 24, 2026

Copy link
Copy Markdown
MemberAuthor

Merge activity

  • Feb 24, 3:15 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Feb 24, 3:16 AM UTC: @fengmk2 merged this pull request with Graphite.

@fengmk2
fengmk2 merged commit 5fff361 into mainFeb 24, 2026
79 of 88 checks passed
@fengmk2
fengmk2 deleted the merge-global-and-local-cli-into-one-v2 branch February 24, 2026 03:16
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test: install-e2erun vite install e2e test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@fengmk2@wan9chi