@r4lrgx/gitmoji
Version:
🧱 My customized Gitmoji Config - a fork of https://github.com/arvinxx/gitmoji-commit-workflow - just with several bug fixes and a cleaner look.
37 lines (34 loc) • 926 B
JavaScript
// @r4lrgx/gitmoji v1.0.3
// MIT License
// src/changelog-config/whatBump.ts
function formatMessage(count, singular) {
if (count === 0) return `0 ${singular}s`;
if (count === 1) return `1 ${singular}`;
return `${count} ${singular}s`;
}
function whatBump(commits) {
let level = 2;
let breakings = 0;
let features = 0;
for (const commit of commits) {
if (commit.notes.length > 0) {
breakings += commit.notes.length;
level = 0;
continue;
}
if (level > 1 && commit.type === "feat") {
features++;
level = 1;
}
}
const BREAKING = formatMessage(breakings, "BREAKING CHANGE");
const FEATURE = formatMessage(features, "feature");
const verb = breakings === 1 ? "is" : "are";
return {
level,
reason: `There ${verb} ${BREAKING} and ${FEATURE}`
};
}
export { whatBump as default };
//# sourceMappingURL=whatBump.js.map
//# sourceMappingURL=whatBump.js.map