Skip to content

Commit

Permalink
fix(publish): Use modern auth resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
evocateur committed Oct 8, 2018
1 parent ef47f2a commit 7ba41a6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions commands/publish/index.js
Expand Up @@ -7,6 +7,7 @@ const pMap = require("p-map");
const pPipe = require("p-pipe");
const pReduce = require("p-reduce");
const semver = require("semver");
const getAuth = require("npm-registry-fetch/auth");

const Command = require("@lerna/command");
const describeRef = require("@lerna/describe-ref");
Expand Down Expand Up @@ -66,11 +67,9 @@ class PublishCommand extends Command {
// https://docs.npmjs.com/misc/config#save-prefix
this.savePrefix = this.options.exact ? "" : "^";

const { registry, npmClient = "npm" } = this.options;

this.conf = npmConf({
log: this.logger,
registry,
registry: this.options.registry,
});

if (this.conf.get("registry") === "https://registry.yarnpkg.com") {
Expand All @@ -81,14 +80,15 @@ class PublishCommand extends Command {
}

// all consumers need a token
const auth = this.conf.getCredentialsByURI(this.conf.get("registry"));
const registry = this.conf.get("registry");
const auth = getAuth(registry, this.conf);

if (auth.token) {
this.conf.set("token", auth.token, "cli");
}

this.npmConfig = {
npmClient,
npmClient: this.options.npmClient || "npm",
registry: this.conf.get("registry"),
};

Expand Down

0 comments on commit 7ba41a6

Please sign in to comment.