Skip to content

fix(global): keep npm aliases through list, outdated, and update - #3480

Draft
liangmiQwQ wants to merge 1 commit into
voidzero-dev:mainfrom
liangmiQwQ:fix/global-npm-alias
Draft

liangmiQwQ wants to merge 1 commit into
voidzero-dev:mainfrom
liangmiQwQ:fix/global-npm-alias

Conversation

@liangmiQwQ

Copy link
Copy Markdown
Collaborator

Close #2256

The current global commands forget that a package was installed as an npm alias. After vp install -g typescript@npm:cowsay, vp list -g shows a fake typescript@1.6.0. vp outdated -g compares cowsay's version with TypeScript's. And vp up -g typescript reinstalls the real typescript in place of cowsay.

This PR records the alias in the existing versionSpec metadata (npm:cowsay or npm:cowsay@^1). Updates then reinstall through the alias:

  • vp up -g typescript keeps the alias and its range.
  • vp up -g typescript --latest drops the range but keeps the alias (npm:cowsay).
  • vp up -g typescript@6 installs the real package, same as npm install.

npm view rejects alias specs, so registry lookups query the aliased package (cowsay@^1) instead. Following the expected behavior in npm/cli#9706, vp outdated -g shows alias versions as cowsay@1.6.0 and vp list -g shows typescript@npm:cowsay@1.6.0.

Aliases installed before this change have no recorded spec, so they need one reinstall to pick this up.

🤖 Generated with Claude Code

This branch has not been deployed

No deployments
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.

Handle npm alias for global installations

1 participant