Skip to content

fix: use real package name for global local packages installation#1685

Open
liangmiQwQ wants to merge 7 commits into
voidzero-dev:mainfrom
liangmiQwQ:fix/check-real-package-json-for-global-install
Open

fix: use real package name for global local packages installation#1685
liangmiQwQ wants to merge 7 commits into
voidzero-dev:mainfrom
liangmiQwQ:fix/check-real-package-json-for-global-install

Conversation

@liangmiQwQ
Copy link
Copy Markdown
Contributor

Related to #664.

The current Vite+ will just treat the path inputed as the package name, and because Vite+ uses package name to create directories and manage installation, it will make Vite+ broken as it can be a bad path.

This PR fixes it by resolving the true package name by reading the package.json under the entered path.

@liangmiQwQ
Copy link
Copy Markdown
Contributor Author

@codex

@netlify
Copy link
Copy Markdown

netlify Bot commented May 26, 2026

Deploy Preview for viteplus-preview canceled.

Name Link
🔨 Latest commit f1daa27
🔍 Latest deploy log https://app.netlify.com/projects/viteplus-preview/deploys/6a15b34c59a7850008ca8efc

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f017f86dd6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/vite_global_cli/src/commands/global/mod.rs Outdated
Comment thread crates/vite_global_cli/src/commands/global/install.rs Outdated
@liangmiQwQ liangmiQwQ marked this pull request as draft May 26, 2026 14:14
@liangmiQwQ
Copy link
Copy Markdown
Contributor Author

@codex

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f1daa2779f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/vite_global_cli/src/commands/global/install.rs
@liangmiQwQ
Copy link
Copy Markdown
Contributor Author

@codex

@liangmiQwQ liangmiQwQ marked this pull request as ready for review May 26, 2026 22:11
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f1daa2779f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +402 to +405
if is_local_package_spec(package_name) {
// We can't resolve local packages for uninstall, follow npm's behavior
return Err(Error::ConfigError(
format!(
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve path-based uninstall for legacy local installs

This early return blocks vp remove -g ./local-path before any metadata/bin lookup, which breaks uninstall for packages installed by older versions that stored the local spec path as the managed package key (the behavior this commit is replacing). After upgrading, those existing installs can no longer be removed via vp by either path (now rejected here) or name (metadata/bin ownership still recorded under the old path), leaving orphaned shims and package state that can block subsequent installs.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it will influence vp install -g --force's uninstall logic, but won't influence normal vp uninstall -g <pkg_name>, as we do not use BinConfig there. I've tested locally and it can still remove a global package

$ vp install -g ./conflict-pkg
VITE+ - The Unified Toolchain for the Web

info: Installing 1 global package with Node.js 24.16.0
warn: Package './conflict-pkg' provides 'node' binary, but it conflicts with a core shim. Skipping.
✓ Installed ./conflict-pkg 1.0.0
  Bins: conflict-cli, node

~/code/voidzero-dev/vite-plus on fix/check-real-package-json-for-global-install [!]
$ pnpm bootstrap-cli
...

~/code/voidzero-dev/vite-plus on fix/check-real-package-json-for-global-install [!] took 1m37s
$ vp uninstall -g conflict-pkg
Uninstalled conflict-pkg

tip: Available short aliases: i = install, rm = remove, un = uninstall, up = update, ls = list, ln = link

~/code/voidzero-dev/vite-plus on fix/check-real-package-json-for-global-install [!]
$ vp list -g conflict-pkg
No global packages matching 'conflict-pkg'.

Run 'vp list -g' to see all installed global packages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant