diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 17f1d210a0..c8353a92a6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -163,7 +163,11 @@ We have very precise rules over how our git commit messages can be formatted. T readable messages** that are easy to follow when looking through the **project history**. But also, we use the git commit messages to **generate the UIGrid change log**. +Alternatively you can install [commitizen](https://github.com/commitizen/cz-cli) **OR** +use the wizard. To use the wizard, run `npm run commit` in your terminal after staging your changes in git. + ### Commit Message Format +**If you do not follow this style guide your commit message will fail to be created.** Each commit message consists of a **header**, a **body** and a **footer**. The header has a special format that includes a **type**, a **scope** and a **subject**: diff --git a/README.md b/README.md index c985480110..1efadfad45 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ [![Build Status](https://api.travis-ci.org/angular-ui/ui-grid.png?branch=3.0)](https://travis-ci.org/angular-ui/ui-grid) [![Coverage Status](https://coveralls.io/repos/angular-ui/ui-grid/badge.png?branch=master)](https://coveralls.io/r/angular-ui/ui-grid?branch=master) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/angular-ui/ui-grid?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) +[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/) [![npm](https://img.shields.io/npm/dm/angular-ui-grid.svg)](https://www.npmjs.com/package/angular-ui-grid) [![npm](https://img.shields.io/npm/dt/angular-ui-grid.svg)](https://www.npmjs.com/package/angular-ui-grid) diff --git a/grunt/aliases.js b/grunt/aliases.js index 6e2d6975ea..b16eb556dc 100644 --- a/grunt/aliases.js +++ b/grunt/aliases.js @@ -1,7 +1,7 @@ module.exports = function (grunt, options) { var baseTasks = { - 'install': ['shell:bower-install', 'shell:protractor-install'], + 'install': ['shell:bower-install', 'shell:protractor-install', 'shell:hooks-install'], // register before and after test tasks so we don't have to change cli // options on the CI server diff --git a/grunt/shell.js b/grunt/shell.js index 9469cfbd3d..61ba92f41f 100644 --- a/grunt/shell.js +++ b/grunt/shell.js @@ -22,5 +22,8 @@ module.exports = { }, 'bower-install': { command: 'node ./node_modules/bower/bin/bower install' + }, + 'hooks-install': { + command: 'npm run init' } }; diff --git a/package.json b/package.json index fbfd10833a..0bee25dbe8 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,9 @@ "test": "test" }, "scripts": { - "test": "grunt" + "init": "validate-commit-msg", + "test": "grunt", + "commit": "git-cz" }, "repository": { "type": "git", @@ -33,6 +35,8 @@ "bower": "^1.3.8", "canonical-path": "0.0.2", "coveralls": "^2.11.1", + "cz-conventional-changelog": "^1.1.5", + "ghooks": "^1.0.3", "grunt": "~0.4", "grunt-angular-templates": "~0.5", "grunt-bump": "0.0.15", @@ -72,6 +76,17 @@ "selenium-webdriver": "~2.46.0", "semver": "~2.2.1", "shelljs": "~0.2.6", - "time-grunt": "~1.1.0" + "time-grunt": "~1.1.0", + "validate-commit-message": "^3.0.1" + }, + "config": { + "commitizen": { + "path": "./node_modules/cz-conventional-changelog" + }, + "ghooks": { + "commit-msg": "validate-commit-msg", + "post-merge": "npm install", + "post-rewrite": "npm install" + } } }