forked from maxgalbu/nightwatch-custom-commands-assertions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
71 lines (64 loc) · 1.7 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
var gulp = require("gulp"),
gulputil = require("gulp-util"),
babel = require("gulp-babel"),
plumber = require("gulp-plumber"),
markdox = require("gulp-markdox"),
rename = require("gulp-rename"),
include = require("gulp-include"),
flatten = require('gulp-flatten');
gulp.task("default", ["assertions", "commands", "docs"]);
gulp.task("assertions", function() {
return gulp.src("es6/assertions/*.js")
.pipe(plumber(function(error) {
gulputil.log(gulputil.colors.red(error.message));
if (error.message != "write after end")
gulputil.log(error.stack);
this.emit("end");
}))
.pipe(include())
.pipe(babel({
presets: ['es2015'],
plugins: ["add-module-exports"]
}))
.pipe(gulp.dest("js/assertions/"));
});
gulp.task("commands", function() {
return gulp.src("es6/commands/*.js")
.pipe(plumber(function(error) {
gulputil.log(gulputil.colors.red(error.message));
if (error.message != "write after end")
gulputil.log(error.stack);
this.emit("end");
}))
.pipe(include())
.pipe(babel({
presets: ['es2015'],
plugins: ["add-module-exports"]
}))
.pipe(gulp.dest("js/commands/"));
});
gulp.task("docs", function() {
return gulp.src([
"es6/commands/*.js",
"es6/assertions/*.js"
])
.pipe(plumber(function(error) {
gulputil.log(gulputil.colors.red(error.message));
this.emit("end");
}))
.pipe(markdox())
.pipe(flatten())
.pipe(rename({
extname: ".md"
}))
.pipe(gulp.dest("docs"));
});
gulp.task("watch", function() {
gulp.watch('es6/*.js', ['assertions', 'commands']);
gulp.watch('es6/assertions/**', ['assertions']);
gulp.watch('es6/commands/**', ['commands']);
gulp.watch([
"es6/commands/*.js",
"es6/assertions/*.js"
], ['docs']);
});