-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
78 lines (60 loc) · 1.56 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
74
75
76
77
78
/*jshint esnext: false, globalstrict: true */
"use strict";
var async = require("async");
var gulp = require("gulp");
var babel = require("gulp-babel");
var dox = require("gulp-dox");
var doxme = require("gulp-doxme");
var concat = require("gulp-concat");
var mustache = require("gulp-mustache");
var rename = require("gulp-rename");
// Common settings
// ---------------
var common =
{ scriptsSource: "source/**/*.js"
};
// `gulp build`
// ------------
gulp.task("build", ["scripts", "readme"]);
// `gulp scripts`
// --------------
gulp.task("scripts", ["scripts:es6", "scripts:es5"]);
gulp.task("scripts:es6", function () {
return gulp.src(common.scriptsSource)
.pipe(gulp.dest("dist.es6"))
;
});
gulp.task("scripts:es5", function () {
return gulp.src(common.scriptsSource)
.pipe(babel())
.pipe(gulp.dest("dist.es5"))
;
});
// `gulp readme`
// -------------
gulp.task("readme", function readme (doneTask) {
async.waterfall(
[ function formatComments (done) {
gulp.src(common.scriptsSource)
.once("error", done)
.pipe(concat("anything"))
.pipe(dox())
.pipe(doxme())
.once("data", function (file) {done(null, file);})
;
}
, function renderReadme (doxme, done) {
gulp.src("build/Readme.md.mustache")
.once("error", done)
.pipe(mustache(
{ api: doxme.contents.toString()
}))
.pipe(rename("Readme.md"))
.pipe(gulp.dest("."))
.once("data", function () {done();})
;
}
]
, doneTask
);
});