diff --git a/README.md b/README.md index de2d12b495..cb7336725d 100644 --- a/README.md +++ b/README.md @@ -112,6 +112,13 @@ yarn husky install npx husky add .husky/commit-msg 'npx --no -- commitlint --edit ${1}' ``` +**Or use installed package instead** +``` +npm pkg set scripts.commitlint="commitlint --edit" +npx husky add .husky/commit-msg 'npm run commitlint ${1}' +``` + + Check the [husky documentation](https://typicode.github.io/husky/#/?id=manual) on how you can automatically have Git hooks enabled after install for different `yarn` versions. **Detailed Setup instructions** diff --git a/docs/guides-local-setup.md b/docs/guides-local-setup.md index 5c94c6d8d7..2814c2b15e 100644 --- a/docs/guides-local-setup.md +++ b/docs/guides-local-setup.md @@ -43,6 +43,12 @@ yarn husky install npx husky add .husky/commit-msg 'npx --no -- commitlint --edit ${1}' ``` +**Or use installed package instead** +``` +npm pkg set scripts.commitlint="commitlint --edit" +npx husky add .husky/commit-msg 'npm run commitlint ${1}' +``` + **Please note that currently @commitlint/cli doesn't support yarn v2 Plug'n'Play (using yarn v2 with `nodeLinker: node-modules` in your .yarnrc.yml file may work sometimes)**\ Check the [husky documentation](https://typicode.github.io/husky/#/?id=manual) on how you can automatically have Git hooks enabled after install for different `yarn` versions.