commit-analyzer
commit-analyzer copied to clipboard
using custom commit types
is there a way to use custom commit types?
Ex:
dep-add(npm): :heavy_plus_sign: add cz-emoji npm package
config(semantic-release): :wrench: add @semantic-release/analyze-commits plugin
dep-add(npm): :heavy_plus_sign: add cz-emoji npm package config(semantic-release): :wrench: add @semantic-release/analyze-commits plugin
other commit types cz-emoji
Using the commit from example and semantic-release config, only commit type config
result in patch release. dep-add
commit type doesn't result in patch release.
Ex:
dep-add(npm): :heavy_plus_sign: add cz-emoji npm package
config(semantic-release): :wrench: add @semantic-release/analyze-commits plugin
dep-add(npm): β add cz-emoji npm package config(semantic-release): π§ add @semantic-release/analyze-commits plugin
.releaserc.js
const commitTypes = require("./semantic-release/commitTypes.js");
const commitRules = require("./semantic-release/commitRules.js");
module.exports = {
tagFormat: "${version}",
branches: ["master"],
plugins: [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
],
preset: "conventionalcommits",
analyzeCommits: {
releaseRules: commitRules,
},
presetConfig: {
types: commitTypes,
},
};
semantic-release/commitRules.js
/* eslint-disable indent */
const MAJOR = "major";
const MINOR = "minor";
const PATCH = "patch";
module.exports = [
{ breaking: true, release: MAJOR },
{ revert: true, release: PATCH },
{
// emoji: 'π¨',
type: "style",
// code: ':art:',
// description: 'Improving structure / format of the code.',
release: PATCH,
},
{
// emoji: 'β‘οΈ',
type: "perf",
// code: ':zap:',
// description: 'Improving performance.',
release: PATCH,
},
{
// emoji: 'π₯',
type: "prune",
// code: ':fire:',
// description: 'Removing code or files.',
release: PATCH,
},
{
// emoji: 'π',
type: "fix",
// code: ':bug:',
// description: 'Fixing a bug.',
release: PATCH,
},
{
// emoji: 'π',
type: "quickfix",
// code: ':ambulance:',
// description: 'Critical hotfix.',
release: MINOR,
},
{
// emoji: 'β¨',
type: "feature",
// code: ':sparkles:',
// description: 'Introducing new features.',
release: MINOR,
},
{
// emoji: 'π',
type: "docs",
// code: ':pencil:',
// description: 'Writing docs.',
release: false,
},
{
// emoji: 'π',
type: "deploy",
// code: ':rocket:',
// description: 'Deploying stuff.',
release: PATCH,
},
{
// emoji: 'π',
type: "ui",
// code: ':lipstick:',
// description: 'Updating the UI and style files.',
release: PATCH,
},
{
// emoji: 'π',
type: "init",
// code: ':tada:',
// description: 'Initial commit.',
release: PATCH,
},
{
// emoji: 'β
',
type: "test",
// code: ':white_check_mark:',
// description: 'Adding tests.',
release: false,
},
{
// emoji: 'π',
type: "security",
// code: ':lock:',
// description: 'Fixing security issues.',
release: MINOR,
},
{
// emoji: 'π',
type: "osx",
// code: ':apple:',
// description: 'Fixing something on macOS.',
release: PATCH,
},
{
// emoji: 'π§',
type: "linux",
// code: ':penguin:',
// description: 'Fixing something on Linux.',
release: PATCH,
},
{
// emoji: 'π',
type: "windows",
// code: ':checkered_flag:',
// description: 'Fixing something on Windows.',
release: PATCH,
},
{
// emoji: 'π€',
type: "android",
// code: ':robot:',
// description: 'Fixing something on Android.',
release: PATCH,
},
{
// emoji: 'π',
type: "ios",
// code: ':green_apple:',
// description: 'Fixing something on iOS.',
release: PATCH,
},
{
// emoji: 'π',
type: "release",
// code: ':bookmark:',
// description: 'Releasing / Version tags.',
release: PATCH,
},
{
// emoji: 'π¨',
type: "lint",
// code: ':rotating_light:',
// description: 'Removing linter warnings.',
release: PATCH,
},
{
// emoji: 'π§',
type: "wip",
// code: ':construction:',
// description: 'Work in progress.',
release: false, // don't create a release
},
{
// emoji: 'π',
type: "fix-ci",
// code: ':green_heart:',
// description: 'Fixing CI Build.',
release: PATCH,
},
{
// emoji: 'β¬οΈ',
type: "downgrade",
// code: ':arrow_down:',
// description: ' Downgrading dependencies.',
release: PATCH,
},
{
// emoji: 'β¬οΈ',
type: "upgrade",
// code: ':arrow_up:',
// description: ' Upgrading dependencies.',
release: PATCH,
},
{
// emoji: 'π',
type: "pushpin",
// code: ':pushpin:',
// description: 'Pinning dependencies to specific versions.',
release: false,
},
{
// emoji: 'π·',
type: "ci",
// code: ':construction_worker:',
// description: 'Adding CI build system.',
release: PATCH,
},
{
// emoji: 'π',
type: "analytics",
// code: ':chart_with_upwards_trend:',
// description: 'Adding analytics or tracking code.',
release: PATCH,
},
{
// emoji: 'β»οΈ',
type: "refactoring",
// code: ':recycle:',
// description: ' Refactoring code.',
release: MINOR,
},
{
// emoji: 'π³',
type: "docker",
// code: ':whale:',
// description: 'Work about Docker.',
release: PATCH,
},
{
// emoji: 'β',
type: "dep-add",
// code: ':heavy_plus_sign:',
// description: 'Adding a dependency.',
release: PATCH,
},
{
// emoji: 'β',
type: "dep-rm",
// code: ':heavy_minus_sign:',
// description: 'Removing a dependency.',
release: PATCH,
},
{
// emoji: 'π§',
type: "config",
// code: ':wrench:',
// description: 'Changing configuration files.',
release: PATCH,
},
{
// emoji: 'π',
type: "i18n",
// code: ':globe_with_meridians:',
// description: 'Internationalization and localization.',
release: PATCH,
},
{
// emoji: 'βοΈ',
type: "typo",
// code: ':pencil2:',
// description: ' Fixing typos.',
release: PATCH,
},
{
// emoji: 'π©',
type: "poo",
// code: ':poop:',
// description: 'Writing bad code that needs to be improved.',
release: PATCH,
},
{
// emoji: 'βͺ',
type: "revert",
// code: ':rewind:',
// description: 'Reverting changes.',
release: PATCH,
},
{
// emoji: 'π',
type: "merge",
// code: ':twisted_rightwards_arrows:',
// description: 'Merging branches.',
release: PATCH,
},
{
// emoji: 'π¦',
type: "dep-up",
// code: ':package:',
// description: 'Updating compiled files or packages.',
release: PATCH,
},
{
// emoji: 'π½',
type: "compat",
// code: ':alien:',
// description: 'Updating code due to external API changes.',
release: PATCH,
},
{
// emoji: 'π',
type: "mv",
// code: ':truck:',
// description: 'Moving or renaming files.',
release: PATCH,
},
{
// emoji: 'π',
type: "license",
// code: ':page_facing_up:',
// description: 'Adding or updating license.',
release: false,
},
{
// emoji: 'π₯',
type: "breaking",
// code: ':boom:',
// description: 'Introducing breaking changes.',
release: MAJOR,
},
{
// emoji: 'π±',
type: "assets",
// code: ':bento:',
// description: 'Adding or updating assets.',
release: PATCH,
},
{
// emoji: 'π',
type: "review",
// code: ':ok_hand:',
// description: 'Updating code due to code review changes.',
release: PATCH,
},
{
// emoji: 'βΏοΈ',
type: "access",
// code: ':wheelchair:',
// description: 'Improving accessibility.',
release: PATCH,
},
{
// emoji: 'π‘',
type: "docs-code",
// code: ':bulb:',
// description: 'Documenting source code.',
release: PATCH,
},
{
// emoji: 'π»',
type: "beer",
// code: ':beers:',
// description: 'Writing code drunkenly.',
release: PATCH,
},
{
// emoji: 'π¬',
type: "texts",
// code: ':speech_balloon:',
// description: 'Updating text and literals.',
release: PATCH,
},
{
// emoji: 'π',
type: "db",
// code: ':card_file_box:',
// description: ' Performing database related changes.',
release: PATCH,
},
{
// emoji: 'π',
type: "log-add",
// code: ':loud_sound:',
// description: 'Adding logs.',
release: false,
},
{
// emoji: 'π',
type: "log-rm",
// code: ':mute:',
// description: 'Removing logs.',
release: false,
},
{
// emoji: 'π₯',
type: "contrib-add",
// code: ':busts_in_silhouette:',
// description: 'Adding contributor(s).',
release: false,
},
{
// emoji: 'πΈ',
type: "ux",
// code: ':children_crossing:',
// description: 'Improving user experience / usability.',
release: PATCH,
},
{
// emoji: 'π',
type: "arch",
// code: ':building_construction:',
// description: ' Making architectural changes.',
release: PATCH,
},
{
// emoji: 'π±',
type: "iphone",
// code: ':iphone:',
// description: 'Working on responsive design.',
release: PATCH,
},
{
// emoji: 'π€‘',
type: "clown-face",
// code: ':clown_face:',
// description: 'Mocking things.',
release: false,
},
{
// emoji: 'π₯',
type: "egg",
// code: ':egg:',
// description: 'Adding an easter egg.',
release: PATCH,
},
{
// emoji: 'π',
type: "see-no-evil",
// code: ':see_no_evil:',
// description: 'Adding or updating a .gitignore file',
release: false,
},
{
// emoji: 'πΈ',
type: "camera-flash",
// code: ':camera_flash:',
// description: 'Adding or updating snapshots',
release: false,
},
{
// emoji: 'β',
type: "experiment",
// code: ':alembic:',
// description: ' Experimenting new things',
release: false,
},
{
// emoji: 'π',
type: "seo",
// code: ':mag:',
// description: 'Improving SEO',
release: PATCH,
},
{
// emoji: 'βΈοΈ',
type: "k8s",
// code: ':wheel_of_dharma:',
// description: ' Work about Kubernetes',
release: PATCH,
},
{
// emoji: 'π·οΈ',
type: "types",
// code: ':label:',
// description: ' Adding or updating types (Flow, TypeScript)',
release: PATCH,
},
{
// emoji: 'π±',
type: "seed",
// code: ':seedling:',
// description: 'Adding or updating seed files',
release: PATCH,
},
{
// emoji: 'π©',
type: "flags",
// code: ':triangular_flag_on_post:',
// description: 'Adding, updating, or removing feature flags',
release: PATCH,
},
{
// emoji: 'π«',
type: "animation",
// code: ':dizzy:',
// description: 'Adding or updating animations and transitions',
release: PATCH,
},
];
semantic-release/commitTypes.js
/* eslint-disable indent */
module.exports = [
{
// emoji: 'π¨',
// code: ':art:',
section: "Improving structure / format of the code.",
type: "style",
},
{
// emoji: 'β‘οΈ',
// code: ':zap:',
section: "Improving performance.",
type: "perf",
},
{
// emoji: 'π₯',
// code: ':fire:',
section: "Removing code or files.",
type: "prune",
},
{
// emoji: 'π',
// code: ':bug:',
section: "Fixing a bug.",
type: "fix",
},
{
// emoji: 'π',
// code: ':ambulance:',
section: "Critical hotfix.",
type: "quickfix",
},
{
// emoji: 'β¨',
// code: ':sparkles:',
section: "Introducing new features.",
type: "feature",
},
{
// emoji: 'π',
// code: ':pencil:',
section: "Writing docs.",
type: "docs",
},
{
// emoji: 'π',
// code: ':rocket:',
section: "Deploying stuff.",
type: "deploy",
},
{
// emoji: 'π',
// code: ':lipstick:',
section: "Updating the UI and style files.",
type: "ui",
},
{
// emoji: 'π',
// code: ':tada:',
section: "Initial commit.",
type: "init",
},
{
// emoji: 'β
',
// code: ':white_check_mark:',
section: "Adding tests.",
type: "test",
},
{
// emoji: 'π',
// code: ':lock:',
section: "Fixing security issues.",
type: "security",
},
{
// emoji: 'π',
// code: ':apple:',
section: "Fixing something on macOS.",
type: "osx",
},
{
// emoji: 'π§',
// code: ':penguin:',
section: "Fixing something on Linux.",
type: "linux",
},
{
// emoji: 'π',
// code: ':checkered_flag:',
section: "Fixing something on Windows.",
type: "windows",
},
{
// emoji: 'π€',
// code: ':robot:',
section: "Fixing something on Android.",
type: "android",
},
{
// emoji: 'π',
// code: ':green_apple:',
section: "Fixing something on iOS.",
type: "ios",
},
{
// emoji: 'π',
// code: ':bookmark:',
section: "Releasing / Version tags.",
type: "release",
},
{
// emoji: 'π¨',
// code: ':rotating_light:',
section: "Removing linter warnings.",
type: "lint",
},
{
// emoji: 'π§',
// code: ':construction:',
section: "Work in progress.",
type: "wip",
},
{
// emoji: 'π',
// code: ':green_heart:',
section: "Fixing CI Build.",
type: "fix-ci",
},
{
// emoji: 'β¬οΈ',
// code: ':arrow_down:',
section: " Downgrading dependencies.",
type: "downgrade",
},
{
// emoji: 'β¬οΈ',
// code: ':arrow_up:',
section: " Upgrading dependencies.",
type: "upgrade",
},
{
// emoji: 'π',
// code: ':pushpin:',
section: "Pinning dependencies to specific versions.",
type: "pushpin",
},
{
// emoji: 'π·',
// code: ':construction_worker:',
section: "Adding CI build system.",
type: "ci",
},
{
// emoji: 'π',
// code: ':chart_with_upwards_trend:',
section: "Adding analytics or tracking code.",
type: "analytics",
},
{
// emoji: 'β»οΈ',
// code: ':recycle:',
section: " Refactoring code.",
type: "refactoring",
},
{
// emoji: 'π³',
// code: ':whale:',
section: "Work about Docker.",
type: "docker",
},
{
// emoji: 'β',
// code: ':heavy_plus_sign:',
section: "Adding a dependency.",
type: "dep-add",
},
{
// emoji: 'β',
// code: ':heavy_minus_sign:',
section: "Removing a dependency.",
type: "dep-rm",
},
{
// emoji: 'π§',
// code: ':wrench:',
section: "Changing configuration files.",
type: "config",
},
{
// emoji: 'π',
// code: ':globe_with_meridians:',
section: "Internationalization and localization.",
type: "i18n",
},
{
// emoji: 'βοΈ',
// code: ':pencil2:',
section: " Fixing typos.",
type: "typo",
},
{
// emoji: 'π©',
// code: ':poop:',
section: "Writing bad code that needs to be improved.",
type: "poo",
},
{
// emoji: 'βͺ',
// code: ':rewind:',
section: "Reverting changes.",
type: "revert",
},
{
// emoji: 'π',
// code: ':twisted_rightwards_arrows:',
section: "Merging branches.",
type: "merge",
},
{
// emoji: 'π¦',
// code: ':package:',
section: "Updating compiled files or packages.",
type: "dep-up",
},
{
// emoji: 'π½',
// code: ':alien:',
section: "Updating code due to external API changes.",
type: "compat",
},
{
// emoji: 'π',
// code: ':truck:',
section: "Moving or renaming files.",
type: "mv",
},
{
// emoji: 'π',
// code: ':page_facing_up:',
section: "Adding or updating license.",
type: "license",
},
{
// emoji: 'π₯',
// code: ':boom:',
section: "Introducing breaking changes.",
type: "breaking",
},
{
// emoji: 'π±',
// code: ':bento:',
section: "Adding or updating assets.",
type: "assets",
},
{
// emoji: 'π',
// code: ':ok_hand:',
section: "Updating code due to code review changes.",
type: "review",
},
{
// emoji: 'βΏοΈ',
// code: ':wheelchair:',
section: "Improving accessibility.",
type: "access",
},
{
// emoji: 'π‘',
// code: ':bulb:',
section: "Documenting source code.",
type: "docs-code",
},
{
// emoji: 'π»',
// code: ':beers:',
section: "Writing code drunkenly.",
type: "beer",
},
{
// emoji: 'π¬',
// code: ':speech_balloon:',
section: "Updating text and literals.",
type: "texts",
},
{
// emoji: 'π',
// code: ':card_file_box:',
section: " Performing database related changes.",
type: "db",
},
{
// emoji: 'π',
// code: ':loud_sound:',
section: "Adding logs.",
type: "log-add",
},
{
// emoji: 'π',
// code: ':mute:',
section: "Removing logs.",
type: "log-rm",
},
{
// emoji: 'π₯',
// code: ':busts_in_silhouette:',
section: "Adding contributor(s).",
type: "contrib-add",
},
{
// emoji: 'πΈ',
// code: ':children_crossing:',
section: "Improving user experience / usability.",
type: "ux",
},
{
// emoji: 'π',
// code: ':building_construction:',
section: " Making architectural changes.",
type: "arch",
},
{
// emoji: 'π±',
// code: ':iphone:',
section: "Working on responsive design.",
type: "iphone",
},
{
// emoji: 'π€‘',
// code: ':clown_face:',
section: "Mocking things.",
type: "clown-face",
},
{
// emoji: 'π₯',
// code: ':egg:',
section: "Adding an easter egg.",
type: "egg",
},
{
// emoji: 'π',
// code: ':see_no_evil:',
section: "Adding or updating a .gitignore file",
type: "see-no-evil",
},
{
// emoji: 'πΈ',
// code: ':camera_flash:',
section: "Adding or updating snapshots",
type: "camera-flash",
},
{
// emoji: 'β',
// code: ':alembic:',
section: " Experimenting new things",
type: "experiment",
},
{
// emoji: 'π',
// code: ':mag:',
section: "Improving SEO",
type: "seo",
},
{
// emoji: 'βΈοΈ',
// code: ':wheel_of_dharma:',
section: " Work about Kubernetes",
type: "k8s",
},
{
// emoji: 'π·οΈ',
// code: ':label:',
section: " Adding or updating types (Flow, TypeScript)",
type: "types",
},
{
// emoji: 'π±',
// code: ':seedling:',
section: "Adding or updating seed files",
type: "seed",
},
{
// emoji: 'π©',
// code: ':triangular_flag_on_post:',
section: "Adding, updating, or removing feature flags",
type: "flags",
},
{
// emoji: 'π«',
// code: ':dizzy:',
section: "Adding or updating animations and transitions",
type: "animation",
},
];
I am also looking for a custom type configuration, Is it working?
Looking for the same!
Since this is already 4 years old, and no response is given, I take it is currently not possible to achieve this?
We already have fixed commit-message rules in out gitlab projects using regular expressions (we must have a JIRA ticket number as prefix), so I would like to have "^[Ticket-Number] [Commit-Type].*$".
Since this is already 4 years old, and no response is given, I take it is currently not possible to achieve this?
We already have fixed commit-message rules in out gitlab projects using regular expressions (we must have a JIRA ticket number as prefix), so I would like to have "^[Ticket-Number] [Commit-Type].*$".
Similar to us:
const parserOpts = {
headerPattern: /^(?:\[([A-z]*-\d+)]\s)?(\w*)(?:\((.*)\))?!?:\s(.*)$/,
headerCorrespondence: ["ticket", "type", "scope", "subject"],
};