diff --git a/README.md b/README.md index 05fddd9..59eac33 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,73 @@ # @rocketseat/commitlint-config +

+ npm version + License +

+ Shareable [`commitlint`](https://github.com/conventional-changelog/commitlint) config used by Rocketseat. -## Getting started +## Install -Installing: +You can install it with npm or Yarn. ```sh # npm -npm i -D @rocketseat/commitlint-config +npm i -D @rocketseat/commitlint-config @commitlint/cli + +# Yarn +yarn add -D @rocketseat/commitlint-config @commitlint/cli +``` + +## Usage + +After installing it, apply the config to `commitlint` by running the following command: -# yarn -yarn add -D @rocketseat/commitlint-config +```sh +echo "module.exports = { extends: ['@rocketseat/commitlint-config'] };" > .commitlintrc.js ``` -Apply the config to `commitlint`: +## Bonus + +To lint commits before they are created, install Husky and use the 'commit-msg' hook. ```sh -echo "module.exports = {extends: ['@rocketseat/commitlint-config']};" > commitlint.config.js +# Npm +npm i -D husky + +# Yarn +yarn add -D husky +``` + +After that, you can create a `.huskyrc` file or add to your `package.json` the following code for + +Husky v4: + +```json +{ + "husky": { + "hooks": { + "commit-msg": "commitlint -E HUSKY_GIT_PARAMS" + } + } +} +``` + +Husky v5: + ``` +# .husky/commit-msg +# ... +npx --no-install commitlint --edit $1 +# or +yarn commitlint --edit $1 +``` + +## Version Support + +- Node.js [LTS](https://github.com/nodejs/LTS#lts-schedule) `>= 10.21.0` +- git `>= 2.13.2` + +## License + +MIT License © [Rocketseat](https://github.com/Rocketseat) \ No newline at end of file diff --git a/package.json b/package.json index 8426994..b5d666d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@rocketseat/commitlint-config", - "version": "0.0.1", + "version": "0.0.2", "description": "Shareable commitlint config used by Rocketseat", "main": "index.js", "license": "MIT",