-
Notifications
You must be signed in to change notification settings - Fork 8
/
gulpfile.js
73 lines (64 loc) · 1.67 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
'use strict';
var gulp = require('gulp');
var eslint = require('gulp-eslint');
var shrinkwrap = require('gulp-shrinkwrap');
var gulpNSP = require('gulp-nsp');
var gulpIf = require('gulp-if');
var mocha = require('gulp-mocha');
var istanbul = require('gulp-istanbul');
var exit = require('gulp-exit');
var codacy = require('gulp-codacy');
gulp.task('lint', () => {
return gulp.src(['index.js', 'lib/loopback-ssl.js', '!node_modules/**'])
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});
gulp.task('nsp', function(cb) {
return gulpNSP({
shrinkwrap: __dirname + '/npm-shrinkwrap.json',
package: __dirname + '/package.json',
output: 'default',
stopOnError: false,
}, cb);
});
gulp.task('shrinkwrap', function() {
return gulp.src('./package.json')
.pipe(shrinkwrap.lock())
.pipe(gulp.dest('./'));
});
function isFixed(file) {
return file.eslint != null && file.eslint.fixed;
}
gulp.task('test', function(cb) {
gulp.src([
'index.js',
'lib/**/*.js'])
.pipe(istanbul())
.pipe(istanbul.hookRequire())
.on('finish', function() {
gulp.src([
'test/**/*-test.js'])
.pipe(mocha({timeout: 1000}))
.pipe(istanbul.writeReports())
.on('end', function() {
cb();
})
.pipe(exit());
});
});
gulp.task('codacy', function codacyTask() {
return gulp
.src(['./coverage/lcov.info'], {read: false})
.pipe(codacy({
token: '6364b0b53a1a4d5795c5aa4f2bd66857',
}))
;
});
gulp.task('default', [
'test',
'lint',
'nsp',
'codacy',
], function() {});
gulp.task('build', ['default']);