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OAEA,EAAI,eACE,EAAI,OACiB,IAA5B,EAAI,aAAa,eACV,EAAI,aACgB,IAA3B,EAAI,YAAY,eACT,EAAI,kBAET,EAAI,OAAO,WAAW,EAAM,GAElC,QAAQ,IAAI,yBAAyB,YAAqB,iBAA2B,KACzF,CACA,QAAQ,QAAU","file":"/npm/@bevry/update-contributors@1.23.0/edition-es2022/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.37.0.\n * Original file: /npm/@bevry/update-contributors@1.23.0/edition-es2022/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst github_contributors_1 = require(\"@bevry/github-contributors\");\nconst json_1 = require(\"@bevry/json\");\nconst util_js_1 = require(\"./util.js\");\nasync function updateContributors(path) {\n    let localCount = 0, remoteCount = 0;\n    // read\n    const pkg = await (0, json_1.readJSON)(path);\n    // slug\n    const githubRepoSlug = (0, util_js_1.getGitHubRepoSlug)(pkg);\n    const slug = githubRepoSlug || pkg.name;\n    if (!slug) {\n        console.error(path, pkg);\n        throw new Error('package needs at least a name to identify it uniquely');\n    }\n    // Add local people to the singleton with their appropriate permissions\n    github_contributors_1.Fellow.add(pkg.author, pkg.authors).forEach((person) => {\n        person.authoredRepositories.add(slug);\n    });\n    github_contributors_1.Fellow.add(pkg.contributors).forEach((person) => {\n        person.contributedRepositories.add(slug);\n    });\n    github_contributors_1.Fellow.add(pkg.maintainers).forEach((person) => {\n        person.maintainedRepositories.add(slug);\n    });\n    localCount = github_contributors_1.Fellow.fellows.length;\n    // Enhance authors, contributors and maintainers with latest remote data\n    if (githubRepoSlug) {\n        try {\n            const added = await (0, github_contributors_1.getContributorsFromRepoContributorData)(githubRepoSlug);\n            remoteCount = added.size;\n        }\n        catch (err) {\n            console.warn(err);\n            console.warn(`FAILED to fetch the remote contributors for the repository: ${githubRepoSlug}`);\n        }\n    }\n    // update the data with the converged data\n    delete pkg.authors;\n    pkg.author = github_contributors_1.Fellow.authorsRepository(slug)\n        .map((fellow) => fellow.toString({ displayYears: true, displayEmail: true }))\n        .join(', ');\n    pkg.contributors = github_contributors_1.Fellow.contributesRepository(slug)\n        .map((fellow) => fellow.toString({ displayEmail: true, urlFields: ['githubUrl', 'url'] }))\n        .filter((entry) => entry.includes('[bot]') === false)\n        .sort();\n    pkg.maintainers = github_contributors_1.Fellow.maintainsRepository(slug)\n        .map((fellow) => fellow.toString({ displayEmail: true, urlFields: ['githubUrl', 'url'] }))\n        .sort();\n    // clean up in case empty\n    if (!pkg.author)\n        delete pkg.author;\n    if (pkg.contributors.length === 0)\n        delete pkg.contributors;\n    if (pkg.maintainers.length === 0)\n        delete pkg.maintainers;\n    // write it\n    await (0, json_1.writeJSON)(path, pkg);\n    // done\n    console.log(`Updated contributors (${localCount} local, ${remoteCount} remote) on [${path}]`);\n}\nexports.default = updateContributors;\n"]}