Skip to content

Commit

Permalink
chore(ghooks): Add pre-commit and commit-msg ghook
Browse files Browse the repository at this point in the history
  • Loading branch information
kunalkapadia committed Feb 12, 2016
1 parent 5469ab1 commit ad5a538
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,6 @@ npm test (or gulp mocha)
gulp mocha --code-coverage-reporter text
```

Commit:
```sh
# Lints and execute tests before committing code. Uses commitizen to follow commit message convention.
npm run commit
```

Other gulp tasks:
```sh
# Wipe out dist and coverage directory
Expand All @@ -84,6 +78,17 @@ gulp lint
gulp
```

##### Commit:

Follows [AngularJS's commit message convention](https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md#-git-commit-guidelines)
```sh
# Lint and execute tests before committing code.
npm run commit
# OR
# use git commit directly with correct message convention.
git commit -m "chore(ghooks): Add pre-commit and commit-msg ghook"
```

## Logging

Universal logging library [winston](https://www.npmjs.com/package/winston) is used for logging. It has support for multiple transports. A transport is essentially a storage device for your logs. Each instance of a winston logger can have multiple transports configured at different levels. For example, one may want error logs to be stored in a persistent remote location (like a database), but all logs output to the console or a local file. We just log to the console for simplicity, you can configure more transports as per your requirement.
Expand Down
11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"build": "gulp",
"lint": "gulp lint",
"test": "gulp mocha",
"precommit": "npm run lint && npm test",
"commit": "git-cz",
"report-coverage": "coveralls < ./coverage/lcov.info"
},
Expand Down Expand Up @@ -62,6 +61,7 @@
"del": "^2.2.0",
"eslint": "^1.10.3",
"eslint-config-airbnb": "^4.0.0",
"ghooks": "1.0.3",
"gulp": "^3.9.0",
"gulp-babel": "^5.2.1",
"gulp-env": "^0.4.0",
Expand All @@ -78,12 +78,17 @@
"mocha": "^2.3.4",
"run-sequence": "^1.1.5",
"supertest": "^1.1.0",
"supertest-as-promised": "^2.0.2"
"supertest-as-promised": "^2.0.2",
"validate-commit-msg": "2.0.0"
},
"license": "MIT",
"config": {
"ghooks": {
"pre-commit": "npm run lint && npm test",
"commit-msg": "validate-commit-msg"
},
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
}
}
}

0 comments on commit ad5a538

Please sign in to comment.