UNPKG

@speedy-js/mono

Version:

Monorepo development & continuous integration tooling.

28 lines 1.3 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ChangelogProcessor4AttachAuthor = void 0; const helpers_1 = require("../helpers"); const regexp_1 = require("../regexp"); const ChangelogProcessor4AttachAuthor = (cwd, input, options = {}) => { var _a, _b; const displayType = (_a = options.displayType) !== null && _a !== void 0 ? _a : 'name'; const getAuthorPage = (_b = options.getAuthorPage) !== null && _b !== void 0 ? _b : ((author) => { return `https://github.com/${author.emailName}`; }); const hashAuthorMap = (0, helpers_1.getCommitHashAuthorMap)(cwd); const ret = input.replace(regexp_1.COMMIT_RE, (m, s1 /* hash */, s2 /* url */, s3 /* white space */, s4 /* author part */, s5 /* author text */) => { const author = hashAuthorMap[s1]; /** * s4 exists, do not need generate author */ if (!author || s4) { return m; } const dispalyName = displayType === 'name' ? author.name : author.emailName; const authorUrl = getAuthorPage(author); return `([${s1}](${s2})) [@${dispalyName}](${authorUrl})`; }); return ret; }; exports.ChangelogProcessor4AttachAuthor = ChangelogProcessor4AttachAuthor; //# sourceMappingURL=attach-author.js.map