-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Use commitlint and/or commitzen | ||
|
||
## Install dependencies | ||
|
||
```bash | ||
yarn add -D @commitlint/cli @commitlint/config-conventional | ||
# If using commitzen | ||
yarn add -D commitizen cz-conventional-changelog | ||
``` | ||
|
||
## Configure | ||
|
||
Setup `commitlint.config.js`. Conventional configuration: | ||
|
||
```bash | ||
echo "module.exports = {extends: ['@commitlint/config-conventional']};" > commitlint.config.js | ||
``` | ||
|
||
If you are using commitzen, make sure to add this in `package.json`: | ||
|
||
```json | ||
"config": { | ||
"commitizen": { | ||
"path": "./node_modules/cz-conventional-changelog" | ||
} | ||
} | ||
``` | ||
|
||
## Test it | ||
|
||
```bash | ||
# You can type it without message, if you are using commitzen | ||
git commit | ||
|
||
# Or provide a commit message is using only commitlint | ||
git commit -am 'fix: typo' | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = {extends: ['@commitlint/config-conventional']}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Use this to build commit messages | ||
prepare-commit-msg: | ||
commands: | ||
commitzen: | ||
interactive: true | ||
run: LEFTHOOK=0 yarn run cz | ||
|
||
# Use this to validate commit messages | ||
commit-msg: | ||
commands: | ||
"lint commit message": | ||
run: yarn run commitlint --edit {1} |