-
Notifications
You must be signed in to change notification settings - Fork 0
/
taskfile.js
executable file
·84 lines (75 loc) · 1.98 KB
/
taskfile.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
79
80
81
82
83
84
var task = require("@nathanfaucett/task"),
comn = require("@nathanfaucett/comn"),
filePath = require("@nathanfaucett/file_path"),
fs = require("fs"),
pump = require("pump"),
rename = require("gulp-rename"),
envify = require("gulp-envify"),
uglify = require("gulp-uglify"),
jshint = require("gulp-jshint"),
jsbeautifier = require("gulp-jsbeautifier");
task("jsbeautifier", "beautifier js files", task.parallel(
function() {
return task.src("./taskfile.js").pipe(jsbeautifier()).pipe(task.dest("."));
},
function() {
return task.src("./src/**/*.js").pipe(jsbeautifier()).pipe(task.dest("./src"));
},
function() {
return task.src("./test/**/*.js").pipe(jsbeautifier()).pipe(task.dest("./test"));
}
));
task("jshint", "run jshint", function() {
return (
task.src([
"./taskfile.js",
"./src/**/*.js",
"./test/**/*.js"
])
.pipe(jshint({
es3: true,
unused: true,
curly: true,
eqeqeq: true,
expr: true,
eqnull: true,
proto: true
}))
.pipe(jshint.reporter("default"))
);
});
task("comn", function(done) {
var out = comn("./", {
exportName: "virtDOM"
}),
entry = out.entry();
fs.writeFile(filePath.join(__dirname, "./dist/virt-dom.js"), entry.source, done);
});
task("envify", function() {
return (
task.src("dist/virt-dom.js")
.pipe(envify({
NODE_ENV: "production"
}))
.pipe(rename({
suffix: ".min"
}))
.pipe(task.dest("./dist"))
);
});
task("uglify", function(done) {
return pump([
task.src("./dist/virt-dom.min.js"),
uglify(),
task.dest("./dist")
], done);
});
task("default", task.series(
task("jsbeautifier"),
task("jshint")
));
task("dist", task.series(
task("comn"),
task("envify"),
task("uglify")
));