Skip to content
This repository has been archived by the owner on Nov 21, 2017. It is now read-only.

Commit

Permalink
feat(deps): modulise conventional-commits-filter
Browse files Browse the repository at this point in the history
  • Loading branch information
stevemao committed Jul 3, 2015
1 parent bfaaa80 commit b1eadb9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 47 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ $ conventional-recommended-bump --help

Type: `boolean` Default: `true`

If true, reverted commits will be ignored.
If `true`, reverted commits will be ignored.

##### preset

Expand Down
46 changes: 2 additions & 44 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,55 +1,13 @@
'use strict';
var concat = require('concat-stream');
var conventionalCommitsFilter = require('conventional-commits-filter');
var conventionalCommitsParser = require('conventional-commits-parser');
var gitLatestSemverTag = require('git-latest-semver-tag');
var gitRawCommits = require('git-raw-commits');
var modifyValues = require('modify-values');
var isSubset = require('is-subset');
var objectAssign = require('object-assign');

var VERSIONS = ['major', 'minor', 'patch'];

function filterCommits(commits) {
var ret = [];
var ignores = [];
commits.forEach(function(commit) {
if (commit.revert) {
ignores.push(commit.revert);
} else {
ret.push(commit);
}
});

ret = ret.filter(function(commit) {
var ignoreThis = false;

commit = modifyValues(commit, function(val) {
if (typeof val === 'string') {
return val.trim();
}

return val;
});

ignores.some(function(ignore) {
ignore = modifyValues(ignore, function(val) {
if (typeof val === 'string') {
return val.trim();
}

return val.trim();
});

ignoreThis = isSubset(commit, ignore);
return ignoreThis;
});

return !ignoreThis;
});

return ret;
}

function conventionalRecommendedBump(options, parserOpts, cb) {
var preset;
var noop = function() {};
Expand Down Expand Up @@ -99,7 +57,7 @@ function conventionalRecommendedBump(options, parserOpts, cb) {
var commits;

if (options.ignoreReverted) {
commits = filterCommits(data);
commits = conventionalCommitsFilter(data);
} else {
commits = data;
}
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@
],
"dependencies": {
"concat-stream": "^1.4.10",
"conventional-commits-filter": "0.0.1",
"conventional-commits-parser": "0.0.18",
"git-latest-semver-tag": "0.0.0",
"git-raw-commits": "0.0.8",
"is-subset": "^0.1.1",
"meow": "^3.3.0",
"modify-values": "^1.0.0",
"object-assign": "^3.0.0"
},
"devDependencies": {
Expand Down

0 comments on commit b1eadb9

Please sign in to comment.