diff options
author | Luke Karrys <luke@lukekarrys.com> | 2022-04-11 21:58:18 +0300 |
---|---|---|
committer | Nathan Fritz <fritzy@github.com> | 2022-04-14 00:30:39 +0300 |
commit | 25450652240dc8e7e28e391313b93f0f27c6da19 (patch) | |
tree | c563f9be53076977603c0554f61002af0565110b | |
parent | 5ba7f0cef753d4af0bc02ca7d6dd0ac1bdd11ffe (diff) |
fixup! fix: show more information during publish dry-run
-rw-r--r-- | lib/commands/publish.js | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/commands/publish.js b/lib/commands/publish.js index 560dae1b6..51861c5aa 100644 --- a/lib/commands/publish.js +++ b/lib/commands/publish.js @@ -105,14 +105,18 @@ class Publish extends BaseCommand { const resolved = npa.resolve(manifest.name, manifest.version) const registry = npmFetch.pickRegistry(resolved, opts) const creds = this.npm.config.getCredentialsByURI(registry) + const noCreds = !creds.token && !creds.username const outputRegistry = replaceInfo(registry) - if (!creds.token && !creds.username) { - throw Object.assign( - new Error(`This command requires you to be logged in to ${outputRegistry}`), { - code: 'ENEEDAUTH', - } - ) + + if (noCreds) { + const msg = `This command requires you to be logged in to ${outputRegistry}` + if (dryRun) { + log.warn('', `${msg} (dry-run)`) + } else { + throw Object.assign(new Error(msg), { code: 'ENEEDAUTH' }) + } } + log.notice('', `Publishing to ${outputRegistry}${dryRun ? ' (dry-run)' : ''}`) if (!dryRun) { |