Skip to content

Commit

Permalink
Check package name availability in custom registry (#429)
Browse files Browse the repository at this point in the history
  • Loading branch information
itaisteinherz authored and sindresorhus committed Nov 30, 2019
1 parent e53cbe8 commit 8360cb6
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions source/npm/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,14 @@ exports.prereleaseTags = async packageName => {
};

exports.isPackageNameAvailable = async pkg => {
const isExternalRegistry = exports.isExternalRegistry(pkg);
if (isExternalRegistry) {
return true;
const args = [pkg.name];
if (exports.isExternalRegistry(pkg)) {
args.push({
registryUrl: pkg.publishConfig.registry
});
}

return npmName(pkg.name);
return npmName(...args);
};

exports.isExternalRegistry = pkg => typeof pkg.publishConfig === 'object' && typeof pkg.publishConfig.registry === 'string';
Expand Down

0 comments on commit 8360cb6

Please sign in to comment.