From 1f1a1424949ba58ef87cf9fb8d67eb960a3d0c7f Mon Sep 17 00:00:00 2001 From: Vansh Chaurasiya Date: Sun, 12 Oct 2025 16:59:10 +0530 Subject: [PATCH] =?UTF-8?q?ci:=20=F0=9F=8E=A1=20Add=20git=20cz=20and=20com?= =?UTF-8?q?mitizen=20library=20for=20consistent=20commits?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Using commitizen & git-cz, commits in this repository will be consistent BREAKING CHANGE: ๐Ÿงจ No โœ… Closes: #890 --- .husky/prepare-commit-msg | 2 ++ changelog.config.mjs | 72 +++++++++++++++++++++++++++++++++++++++ package.json | 7 ++++ 3 files changed, 81 insertions(+) create mode 100644 .husky/prepare-commit-msg create mode 100644 changelog.config.mjs diff --git a/.husky/prepare-commit-msg b/.husky/prepare-commit-msg new file mode 100644 index 00000000..d6f385b0 --- /dev/null +++ b/.husky/prepare-commit-msg @@ -0,0 +1,2 @@ +#!/bin/bash +exec < /dev/tty && node_modules/.bin/cz --hook || true diff --git a/changelog.config.mjs b/changelog.config.mjs new file mode 100644 index 00000000..c2d75ba2 --- /dev/null +++ b/changelog.config.mjs @@ -0,0 +1,72 @@ +const config = { + disableEmoji: false, + format: '{type}{scope}: {emoji}{subject}', + list: ['test', 'feat', 'fix', 'chore', 'docs', 'refactor', 'style', 'ci', 'perf'], + maxMessageLength: 64, + minMessageLength: 3, + questions: ['type', 'scope', 'subject', 'body', 'breaking', 'issues', 'lerna'], + scopes: [], + types: { + chore: { + description: 'Build process or auxiliary tool changes', + emoji: '๐Ÿค–', + value: 'chore' + }, + ci: { + description: 'CI related changes', + emoji: '๐ŸŽก', + value: 'ci' + }, + docs: { + description: 'Documentation only changes', + emoji: 'โœ๏ธ', + value: 'docs' + }, + feat: { + description: 'A new feature', + emoji: '๐ŸŽธ', + value: 'feat' + }, + fix: { + description: 'A bug fix', + emoji: '๐Ÿ›', + value: 'fix' + }, + perf: { + description: 'A code change that improves performance', + emoji: 'โšก๏ธ', + value: 'perf' + }, + refactor: { + description: 'A code change that neither fixes a bug or adds a feature', + emoji: '๐Ÿ’ก', + value: 'refactor' + }, + release: { + description: 'Create a release commit', + emoji: '๐Ÿน', + value: 'release' + }, + style: { + description: 'Markup, white-space, formatting, missing semi-colons...', + emoji: '๐Ÿ’„', + value: 'style' + }, + test: { + description: 'Adding missing tests', + emoji: '๐Ÿ’', + value: 'test' + }, + messages: { + type: 'Select the type of change that you\'re committing:', + customScope: 'Select the scope this component affects:', + subject: 'Write a short, imperative mood description of the change:\n', + body: 'Provide a longer description of the change:\n ', + breaking: 'List any breaking changes:\n', + footer: 'Issues this commit closes, e.g #123:', + confirmCommit: 'The packages that this commit has affected\n', + }, + } +}; + +export default config; \ No newline at end of file diff --git a/package.json b/package.json index c60e4771..e8599e94 100644 --- a/package.json +++ b/package.json @@ -79,10 +79,12 @@ "@typescript-eslint/eslint-plugin": "^8.45.0", "@typescript-eslint/parser": "^8.45.0", "autoprefixer": "^10.4.21", + "commitizen": "^4.3.1", "eslint": "^8.57.1", "eslint-config-prettier": "^10.1.8", "eslint-plugin-prettier": "^5.5.4", "eslint-plugin-react": "^7.37.5", + "git-cz": "^4.9.0", "husky": "^9.1.7", "lint-staged": "^16.2.3", "postcss": "^8.5.3", @@ -104,5 +106,10 @@ }, "engines": { "node": ">=18.0" + }, + "config": { + "commitizen": { + "path": "git-cz" + } } }