-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
73 lines (63 loc) · 1.5 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
var gulp = require("gulp"),
eslint = require("gulp-eslint"),
esdoc = require("gulp-esdoc"),
KarmaServer = require("karma").Server,
karmaConfig,
addLint,
addDocs;
karmaConfig =
{
configFile: __dirname + '/karma.conf.js'
};
addLint = function (gulper) {
"use strict";
gulper
.pipe(
eslint({
options: {
configFile: ".eslintrc"
}
}
)
)
.pipe(eslint.format())
// To have the process exit with an error code (1) on
// lint error, return the stream and pipe to failAfterError last.
.pipe(eslint.failAfterError());
};
addDocs = function (gulper) {
"use strict";
gulper
.pipe(
esdoc({
excludePattern: "/test/",
destination: "./doc"
}
)
);
};
gulp.task("default", function (done) {
"use strict";
var lintFiles = gulp.src("./www/scripts/**/*.js"),
docFiles = gulp.src("./www/scripts/");
// Lint
addLint(lintFiles);
// Docs
addDocs(docFiles);
// Test
new KarmaServer(karmaConfig, done).start();
});
gulp.task("docs", function () {
"use strict";
var docFiles = gulp.src("./www/scripts/");
addDocs(docFiles);
});
gulp.task("lint", function () {
"use strict";
var lintFiles = gulp.src("./www/scripts/**/*.js");
addLint(lintFiles);
});
gulp.task("test", function (done) {
"use strict";
new KarmaServer(karmaConfig, done).start();
});