Skip to content

Instantly share code, notes, and snippets.

@Narixius

Narixius/Introduction.md

Last active Jul 29, 2021
Embed
What would you like to do?
Introduction to commitizen

Resource for https://www.youtube.com/watch?v=JlfCRlFHmd8

ref: https://github.com/DevInsideYou/learning-resources/blob/master/Conventional.md

ref: https://www.conventionalcommits.org/en/v1.0.0/

commitizen

Linux

sudo npm install -g commitizen
sudo npm install -g cz-conventional-changelog

Feel free to use a target local to your project.

echo '{ "path": "cz-conventional-changelog" }' > ~/.czrc

Windows

npm install -g commitizen
npm install -g cz-conventional-changelog

cz-emoji (optional)

Note: this requires changes to commitlint.

sudo npm install -g cz-emoji

Replaces cz-conventional-changelog.

echo '{ "path": "cz-emoji" }' > ~/.czrc

Optionally use unicode instead of gitmoji by editing the ~/.czrc:

{
  "path": "cz-emoji",
  "config": {
    "cz-emoji": {
      "symbol": true
    }
  }
}

Vscode Extension

It can be used to push from vscode to git server

https://marketplace.visualstudio.com/items?itemName=KnisterPeter.vscode-commitizen

conventional-changelog-cli

It will be used to generate changelog that contains a full information about new features, breaking changes, refactors, bug fixes and etc... . It's good for versioin releasing.

npm install -g conventional-changelog-cli
cd my-project
conventional-changelog -p angular -i CHANGELOG.md -s

Automatically lint your commit messages

cd /path/to/my/repo

echo 'echo "$(cat $1)" | commitlint' > .git/hooks/commit-msg
chmod +x .git/hooks/commit-msg

standard-version

sudo npm install -g standard-version

Version bumps for Scala SBT projects

Contents of my-project/.versionrc.json:

{
  "bumpFiles": [
    {
      "filename": "version.sbt",
      "updater": "standard-version-updater.js"
    }
  ]
}

Contents of my-project/standard-version-updater.js:

module.exports.readVersion = contents =>
  contents.match(/"(?<version>.*)"/).groups.version

module.exports.writeVersion = (_, version) =>
  `ThisBuild / version := "${version}"\n`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment