diff --git a/.git-hooks/commit-msg b/.git-hooks/commit-msg index e8b05862b..4153db065 100644 --- a/.git-hooks/commit-msg +++ b/.git-hooks/commit-msg @@ -1,4 +1,3 @@ #!/usr/bin/env sh 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 deleted file mode 100644 index 9cadcb2e4..000000000 --- a/commit-v.js +++ /dev/null @@ -1,14 +0,0 @@ -import { execSync } from 'child_process'; - -const commitMessage = process.argv[2]; -console.log(process.argv); -if (commitMessage) { - // Проверяем, содержит ли сообщение коммита определенные ключевые слова - const isPatch = /^(fix|chore)/.test(commitMessage); // Например, если тип "fix" или "chore" - - if (isPatch) { - console.log('Обновление версии патча...'); - - execSync('cd src/front && npm version patch', { stdio: 'inherit' }); - } -} diff --git a/commitlint.config.js b/commitlint.config.js index 362b26445..e7dde6a4d 100644 --- a/commitlint.config.js +++ b/commitlint.config.js @@ -1,3 +1,4 @@ +import { execSync } from 'child_process'; export default { rules: { 'header-max-length': [2, 'always', 72], // Максимальная длина заголовка @@ -27,6 +28,14 @@ export default { Например: feat [X-01]: я тут накоммитил`, ]; + } else { + const isPatch = /^(fix|chore)/.test(header); // Например, если тип "fix" или "chore" + + if (isPatch) { + console.log('Обновление версии патча...'); + + execSync('cd src/front && npm version patch', { stdio: 'inherit' }); + } } return [true]; },