Skip to content

Commit 2954303

Browse files
authored
docs: add .czrc support to README (#739)
1 parent be08907 commit 2954303

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

README.md

+11-2
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,14 @@ The above command does three things for you.
8686
}
8787
```
8888

89+
Alternatively, commitizen configs may be added to a .czrc file:
90+
91+
```json
92+
{
93+
"path": "cz-conventional-changelog"
94+
}
95+
```
96+
8997
This just tells Commitizen which adapter we actually want our contributors to use when they try to commit to this repo.
9098

9199
`commitizen.path` is resolved via [require.resolve](https://nodejs.org/api/globals.html#globals_require_resolve) and supports
@@ -125,7 +133,7 @@ And you can then add some nice npm run scripts in your package.json pointing to
125133

126134
This will be more convenient for your users because then if they want to do a commit, all they need to do is run `npm run commit` and they will get the prompts needed to start a commit!
127135

128-
> **NOTE:** if you are using `precommit` hooks thanks to something like `husky`, you will need to name your script some thing other than "commit" (e.g. "cm": "git-cz"). The reason is because npm-scripts has a "feature" where it automatically runs scripts with the name *prexxx* where *xxx* is the name of another script. In essence, npm and husky will run "precommit" scripts twice if you name the script "commit," and the work around is to prevent the npm-triggered *precommit* script.
136+
> **NOTE:** if you are using `precommit` hooks thanks to something like `husky`, you will need to name your script some thing other than "commit" (e.g. "cm": "git-cz"). The reason is because npm-scripts has a "feature" where it automatically runs scripts with the name _prexxx_ where _xxx_ is the name of another script. In essence, npm and husky will run "precommit" scripts twice if you name the script "commit," and the work around is to prevent the npm-triggered _precommit_ script.
129137
130138
#### Optional: Running Commitizen on `git commit`
131139

@@ -146,6 +154,7 @@ exec < /dev/tty && node_modules/.bin/git-cz --hook || true
146154
```
147155

148156
##### Husky
157+
149158
For `husky` users, add the following configuration to the project's `package.json`:
150159

151160
```
@@ -341,4 +350,4 @@ Support this project by becoming a sponsor. Your logo will show up here with a l
341350
<a href="https://opencollective.com/commitizen/sponsor/8/website" target="_blank"><img src="https://opencollective.com/commitizen/sponsor/8/avatar.svg"></a>
342351
<a href="https://opencollective.com/commitizen/sponsor/9/website" target="_blank"><img src="https://opencollective.com/commitizen/sponsor/9/avatar.svg"></a>
343352

344-
[Commitizen-friendly]: #making-your-repo-commitizen-friendly
353+
[commitizen-friendly]: #making-your-repo-commitizen-friendly

0 commit comments

Comments
 (0)