This repository has been archived by the owner on Sep 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
executable file
·73 lines (61 loc) · 1.83 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
/*jslint node: true, unparam: true, vars: true */
"use strict";
var gulp = require("gulp");
var jshint = require("gulp-jshint");
var jslint = require("gulp-jslint-simple");
var mocha = require("gulp-mocha");
var monitorCtrlC = require("monitorctrlc");
var rimraf = require("gulp-rimraf");
var taskFromStreams = require("gulp-taskfromstreams");
var srcFiles = "{.,./lib}/*.js*";
var testFiles = "tests/*.js";
var exampleOut = "./build";
gulp.task("lint", taskFromStreams(function () {
return [
gulp.src([srcFiles, testFiles]),
jshint(),
jslint.run(),
jslint.report({ emitErrorAtEnd: false })
];
}));
gulp.task("test", ["lint"], taskFromStreams(function () {
return [
gulp.src(testFiles, { read: false }),
mocha({ reporter: "spec" })
];
}));
gulp.task("clean", taskFromStreams(function () {
return [
gulp.src(exampleOut, { read: false }),
rimraf()
];
}));
gulp.task("example", ["lint", "clean"], taskFromStreams(function () {
var browserify = require("browserify");
var source = require("vinyl-source-stream");
var multi = require("./index");
var entryConfig = {
common: {
start: "./tests/fixtures/start.js",
group: {
stop: "./tests/fixtures/stop.js",
pause: ["./tests/fixtures/pause.js", "./tests/fixtures/resume.js"]
}
},
oneoff: "./tests/fixtures/oneoff.js"
};
var m = multi(entryConfig, { browserify: browserify });
return [
m.bundle({
objectMode: true,
debug: true,
pipeTo: function (name) { return source(name + ".js"); }
}),
gulp.dest(exampleOut)
];
}));
gulp.task("watch", function () {
monitorCtrlC();
gulp.watch([srcFiles, testFiles], ["test"]);
gulp.start("test");
});