-
Notifications
You must be signed in to change notification settings - Fork 2
/
Gulpfile.js
88 lines (76 loc) · 1.93 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
'use strict';
var gulp = require('gulp');
var Server = require('karma').Server;
var coveralls = require('gulp-coveralls');
var jshint = require('gulp-jshint');
var nsp = require('gulp-nsp');
var runSequence = require('run-sequence');
var istanbul = require('gulp-istanbul');
/*
* PLEASE NOTE: run-sequence is a
* temporary solution until the release of
* Gulp 4.0, which contains run-sequence's
* functionality.
*/
var paths = {
'spec': 'spec/**/*.js',
'src': 'src/**/*.js'
};
gulp.task('ngdocs', [], function () {
var gulpDocs = require('gulp-ngdocs');
return gulp.src(paths.src)
.pipe(gulpDocs.process({
html5Mode: false,
startPage: '/api',
title: 'angular-scaffold'
}))
.pipe(gulp.dest('./build/docs'));
});
gulp.task('test', function(done) {
new Server({
configFile: __dirname + '/config/karma.conf.js',
singleRun: true
}, done).start();
});
gulp.task('coveralls', function() {
gulp.src('coverage/**/lcov.info')
.pipe(coveralls());
});
// Task that calculates the unit test coverage for the module
gulp.task('coverage', function(cb) {
new Server({
configFile: __dirname + '/config/karma.conf.js',
singleRun: true,
reporters: ['progress', 'coverage'],
preprocessors: {
'src/**/*.js':['coverage']
},
// optionally, configure the reporter
coverageReporter: {
reporters: [
{
type : 'html',
dir : 'build/coverage/'
},
{
type: 'text'
}
]
}
}, cb).start();
});
gulp.task('lint', function() {
return gulp.src([paths.src])
.pipe(jshint())
.pipe(jshint.reporter('default'))
.pipe(jshint.reporter('fail'));
});
gulp.task('security', function(cb) {
nsp({
package: __dirname + '/package.json',
stopOnError: true
}, cb);
});
gulp.task('default', function(cb) {
runSequence('test', ['lint', 'coveralls', 'security'], cb);
});