Skip to content

Commit e37d3ea

Browse files
authored
Make cz-commitlint searchable and easy to get start (#2572)
* refactor(cz-commitlint): set "keywords" and "bugs" in package.json * docs(cz-commitlint): make the introduction more readable * docs(cz-commitlint): add "reference prompt" entry to sidebar
1 parent 81c38dd commit e37d3ea

File tree

4 files changed

+23
-39
lines changed

4 files changed

+23
-39
lines changed

Diff for: @commitlint/cz-commitlint/README.md

+12-39
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,17 @@ The interactive process is inspired by [cz-conventional-changelog](https://githu
1010

1111
## Getting started
1212

13-
### Using commitizen adapter
13+
### Configure commitizen adapter
1414

1515
```bash
1616
npm install --save-dev @commitlint/cz-commitlint commitizen
17+
# or yarn
18+
yarn add -D @commitlint/cz-commitlint commitizen
1719
```
1820

1921
In package.json
2022

21-
```
23+
```json
2224
{
2325
"scripts": {
2426
"commit": "git-cz"
@@ -33,56 +35,27 @@ In package.json
3335

3436
### Configure commitlint
3537

38+
**⚠️ Important: The required version of commitlint and shared configuration is above 12.1.2, update them if already existed in project**
39+
3640
```bash
3741
# Install commitlint cli and conventional config
3842
npm install --save-dev @commitlint/config-conventional @commitlint/cli
43+
# or yarn
44+
yarn add @commitlint/config-conventional @commitlint/cli -D
3945

4046
# Simple: config with conventional
4147
echo "module.exports = {extends: ['@commitlint/config-conventional']};" > commitlint.config.js
42-
43-
# commitlint configuration is shareable,
44-
# Install lerna-scopes
45-
npm install --save-dev @commitlint/config-lerna-scopes
46-
# Scalable: config with lerna-scopes in monorepo mode
47-
echo "module.exports = {extends: ['@commitlint/config-conventional', '@commitlint/config-lerna-scopes']};" > commitlint.config.js
48-
```
49-
50-
### Set Git Hooks by husky
51-
52-
```base
53-
54-
# ------- using npm ----------
55-
# Install Husky
56-
npm install husky --save-dev
57-
# Active hooks
58-
npx husky install
59-
# Add commitlint hook
60-
npx husky add .husky/commit-msg 'npx --no-install commitlint --edit $1'
61-
# Add commitizen hook
62-
npx husky add .husky/prepare-commit-msg 'exec < /dev/tty && node_modules/.bin/cz --hook || true'
63-
64-
65-
# ------- using yarn ----------
66-
# Install Husky
67-
yarn add husky --dev
68-
# Active hooks
69-
yarn husky install
70-
# Add commitlint hook
71-
yarn husky add .husky/commit-msg 'yarn --no-install commitlint --edit $1'
72-
# Add commitizen hook
73-
yarn husky add .husky/prepare-commit-msg 'exec < /dev/tty && node_modules/.bin/cz --hook || true'
74-
7548
```
7649

7750
### Try it out
7851

7952
```bash
8053
git add .
81-
npm run commit
82-
# or
83-
yarn run commit
54+
npm run cz
55+
# or yarn
56+
yarn cz
8457
```
8558

8659
## Related
8760

88-
- [Commitlint Shared Configuration](https://github.com/conventional-changelog/commitlint#shared-configuration) - You can find more shared configurations are available to install and use with commitlint
61+
- [Commitlint Reference Prompt](https://commitlint.js.org/#/reference-prompt) - How to customize prompt information by setting commitlint.config.js

Diff for: @commitlint/cz-commitlint/package.json

+10
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,20 @@
66
"files": [
77
"lib"
88
],
9+
"keywords": [
10+
"conventional-changelog",
11+
"commitlint",
12+
"cz",
13+
"commitizen",
14+
"cz-commitlint"
15+
],
916
"scripts": {
1017
"commit": "git-cz"
1118
},
1219
"homepage": "https://github.com/conventional-changelog/commitlint#readme",
20+
"bugs": {
21+
"url": "https://github.com/conventional-changelog/commitlint/issues"
22+
},
1323
"repository": {
1424
"type": "git",
1525
"url": "https://github.com/conventional-changelog/commitlint.git"

Diff for: docs/_sidebar.md

+1
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@
1616
- [Rules](reference-rules.md)
1717
- [API](reference-api.md)
1818
- [Plugins](reference-plugins.md)
19+
- [Prompt](reference-prompt.md)
1920
- [Examples](reference-examples.md)
2021
- [Community projects](reference-community-projects.md)

Diff for: docs/assets/cz-commitlint.png

48.6 KB
Loading

0 commit comments

Comments
 (0)