Skip to content

Commit

Permalink
fix(login): properly save scope if defined
Browse files Browse the repository at this point in the history
setCredentialsByURI was clobbering the saving of the scope:registry
config

PR-URL: #3383
Credit: @wraithgar
Close: #3383
Reviewed-by: @nlf
  • Loading branch information
wraithgar committed Jun 10, 2021
1 parent 7d5b049 commit 992799c
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions lib/adduser.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,9 @@ class AddUser extends BaseCommand {

async updateConfig ({ newCreds, registry, scope }) {
this.npm.config.delete('_token', 'user') // prevent legacy pollution

this.npm.config.setCredentialsByURI(registry, newCreds)
if (scope)
this.npm.config.set(scope + ':registry', registry, 'user')

this.npm.config.setCredentialsByURI(registry, newCreds)
await this.npm.config.save('user')
}
}
Expand Down

0 comments on commit 992799c

Please sign in to comment.