conventional-changelog / commitlint

πŸ““ Lint commit messages
https://commitlint.js.org
MIT License
16.95k stars 913 forks source link

Document global install and commitizen #179

Closed blackxored closed 7 years ago

blackxored commented 7 years ago

With the new config-conventional I thought it was time to switch from my global cz-conventional-changelog to this. It would be nice if it would be documented how to do this globally.

Here's roughly what I did:

$ yarn global add @commitlint/prompt-cli @commitlint/config-conventional
$ echo "module.exports = {extends: ['@commitlint/config-conventional']};" > ~/.commitlintrc.js
$ echo '{ "path": "@commitlint/prompt" }' > ~/.czrc
$ git cz
marionebl commented 7 years ago

While global installation certainly is possible and something I want to support as a feature I do not endorse it and don't want to point more users to it.

The reasons for this are mainly:

KristinitaTest commented 6 years ago

@marionebl, it's strange. I haven't seen npm packages that cannot be installed globally.

1. Arguments for global

  1. Developer needs to install and configure commitlint and dependencies for each project. If developer have many projects, it may take a lot of time.
  2. Developer may be not JavaScript programmer and use commitlint for non-NPM projects. For non-NPM (e.g. Python, C++, Ruby) project extra files β€” node_modules, package.json, package-lock.json β€” can create additional difficulties for developer.

2. Counterarguments for your arguments

Users might be unable to report what version they are actually using (package.json vs. global) and what config is in effect.

  1. I think, that npx β€” nice solution:

Global config changes default behavior: From a user perspective ~/commitlint.config.js (you might have forgotten about) changes default behavior and creates misunderstandings

  1. As in another packages:

If local configuration file exists:

β€…β€…β€…β€…local accept, global file ignore.

else local file no exists, global exists:

β€…β€…β€…β€…global configuration accept.

Global installation makes all dependencies of the globally installed packages available

  1. It would be nice, if would be possible ignore global dependencies, if commitlint install per project.

Thanks.