Fix various commands asking for a password #3862
Merged
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.
Summary
Commands like
publish
were asking for a password instead of using the token in.npmrc
.The core code path that was causing the issue is https://github.com/yarnpkg/yarn/blob/master/src/registries/npm-registry.js#L218-L221
The problem was
baseRegistry = "https://registry.yarnpkg.com"
whileYARN_REGISTRY = "https://registry.yarnpkg.com/"
. Notice the trailing slash.I've reverted the code added in 3382071#diff-b053bee294c216269844e5874039b6caR172
which solves the problem. Unclear to me why it was added though.
Test plan
yarn publish no longer asks for a password.