fix(pm): support authenticated private registries - #2624
Draft
RSS1102 wants to merge 3 commits into
Draft
Conversation
✅ Deploy Preview for viteplus-preview canceled.
|
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.
Problem
Vite+ respects
NPM_CONFIG_REGISTRYwhen downloading a pinned package manager, but previously ignored registry credentials from.npmrc. Authenticated corporate registries therefore returned401before the requested package manager could run.Behavior
Registry configuration is merged in this order:
Package routing then uses
@scope:registry, followed byregistry, and finally the public npm registry.Authentication uses the same configuration-source order. Credentials are matched to the final request URL by host, port, and longest path, with
_authToken,_auth, andusername/_passwordsupport. Matching credentials are sent on the first metadata and tarball requests.NPM_TOKENremains an environment-variable value referenced by a registry-scoped.npmrcentry:This keeps credentials bound to their intended registry instead of treating one token as valid for every configured endpoint.
Validation
cargo test -p vp_pm_cli --lib(759 passed,2 ignored)cargo clippy -p vp_pm_cli --lib --tests -- -D warningsgit diff --checkCloses #2603