Skip to content

Instantly share code, notes, and snippets.

@iamronsuez
Last active February 1, 2019 16:24
Show Gist options
  • Save iamronsuez/4803f2dacbc41bf6babdcc82cdacc427 to your computer and use it in GitHub Desktop.
Save iamronsuez/4803f2dacbc41bf6babdcc82cdacc427 to your computer and use it in GitHub Desktop.

Comittizen Setup

Install node

  • install node latest

Install dependencies

  • git init (if the project does not have git initalized)
  • npm init or (copy the format below)

Setup

  • add node_modules/ to .gitignore
  • git add .gitignore package.json package-lock.json

Install tools

  • npm install -g cz-conventional-changelog commitizen conventional-changelog-cli
  • commitizen init cz-conventional-changelog --save-dev --save-exact

Add configuration scripts

* add to package.json -> scripts -> "commit": "npx git-cz"
* add to package.json -> scripts -> "version": "conventional-changelog -p [project name] -i CHANGELOG.md -s -r 0 && git add CHANGELOG.md"
npm run commit -> 
create a chore commit with the format:
chore(versioning): added commitizen

added commitizen configuration 

BREAKING CHANGE: added npm module versioning, added commitizen

Package.json template

 package.json
 
{
 "name": "[project-name]",
 "version": "1.0.0",
 "description": "",
 "main": "index.js",
 "dependencies": {},
 "devDependencies": {
   "cz-conventional-changelog": "^2.1.0"
 },
 "scripts": {
   "test": "echo \"Error: no test specified\" && exit 1",
   "commit": "npx git-cz",
   "version":"conventional-changelog -p [project-name] -i CHANGELOG.md -s -r 0 && git add CHANGELOG.md"
 },
 "repository": {
   "type": "git",
   "url": "[repository url]"
 },
 "author": "",
 "license": "ISC",
 "config": {
   "commitizen": {
     "path": "./node_modules/cz-conventional-changelog"
   }
 }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment