|
6 | 6 | * 🤖 Plays nice with `conventional-changelog`
|
7 | 7 | * 📦 Supports shareable configuration
|
8 | 8 |
|
9 |
| -## CLI |
10 |
| - |
11 |
| -* Primary way to interact with commitlint. |
12 |
| -* Install `@commitlint/cli` |
13 |
| -* Packages: [cli](./@commitlint/cli) |
| 9 | +## Getting started |
14 | 10 |
|
15 | 11 | ```
|
16 |
| -❯ npm install -g @commitlint/cli |
17 |
| -
|
18 |
| -❯ commitlint --help |
19 |
| - commitlint - Lint commit messages |
| 12 | +npm install --save-dev @commitlint/{angular,cli} |
| 13 | +echo '{"extends": ["@commitlint/config-angular"]}' > .commitlintrc |
| 14 | +``` |
20 | 15 |
|
21 |
| - [input] reads from stdin if --edit, --from and --to are omitted |
22 |
| - --color,-c toggle formatted output, defaults to: true |
23 |
| - --edit,-e read last commit message found in ./git/COMMIT_EDITMSG |
24 |
| - --extends,-x array of shareable configurations to extend |
25 |
| - --from,-f lower end of the commit range to lint; applies if edit=false |
26 |
| - --to,-t upper end of the commit range to lint; applies if edit=false |
27 |
| - --quiet,-q toggle console output |
| 16 | +## CLI |
28 | 17 |
|
29 |
| -``` |
| 18 | +* Primary way to interact with commitlint. |
| 19 | +* `npm install --save-dev @commitlint/cli` |
| 20 | +* Packages: [cli](./@commitlint/cli) |
30 | 21 |
|
31 | 22 | ## Config
|
32 | 23 |
|
33 | 24 | * Configuration is picked up from `.commitlint` files
|
34 | 25 | * Packages: [cli](./@commitlint/cli), [core](./@commitlint/core)
|
35 | 26 | * See [Rules](./docs/rules) for a complete list of possible rules
|
| 27 | +* An example configurations can be found at [@commitlint/config-angular](./@commitlint/config-angular/index.js) |
| 28 | + |
| 29 | +## Shared configurations |
| 30 | + |
| 31 | +A number of shared configurations are available to install and use with `commitlint`: |
| 32 | + |
| 33 | +* [@commitlint/config-angular](./@commitlint/config-angular) |
| 34 | +* [@commitlint/config-lerna-scopes](./@commitlint/config-lerna-scopes) |
| 35 | +* [@commitlint/config-patternplate](./@commitlint/config-patternplate) |
| 36 | +* [conventional-changelog-lint-config-atom](https://github.com/erikmueller/conventional-changelog-lint-config-atom) |
| 37 | +* [conventional-changelog-lint-config-canonical](https://github.com/gajus/conventional-changelog-lint-config-canonical) |
36 | 38 |
|
37 |
| -```js |
38 |
| -{ |
39 |
| - "extends": ["@commitlint/config-angular"], // pull in rules from packages |
40 |
| - "rules": { // overriding rules from extended packages |
41 |
| - "body-leading-blank": [0], // disable rule body-leading-blank, |
42 |
| - "footer-leading-blank": [1, "always"], // footer-leading-blank is a warning if not met |
43 |
| - "body-tense": [2, "always", ["present-imperative"]], // body-tense is an error if not met |
44 |
| - } |
45 |
| -} |
46 |
| -``` |
47 | 39 |
|
48 | 40 | ## API
|
49 | 41 |
|
50 | 42 | * Alternative, programatic way to interact with `commitlint`
|
51 |
| -* Install `@commitlint/core` |
| 43 | +* `npm install --save @commitlint/core` |
52 | 44 | * Packages: [core](./@commitlint/core)
|
53 |
| -* See [API](./docs/api) for a complete list of methods and parameters |
54 |
| - |
55 |
| -```js |
56 |
| -// example |
57 |
| -const {lint} = require('@commitlint/core'); |
58 |
| - |
59 |
| -// Pass in configuration manually |
60 |
| -lint('docs: add node api', { |
61 |
| - configuration: { |
62 |
| - rules: { |
63 |
| - 'scope-empty': [2, 'never'] |
64 |
| - } |
65 |
| - } |
66 |
| -}) |
67 |
| -.then(report => { |
68 |
| - console.log(JSON.stringify(report, null, ' ')); |
69 |
| -}); |
70 |
| -/* => { |
71 |
| - "valid": false, |
72 |
| - "errors": [ |
73 |
| - { |
74 |
| - "level": 2, |
75 |
| - "valid": false, |
76 |
| - "name": "scope-empty", |
77 |
| - "message": "scope may not be empty" |
78 |
| - } |
79 |
| - ], |
80 |
| - "warnings": [] |
81 |
| -} */ |
82 |
| -``` |
| 45 | +* See [API](./docs/api) for a complete list of methods and examples |
83 | 46 |
|
84 | 47 | ## Tools
|
85 | 48 |
|
86 |
| -* [prompt](./@commitlint/prompt) |
| 49 | +* [prompt](./@commitlint/prompt) |
| 50 | + |
| 51 | +## Version Support |
| 52 | + |
| 53 | +* Node.js [LTS](https://github.com/nodejs/LTS#lts-schedule) version and higher: `>= 4` |
| 54 | +* git `>= 2` |
87 | 55 |
|
88 | 56 | ## Related projects
|
89 | 57 |
|
| 58 | +* [angular-precommit](https://git.io/vwTDd) – Pre commit with angular conventions |
| 59 | +* [conventional-changelog](https://git.io/v18sw) – Generate a changelog from conventional commit history |
| 60 | +* [conventional-commits-detector](https://git.io/vwTyk) – Detect what commit message convention your repository is using |
| 61 | +* [conventional-github-releaser](https://git.io/vwTyI) – Make a new GitHub release from git metadata |
| 62 | +* [commitizen](https://git.io/vwTym) – Simple commit conventions for internet citizens |
| 63 | + |
90 | 64 | ## License
|
91 | 65 | Copyright by @marionebl. All `commitlint` packages are released under the MIT license.
|
92 | 66 |
|
|
0 commit comments