-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
63 lines (59 loc) · 1.74 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
55
56
57
58
59
60
61
62
63
var gulp = require('gulp'),
concat = require('gulp-concat'),
watch = require('gulp-watch'),
uglify = require('gulp-uglify'),
gzip = require('gulp-gzip'),
rename = require('gulp-rename'),
karma = require('gulp-karma'),
bump = require('gulp-bump'),
args = require('yargs').argv;
gulp.task('default', ['test'], function(){
gulp.watch(['./src/**/*.js', '!./src/**/*Test.js'], ['build']);
});
gulp.task('build', function(){
gulp.src(require('./tests/configs/support/files-core'))
.pipe(concat('picket.js'))
.pipe(gulp.dest('./build/'))
.pipe(uglify())
.pipe(rename('picket.min.js'))
.pipe(gulp.dest('./build/'))
.pipe(gzip())
.pipe(gulp.dest('./build/'));
});
gulp.task('test', function(){
var argsHolder = [];
if (args['build']) argsHolder.push('build');
if (args['build-min']) argsHolder.push('build-min');
if (argsHolder.length > 1) {
console.log('Please only provide one test type');
return;
}
if (argsHolder.length) {
return gulp.src(['**/*invalid']).pipe(karma({
configFile: 'tests/configs/' + argsHolder[0] + '.js',
action: 'run'
}));
} else {
return gulp.src(['**/*invalid']).pipe(karma({
configFile: 'tests/configs/dev.js',
action: (process.env.CI) ? 'run' : 'watch'
})).on('error', function(error) { console.error(error); });
}
});
gulp.task('bump', function(){
var argsHolder = [];
if (args.major) argsHolder.push('major');
if (args.minor) argsHolder.push('minor');
if (args.patch) argsHolder.push('patch');
if (argsHolder.length == 0) {
console.log('Please provide either --major, --minor or --patch');
return;
}
if (argsHolder.length > 1) {
console.log('Please only provide one bump type');
return;
}
return gulp.src('./bower.json')
.pipe(bump({type: argsHolder[0]}))
.pipe(gulp.dest('./'));
});