-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
27 lines (26 loc) · 1.13 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/**
* Semver Tasks for Gulp.
* Adapted from the example provided at https://github.com/ikari-pl/gulp-tag-version
*/
module.exports = function(gulp, config) {
var bump = require('gulp-bump'),
git = require('gulp-git'),
filter = require('gulp-filter'),
tagVersion = require('gulp-tag-version'),
config = config || {},
versionSource = config.versionSource || ['./package.json'],
newVersionFilter = config.versionFilter || 'package.json',
tagVersionArgs = config.tagVersionArgs,
commitMessage = config.commitMessage || function (importance) { return "" + importance + " version bump"; };
function inc(importance) {
return gulp.src(versionSource)
.pipe(bump({type: importance}))
.pipe(gulp.dest('./'))
.pipe(git.commit(commitMessage(importance)))
.pipe(filter(newVersionFilter))
.pipe(tagVersion(tagVersionArgs));
};
gulp.task('bump:patch', function() { return inc('patch'); });
gulp.task('bump:minor', function() { return inc('minor'); });
gulp.task('bump:major', function() { return inc('major'); });
};