commitizen / commitizen/cz-cli

Update Documentation for pre-commit hooks with Husky 5

未關閉
#810 1 則留言 8 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
JavaScript
星號
17.5k
分支
566
平均合併
8 小時 16 分鐘
30 天內合併 PR
1

描述

Hi commitizeners :)

I love using commitizen on my projects, and with husky hooks for pre-commit is great.

BUT... There is a new version of Husky, (Husky 5) which breaks how hooks are set up. That means the commitizen documentation is now out of date (because it only describes from Husky 4).

## PROBLEM:

The commitizen documentation is out of date for Husky 5.

## Main Differences:

In Husky 4, you add a husky hook to package.json and install commitizen and husky. Husky automatically registers the hook.

Now... in Husky 5, the hooks are added to separate files (NOT package.json)

## SOLUTION:

Brief instructions follow, which I suggest to be added to the commitizen documentation.

#### Using Commitizen with Husky 5

Install husky:

npm install--save-dev husky

Then run this to add a pre commit message hook:

npx husky add .husky/prepare-commit-msg "exec < /dev/tty && git cz --hook || true"

Note, you will probably want to add the resulting hook file to git:

.husky/prepare-commit-msg

UPDATE: If your hooks don't run, you can tell Husky to install them:

npx husky install

Hope that is helpful!

貢獻指南

開啟貢獻指南

研究方向

找到現有的 commitizen 文件中介紹 Husky 4 的部分,並將其與此 issue 中關於 Husky 5 的說明進行比較,包括 .husky/prepare-commit-msg 和 package 設定。更新文件,以涵蓋新的 hook 檔案工作流程和安裝指令,然後驗證這些說明是否正確。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
git, javascript
領域
cli, documentation
Issue 類型
文件
難度
2/5
預估耗時
1-3 小時
活躍度
停滯
描述清晰度
基本清楚
新手友好度
38/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。