git-auto-badger
Version:
A npm cli tool that reads your package.json/project metadata and git config and connects your readme with multiple badge providers (shields.io, badgen.net etc)
11 lines • 1.08 kB
JavaScript
const { detectRepoUrl } = require("../helpers/detectRepoUrl");
const { parseRepoUrl } = require("../helpers/parseRepoUrl");
exports.generate = async function () {
const repoUrl = await detectRepoUrl();
const { repoOwner, repoName } = parseRepoUrl(repoUrl);
const allContributersBadge = `[](https://github.com/${repoOwner}/${repoName}/graphs/contributors)`;
const codeOfConduct = `[](https://github.com/${repoOwner}/${repoName}/blob/master/CODE_OF_CONDUCT.md)`;
const starsBadge = `[](https://github.com/${repoOwner}/${repoName}/stargazers)`;
const forkBadge = `[](https://github.com/${repoOwner}/${repoName}/fork)`;
return [allContributersBadge, codeOfConduct, starsBadge, forkBadge];
}