File tree Expand file tree Collapse file tree 2 files changed +92
-4
lines changed Expand file tree Collapse file tree 2 files changed +92
-4
lines changed Original file line number Diff line number Diff line change @@ -147,10 +147,30 @@ Info about git hooks can be found on [Git documentation](https://git-scm.com/boo
147147
148148For a first simple usage test of commitlint you can do the following:
149149
150- ` ` ` bash
150+ ::: code-group
151+
152+ ` ` ` sh [npm]
151153npx commitlint --from HEAD~1 --to HEAD --verbose
152154` ` `
153155
156+ ` ` ` sh [yarn]
157+ yarn commitlint --from HEAD~1 --to HEAD --verbose
158+ ` ` `
159+
160+ ` ` ` sh [pnpm]
161+ pnpm dlx commitlint --from HEAD~1 --to HEAD --verbose
162+ ` ` `
163+
164+ ` ` ` sh [bun]
165+ bunx commitlint --from HEAD~1 --to HEAD --verbose
166+ ` ` `
167+
168+ ` ` ` sh [deno]
169+ deno task --eval commitlint --from HEAD~1 --to HEAD --verbose
170+ ` ` `
171+
172+ :::
173+
154174This will check your last commit and return an error if invalid or a positive output if valid.
155175
156176# ## Test the hook
Original file line number Diff line number Diff line change 1212
13132 . Create a package.json if needed
1414
15- ``` sh
15+ ::: code-group
16+
17+ ``` sh [npm]
1618 npm init
1719 ```
1820
21+ ``` sh [yarn]
22+ yarn init
23+ ```
24+
25+ ``` sh [pnpm]
26+ pnpm init
27+ ```
28+
29+ ``` sh [bun]
30+ bun init
31+ ```
32+
33+ :::
34+
19353 . Install and configure if needed
2036
21- ``` sh
37+ ::: code-group
38+
39+ ``` sh [npm]
2240 npm install --save-dev @commitlint/cli @commitlint/config-conventional @commitlint/prompt-cli
2341
2442 echo " export default { extends: ['@commitlint/config-conventional'] };" > commitlint.config.js
2543 ```
2644
45+ ``` sh [yarn]
46+ yarn add --dev @commitlint/cli @commitlint/config-conventional @commitlint/prompt-cli
47+
48+ echo " export default { extends: ['@commitlint/config-conventional'] };" > commitlint.config.js
49+ ```
50+
51+ ``` sh [pnpm]
52+ pnpm add --save-dev @commitlint/cli @commitlint/config-conventional @commitlint/prompt-cli
53+
54+ echo " export default { extends: ['@commitlint/config-conventional'] };" > commitlint.config.js
55+ ```
56+
57+ ``` sh [bun]
58+ bun add --dev @commitlint/cli @commitlint/config-conventional @commitlint/prompt-cli
59+
60+ echo " export default { extends: ['@commitlint/config-conventional'] };" > commitlint.config.js
61+ ```
62+
63+ ``` sh [deno]
64+ deno add --dev npm:@commitlint/cli npm:@commitlint/config-conventional npm:@commitlint/prompt-cli
65+
66+ echo " export default { extends: ['@commitlint/config-conventional'] };" > commitlint.config.js
67+ ```
68+
69+ :::
70+
2771## Provide a shortcut
2872
2973To make prompt-cli easy to use, add a npm run-script to your ` package.json `
@@ -38,11 +82,35 @@ To make prompt-cli easy to use, add a npm run-script to your `package.json`
3882
3983Test the prompt by executing
4084
41- ``` bash
85+ ::: code-group
86+
87+ ``` sh [npm]
4288git add .
4389npm run commit
4490```
4591
92+ ``` sh [yarn]
93+ git add .
94+ yarn commit
95+ ```
96+
97+ ``` sh [pnpm]
98+ git add .
99+ pnpm commit
100+ ```
101+
102+ ``` sh [bun]
103+ git add .
104+ bun commit
105+ ```
106+
107+ ``` sh [deno]
108+ git add .
109+ deno task commit
110+ ```
111+
112+ :::
113+
46114## An alternative to ` @commitlint/prompt-cli ` : commitizen
47115
48116Another way to author commit messages that adhere to the commit convention configured in ` commitlint.config.js ` is to use ` commitizen ` .
You can’t perform that action at this time.
0 commit comments