@bevry/update-contributors
Version:
Update the package.json author, contributors, and maintainers fields with the latest remote data
25 lines (24 loc) • 781 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.getGitHubRepoSlug = void 0;
function getGitHubRepoSlug(pkg) {
let match = null;
if (typeof pkg.repository === 'string') {
match = pkg.repository.match(/^(?:github:)?([^/:]+\/[^/:]+)$/);
}
else {
let url = null;
if (pkg.repository && typeof pkg.repository.url === 'string') {
url = pkg.repository && pkg.repository.url;
}
else if (typeof pkg.homepage === 'string') {
url = pkg.homepage;
}
else {
return null;
}
match = url.match(/github\.com\/([^/:]+\/[^/:]+?)(?:\.git|\/)?$/);
}
return (match && match[1]) || null;
}
exports.getGitHubRepoSlug = getGitHubRepoSlug;
;