jsx-readme
Version:
Generate Readme files with a React-like syntax and package.json-aware helpers.
24 lines • 1.3 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CircleCIBadge = void 0;
/* @jsx MD */
const jsx_md_1 = __importDefault(require("jsx-md"));
const Badge_1 = require("../Badge");
const extractGithubOwnerAndRepo_1 = require("./utils/extractGithubOwnerAndRepo");
/** Display a badge with the status of CircleCI Build */
const CircleCIBadge = ({ branch, style = "svg", pkg, }) => {
const ownerAndRepo = (0, extractGithubOwnerAndRepo_1.extractGithubOwnerAndRepo)(pkg.repository);
if (ownerAndRepo === undefined) {
return null;
}
const { owner, repo } = ownerAndRepo;
if (branch === undefined) {
return ((0, jsx_md_1.default)(Badge_1.Badge, { link: `https://circleci.com/gh/${owner}/${repo}`, imageSource: `https://circleci.com/gh/${owner}/${repo}.svg?style=${style}` }, "CircleCI"));
}
return ((0, jsx_md_1.default)(Badge_1.Badge, { link: `https://circleci.com/gh/${owner}/${repo}/tree/${branch}`, imageSource: `https://circleci.com/gh/${owner}/${repo}/tree/${branch}.svg?style=${style}` }, "CircleCI"));
};
exports.CircleCIBadge = CircleCIBadge;
//# sourceMappingURL=CircleCIBadge.js.map