Skip to content

Commit

Permalink
fix: make sure publishConfig is passed through
Browse files Browse the repository at this point in the history
  • Loading branch information
nlf authored and darcyclarke committed Oct 12, 2020
1 parent 08de490 commit 7bcdb36
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion test/lib/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})

Expand All @@ -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')
}
},
Expand Down

1 comment on commit 7bcdb36

@Jettace
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.