Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorLuke Karrys <luke@lukekarrys.com>2022-04-11 08:21:17 +0300
committerNathan Fritz <fritzy@github.com>2022-04-14 00:30:39 +0300
commit5ba7f0cef753d4af0bc02ca7d6dd0ac1bdd11ffe (patch)
tree7300133899a933b985a32f57989129ab304e6ea5 /lib
parent06eff18d8a8f1ed41e91eb747f9c03e76d953353 (diff)
fix: show more information during publish dry-run
Fixes #4317
Diffstat (limited to 'lib')
-rw-r--r--lib/commands/publish.js25
1 files changed, 13 insertions, 12 deletions
diff --git a/lib/commands/publish.js b/lib/commands/publish.js
index 1f26370e8..560dae1b6 100644
--- a/lib/commands/publish.js
+++ b/lib/commands/publish.js
@@ -102,19 +102,20 @@ class Publish extends BaseCommand {
logTar(pkgContents, { unicode })
}
+ const resolved = npa.resolve(manifest.name, manifest.version)
+ const registry = npmFetch.pickRegistry(resolved, opts)
+ const creds = this.npm.config.getCredentialsByURI(registry)
+ 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',
+ }
+ )
+ }
+ log.notice('', `Publishing to ${outputRegistry}${dryRun ? ' (dry-run)' : ''}`)
+
if (!dryRun) {
- const resolved = npa.resolve(manifest.name, manifest.version)
- const registry = npmFetch.pickRegistry(resolved, opts)
- const creds = this.npm.config.getCredentialsByURI(registry)
- 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',
- }
- )
- }
- log.notice('', `Publishing to ${outputRegistry}`)
await otplease(opts, opts => libpub(manifest, tarballData, opts))
}