From b36816cd74a81dd27137b8703243dd012659b553 Mon Sep 17 00:00:00 2001 From: Nukeap <53114367+Nukeap@users.noreply.github.com> Date: Thu, 6 Feb 2025 08:51:38 +0300 Subject: [PATCH] =?UTF-8?q?chore=20[P-137]:=20=D0=BA=D0=BE=D0=BC=D0=BC?= =?UTF-8?q?=D0=B8=D1=82=20=D0=BD=D0=BE=D0=B4=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .git-hooks/commit-msg | 3 ++- commit-v.js | 12 ++++++++++++ commitlint.config.js | 4 +++- 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 commit-v.js diff --git a/.git-hooks/commit-msg b/.git-hooks/commit-msg index e20c1cac7..e8b05862b 100644 --- a/.git-hooks/commit-msg +++ b/.git-hooks/commit-msg @@ -1,3 +1,4 @@ #!/usr/bin/env sh -npm run commitlint --edit ${1} \ No newline at end of file +npm run commitlint --edit ${1} +node ./commit-v.js "$1" \ No newline at end of file diff --git a/commit-v.js b/commit-v.js new file mode 100644 index 000000000..5cafc293c --- /dev/null +++ b/commit-v.js @@ -0,0 +1,12 @@ +import execSync from 'child_process'; + +const commitMessage = process.argv[2]; + +if (commitMessage) { + // Проверяем, содержит ли сообщение коммита определенные ключевые слова + const isPatch = /^(fix|chore)/.test(commitMessage); // Например, если тип "fix" или "chore" + + if (isPatch) { + execSync('npm version patch', { stdio: 'inherit' }); + } +} diff --git a/commitlint.config.js b/commitlint.config.js index 20840c71e..362b26445 100644 --- a/commitlint.config.js +++ b/commitlint.config.js @@ -23,7 +23,9 @@ export default { 'refactor' - Изменения кода, не исправляющие ошибки и не добавляющие функционал 'perf' - Изменения, улучшающие производительность 'test' - Добавление тестов - 'chore' - Изменения в процессе сборки или вспомогательных инструментах`, + 'chore' - Изменения в процессе сборки или вспомогательных инструментах. + + Например: feat [X-01]: я тут накоммитил`, ]; } return [true];