-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
93 lines (80 loc) · 2.15 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
'use strict';
var gulp = require('gulp');
var $ = require('gulp-load-plugins')();
var runSequence = require('run-sequence');
var karma = require('karma').Server;
var sources = 'src/**/*.js';
var specs = 'test/**/*.spec.js';
var reports = 'reports/**/lcov.info';
var versions = ['package.json', 'bower.json'];
gulp.task('test', test);
gulp.task('test:lint', lint);
gulp.task('test:unit', unit);
gulp.task('test:coveralls', coveralls);
gulp.task('dist', dist);
gulp.task('dist:minimize', minimize);
gulp.task('dist:docs', docs);
gulp.task('version:major', version('major'));
gulp.task('version:minor', version('minor'));
gulp.task('version:patch', version('patch'));
function test(done) {
runSequence(
[
'test:lint',
'test:unit'
],
done
);
}
function lint() {
return gulp.src([sources, specs])
.pipe($.jshint())
.pipe($.jscs())
.pipe($.jscsStylish.combineWithHintResults())
.pipe($.jshint.reporter('jshint-stylish'))
.pipe($.jshint.reporter('fail'));
}
function unit(done) {
new karma({
configFile: __dirname + '/karma.conf.js'
}, done).start();
}
function coveralls() {
return gulp.src(reports)
.pipe($.coveralls());
}
function dist(done) {
runSequence(
[
'dist:minimize',
'dist:docs'
],
done
);
}
function minimize() {
return gulp.src(sources)
.pipe(gulp.dest('dist'))
.pipe($.uglify({ preserveComments: 'license' }))
.pipe($.rename({ suffix: '.min' }))
.pipe(gulp.dest('dist'));
}
function docs() {
return gulp.src(sources)
.pipe($.ngdocs.process({
html5Mode: false,
startPage: '/api/packery-angular',
titleLink: 'https://github.com/Dilatorily/packery-angular'
}))
.pipe(gulp.dest('docs'));
}
function version(type) {
return function () {
return gulp.src(versions)
.pipe($.bump({ type: type }))
.pipe(gulp.dest('.'))
.pipe($.git.commit('[CHORE] Bump package version'))
.pipe($.filter(versions[0]))
.pipe($.tagVersion());
};
}