Skip to content

Commit

Permalink
Merge pull request #2 from ankur-kushwaha/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
ankur-kushwaha authored Feb 14, 2018
2 parents 4b35880 + cd62d04 commit c561e68
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
22 changes: 12 additions & 10 deletions lib/lifecycles/analyzeCommits.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const core = require('@commitlint/core');
var gitSemverTags = require('git-semver-tags');
const RULES = require('conventional-changelog-meso/commitlint.config');
const chalk = require('chalk');

module.exports = function () {
const check = commit => {
Expand All @@ -24,20 +25,21 @@ module.exports = function () {
}).then(commits => {
return Promise.all(commits.map(check))
}).then(tasks => {
var failedTasks=[];
for(var task of tasks){
if(task.report.valid==false){
failedTasks.push({
commit:task.commit,
errors:task.report.errors
});
}
for(var i in task.report.errors){
console.log(chalk.red('Error '+(+i+1)+'.',task.report.errors[i].message));
}
for(var i in task.report.warnings){
console.log(chalk.yellow('Warning '+(+i+1)+'.',task.report.warnings[i].message));
}
console.log(chalk.blue(task.commit));
console.log(chalk.black('------------------------'));
}

if(failedTasks.length>0){
if(task.report.errors.length){
return Promise.reject({
message:"ERRORS: "+JSON.stringify(failedTasks)
})
message:"ERRORS: Invalid commits"
});
}
});
}
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/conventional-changelog/standard-version.git"
"url": "git+https://ewegithub.sb.karmalab.net/EWE/standard-version"
},
"engines": {
"node": ">=4.0"
Expand All @@ -34,9 +34,9 @@
"author": "Ben Coe <ben@npmjs.com>",
"license": "ISC",
"bugs": {
"url": "https://github.com/conventional-changelog/standard-version/issues"
"url": "https://ewegithub.sb.karmalab.net/EWE/standard-version/issues"
},
"homepage": "https://github.com/conventional-changelog/standard-version#readme",
"homepage": "https://ewegithub.sb.karmalab.net/EWE/standard-version#readme",
"dependencies": {
"@commitlint/core": "^6.0.2",
"chalk": "^1.1.3",
Expand Down

0 comments on commit c561e68

Please sign in to comment.