-
Notifications
You must be signed in to change notification settings - Fork 943
Open
Labels
Description
Expected Behavior
Please add this
cz-commitlint -> lib -> services -> getRuleQuestionConfig.js : 30
enumList = enumRuleList
.sort((a, b) => enumNames.indexOf(a) - enumNames.indexOf(b))
.map((enumName) => {
const enumDescription = enumDescriptions[enumName]?.description;
const emoji = enumDescriptions[enumName]?.emoji ? enumDescriptions[enumName].emoji : '';
if (enumDescription) {
return {
name: `${emoji} ${enumName}:`.padEnd(longest + 8) + enumDescription,
value: enumName,
short: enumName,
emoji: emoji || null
};
}
else {
return enumName;
}
}
);
cz-commitlint -> lib -> SectionHeader.js
export function getEmojis() {
const headerRuleQuestionConfig = getRuleQuestionConfig("header");
if (!headerRuleQuestionConfig) {
return [];
}
const emojis = headerRuleQuestionConfig?.enumList?.map(item => {
if (typeof item === 'object') {
return { value: item.value, emoji: item.emoji || '' };
}
return { value: item, emoji: null };
})
return emojis || [];
}
export function combineCommitMessage(answers) {
const { type = "", scope = "", subject = "" } = answers;
const questions = getQuestions();
const emoji = questions
.find(item => item.type === 'list' && item.name === 'type')?.choices
?.find(choice => choice.value === type)?.emoji;
const prefix = `${emoji?.trim()} ${type}${scope ? `(${scope})` : ""}`;
if (subject) {
return ((prefix ? prefix + ": " : "") + subject).trim();
}
else {
return prefix.trim();
}
}
Config for gitmoji
import { UserConfig } from "@commitlint/types";
import gitmoji from 'commitlint-config-gitmoji'
/**
* @type {import('@commitlint/types').UserConfig}
*/
module.exports = {
extends: ['@commitlint/config-conventional'],
prompt: {
questions: {
type: {
description: "Select the type of change that you're committing",
enum: {
feat: {
description: "A new feature",
title: "Features",
emoji: "✨",
},
fix: {
description: "A bug fix",
title: "Bug Fixes",
emoji: "🐛",
},
docs: {
description: "Documentation only changes",
title: "Documentation",
emoji: "📚",
},
style: {
description:
"Changes that do not affect the meaning of the code (linters)",
title: "Styles",
emoji: "🎨",
},
refactor: {
description:
"A code change that neither fixes a bug nor adds a feature",
title: "Code Refactoring",
emoji: "📦",
},
perf: {
description: "A code change that improves performance",
title: "Performance Improvements",
emoji: "🚀",
},
test: {
description: "Adding missing tests or correcting existing tests",
title: "Tests",
emoji: "🚨",
},
build: {
description:
"Changes that affect the build system or external dependencies (yarn)",
title: "Builds",
emoji: "🏗️ ",
},
ci: {
description:
"Changes to our CI configuration files and scripts (GitActions)",
title: "Continuous Integrations",
emoji: "⚙️ ",
},
chore: {
description: "Other changes that don't modify src or test files",
title: "Chores",
emoji: "♻️ ",
},
revert: {
description: "Reverts a previous commit",
title: "Reverts",
emoji: "⏪",
},
},
},
},
},
parserPreset: {
parserOpts: gitmoji.parserPreset.parserOpts,
plugins: [gitmoji.parserPreset.plugins],
},
...gitmoji.rules,
...gitmoji.plugins
} as UserConfig
.czrc
{
"path": "@commitlint/cz-commitlint",
"useGitmojis": true
}
Current Behavior
This is the way that is working 100%
Affected packages
- cli
- core
- prompt
- config-angular
Possible Solution
Described
Context
The emojis are working 100% fine