diff --git a/lib/publish.js b/lib/publish.js index 602d213b68393..1ff7366255a2d 100644 --- a/lib/publish.js +++ b/lib/publish.js @@ -69,7 +69,8 @@ const publish_ = async (arg, opts) => { // The purpose of re-reading the manifest is in case it changed, // so that we send the latest and greatest thing to the registry manifest = await readJson(`${arg}/package.json`) - await otplease(opts, opts => libpub(arg, manifest, opts)) + const { publishConfig } = manifest + await otplease(opts, opts => libpub(arg, manifest, { ...opts, publishConfig })) } // publish diff --git a/test/lib/publish.js b/test/lib/publish.js index 627cb71f8588d..e5e412e396c1a 100644 --- a/test/lib/publish.js +++ b/test/lib/publish.js @@ -2,10 +2,12 @@ const { test, cleanSnapshot } = require('tap') const requireInject = require('require-inject') test('should publish with libnpmpublish', (t) => { + const publishConfig = { registry: 'https://some.registry' } const testDir = t.testdir({ 'package.json': JSON.stringify({ name: 'my-cool-pkg', - version: '1.0.0' + version: '1.0.0', + publishConfig }, null, 2) }) @@ -32,6 +34,7 @@ test('should publish with libnpmpublish', (t) => { t.ok(arg, 'gets path') t.ok(manifest, 'gets manifest') t.ok(opts, 'gets opts object') + t.same(opts.publishConfig, publishConfig, 'publishConfig is passed through') t.ok(true, 'libnpmpublish is called') } },