commitiquette
Version:
Plugin for commitizen to use commitLint config
33 lines (32 loc) • 942 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.commitTemplate = exports.headerTemplate = void 0;
function headerTemplate(type, scope, subject) {
var header = "" + type;
if (scope) {
header += "(" + scope + ")";
}
header += ': ';
if (subject) {
header += subject;
}
return header;
}
exports.headerTemplate = headerTemplate;
function renderSection(value) {
return value ? "\n" + value : '';
}
function commitTemplate(answers) {
var _a;
var template = headerTemplate(answers.type, answers.scope, answers.subject);
template += renderSection(answers.body);
template += renderSection(answers.breaking);
if (answers.breaking) {
template += (_a = answers.issue) !== null && _a !== void 0 ? _a : '';
}
else {
template += renderSection(answers.issue);
}
return template;
}
exports.commitTemplate = commitTemplate;