-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathgulpfile.js
53 lines (46 loc) · 980 Bytes
/
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
/**
* Usage
* gulp [task] --env development
*/
'use strict';
const gulp = require('gulp');
const jsdoc = require('gulp-jsdoc');
const mocha = require('gulp-mocha');
const eslint = require('gulp-eslint');
const utils = require('gulp-util');
/**
* lint task
* lint code
*/
gulp.task('lint', function () {
return gulp.src(['lib/**/*.js','!node_modules/**'])
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});
/**
* test task
* Run unit tests
*/
gulp.task('test', ['lint'], function () {
return gulp.src('lib/**/*.spec.js', {read: false})
.pipe(mocha({
ui: 'bdd',
reporter: 'spec'
}))
.on('error', utils.log);
});
/**
* docs task
* Generate the JavaScript documentation
*/
gulp.task('docs', function () {
return gulp.src('lib/index.js')
.pipe(jsdoc('./docs'))
.on('error', utils.log);
});
/*
* Grouped task definitions
*/
gulp.task('build', ['test', 'docs']);
gulp.task('default', ['test']);