Skip to content

Commit df627a6

Browse files
committed
docs: Improve instructions on README
1 parent f0f72cc commit df627a6

File tree

1 file changed

+59
-7
lines changed

1 file changed

+59
-7
lines changed

README.md

+59-7
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,73 @@
11
# @rocketseat/commitlint-config
22

3+
<p>
4+
<img src="https://img.shields.io/npm/v/@rocketseat/commitlint-config?style=flat-square&color=8257E5&labelColor=121214" alt="npm version" />
5+
<img alt="License" src="https://img.shields.io/github/license/rocketseat/commitlint-config?style=flat-square&color=8257E5&labelColor=121214">
6+
</p>
7+
38
Shareable [`commitlint`](https://github.com/conventional-changelog/commitlint) config used by Rocketseat.
49

5-
## Getting started
10+
## Install
611

7-
Installing:
12+
You can install it with npm or Yarn.
813

914
```sh
1015
# npm
11-
npm i -D @rocketseat/commitlint-config
16+
npm i -D @rocketseat/commitlint-config @commitlint/cli
17+
18+
# Yarn
19+
yarn add -D @rocketseat/commitlint-config @commitlint/cli
20+
```
21+
22+
## Usage
23+
24+
After installing it, apply the config to `commitlint` by running the following command:
1225

13-
# yarn
14-
yarn add -D @rocketseat/commitlint-config
26+
```sh
27+
echo "module.exports = { extends: ['@rocketseat/commitlint-config'] };" > .commitlintrc.js
1528
```
1629

17-
Apply the config to `commitlint`:
30+
## Bonus
31+
32+
To lint commits before they are created, install Husky and use the 'commit-msg' hook.
1833

1934
```sh
20-
echo "module.exports = {extends: ['@rocketseat/commitlint-config']};" > commitlint.config.js
35+
# Npm
36+
npm i -D husky
37+
38+
# Yarn
39+
yarn add -D husky
40+
```
41+
42+
After that, you can create a `.huskyrc` file or add to your `package.json` the following code for
43+
44+
Husky v4:
45+
46+
```json
47+
{
48+
"husky": {
49+
"hooks": {
50+
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
51+
}
52+
}
53+
}
54+
```
55+
56+
Husky v5:
57+
2158
```
59+
# .husky/commit-msg
60+
# ...
61+
npx --no-install commitlint --edit $1
62+
# or
63+
yarn commitlint --edit $1
64+
```
65+
66+
## Version Support
67+
68+
- Node.js [LTS](https://github.com/nodejs/LTS#lts-schedule) `>= 10.21.0`
69+
- git `>= 2.13.2`
70+
71+
## License
72+
73+
MIT License © [Rocketseat](https://github.com/Rocketseat)

0 commit comments

Comments
 (0)