Skip to content

Commit

Permalink
Fix checking collaborators when publishing to external registry (#491)
Browse files Browse the repository at this point in the history
  • Loading branch information
fohletex authored and itaisteinherz committed Jan 25, 2020
1 parent b14dbc9 commit 4ad4146
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions source/npm/util.js
Expand Up @@ -39,11 +39,17 @@ exports.username = async ({externalRegistry}) => {
}
};

exports.collaborators = async packageName => {
exports.collaborators = async pkg => {
const packageName = pkg.name;
ow(packageName, ow.string);

const args = ['access', 'ls-collaborators', packageName];
if (exports.isExternalRegistry(pkg)) {
args.push('--registry', pkg.publishConfig.registry);
}

try {
const {stdout} = await execa('npm', ['access', 'ls-collaborators', packageName]);
const {stdout} = await execa('npm', args);
return stdout;
} catch (error) {
// Ignore non-existing package error
Expand Down
2 changes: 1 addition & 1 deletion source/prerequisite-tasks.js
Expand Up @@ -36,7 +36,7 @@ module.exports = (input, pkg, options) => {
externalRegistry: isExternalRegistry ? pkg.publishConfig.registry : false
});

const collaborators = await npm.collaborators(pkg.name);
const collaborators = await npm.collaborators(pkg);
if (!collaborators) {
return;
}
Expand Down

0 comments on commit 4ad4146

Please sign in to comment.