-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgulpfile.js
More file actions
60 lines (48 loc) · 1.31 KB
/
gulpfile.js
File metadata and controls
60 lines (48 loc) · 1.31 KB
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
'use strict';
var gulp = require('gulp'),
$$ = require('gulp-load-plugins')(),
runSequence = require('run-sequence'),
exec = require('child_process').exec,
path = require('path');
var srcDir = './js/',
testDir = './test/';
// // // // // // // // // // // //
gulp.task('lint', lint);
gulp.task('test', test);
gulp.task('doc', doc);
gulp.task('build', function(callback) {
clearBashScreen();
runSequence(
'lint',
'test',
'doc',
callback
);
});
gulp.task('watch', function () {
gulp.watch([srcDir + '**', testDir + '**'], ['build'])
});
gulp.task('default', ['build', 'watch']);
// // // // // // // // // // // //
function lint() {
return gulp.src(srcDir + '**/*.js')
.pipe($$.excludeGitignore())
.pipe($$.eslint())
.pipe($$.eslint.format())
.pipe($$.eslint.failAfterError());
}
function test(cb) {
return gulp.src(testDir + 'index.js')
.pipe($$.mocha({reporter: 'spec'}));
}
function doc(cb) {
exec(path.resolve('jsdoc.sh'), function (err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
cb(err);
});
}
function clearBashScreen() {
var ESC = '\x1B';
console.log(ESC + 'c'); // (VT-100 escape sequence)
}