-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgulpfile.js
55 lines (43 loc) · 1.17 KB
/
gulpfile.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
var del = require('del');
var gulp = require('gulp');
var babel = require('gulp-babel');
var bump = require('gulp-bump');
var filter = require('gulp-filter');
var plumber = require('gulp-plumber');
var tagVersion = require('gulp-tag-version');
// Variables
var input = './lib';
var output = './build';
var pkg = require('./package.json');
// Clean
gulp.task('clean', function() {
del.sync([output]);
});
// Javascript
gulp.task('js', function() {
gulp.src(input + '/**/*.js')
.pipe(plumber())
.pipe(babel())
.pipe(gulp.dest(output));
});
// Version bump
['patch', 'minor', 'major'].forEach(function(type) {
(function(version) {
var pkgFilter = filter('package.json');
gulp.task('version:' + version, function() {
gulp.src(['package.json', 'bower.json'])
.pipe(bump({type: version}))
.pipe(pkgFilter)
.pipe(tagVersion())
.pipe(pkgFilter.restore())
.pipe(gulp.dest('.'));
});
})(type);
});
// Watch
gulp.task('watch', ['build'], function() {
gulp.watch(input + '/**/*.js', ['js']);
});
// Defaults
gulp.task('build', ['clean', 'js']);
gulp.task('default', ['build']);