Skip to content

Commit

Permalink
Use flatten twice
Browse files Browse the repository at this point in the history
  • Loading branch information
kenrick95 committed Mar 16, 2021
1 parent c9aa273 commit cb8a7fa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
7 changes: 1 addition & 6 deletions lib/publish.js
Expand Up @@ -137,12 +137,7 @@ class Publish extends BaseCommand {
publishConfigToOpts (publishConfig) {
// create a new object that inherits from the config stack
// then squash the css-case into camelCase opts, like we do
const mergedConfigs = Object.assign(
{},
...[...this.npm.config.list].reverse(),
publishConfig
)
return flatten(mergedConfigs)
return flatten({...flatten(this.npm.config.list[0]), ...publishConfig})
}
}
module.exports = Publish
6 changes: 5 additions & 1 deletion test/lib/publish.js
Expand Up @@ -521,7 +521,11 @@ t.test('able to publish after if encountered multiple configs', t => {
}, null, 2),
})

const configList = [{ tag }, { registry: `https://other.registry`, tag: 'some-tag' }, defaults]
const configList = [
{ ...defaults, tag },
{ ...defaults, registry: `https://other.registry`, tag: 'some-tag' },
defaults,
]

const Publish = requireInject('../../lib/publish.js', {
libnpmpublish: {
Expand Down

0 comments on commit cb8a7fa

Please sign in to comment.