This is our company commitizen configuration. We uses cz-bespoke to generate a commitizen adapter.
It is recommended to configure commitizen globally on your computer so you can take advantage in every git repository.
To install the packages and configure commitizen, run the following:
# Install commitizen globally
npm i -g commitizen
# Install commitizen adapter globally
npm i -g @concierge-auctions/commitizen-config
echo "{ \"path\": \"@concierge-auctions/commitizen-config\" }" > ~/.czrc
Now you can commit with git cz
instead of git commit
!
Because the adapter is in a scoped npm package, an .npmrc
is likely to be required in the directory you install from. An .npmrc
file has been checked in, but this is worth noting.
Another source of problems is a turf war between npm and yarn. I would recommend installing both dependencies using one of the, and uninstalling both dependencies from the other (if applicable).
To add commitizen to a repo, do the following:
- Install commitizen globally. (This isn't necessary, but makes using the cli tool easier.)
$ yarn global add commitizen
- Initialize our commitizen adapter in the repo. (This may take a few moments)
$ commitizen init @concierge-auctions/commitizen-config --save-dev
- Add commitizen to devDependencies
$ yarn add --dev commitizen
- Add the following script to
package.json
. This will be used instead ofgit commit
.
"commit": "git-cz",