-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathgulpfile.js
71 lines (62 loc) · 1.85 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
"use strict";
var gulp = require("gulp");
var browserify = require("browserify");
var source = require("vinyl-source-stream");
var uglify = require('gulp-uglify');
var streamify = require('gulp-streamify');
var stylish = require("jshint-stylish");
var jshint = require("gulp-jshint");
var istanbul = require('gulp-istanbul');
var mocha = require('gulp-mocha');
var shell = require('gulp-shell');
gulp.task("build", ['bootstrap'],function() {
return browserify("./cokescript.js", {
debug: true,
standalone: "cokescript"
})
.bundle()
.pipe(source("cokescript.js"))
.pipe(gulp.dest("./dist"));
});
gulp.task("bootstrap", function() {
return gulp.src('')
.pipe(shell("lib/coke.js cokescript.coke -o cokescript.js"));
});
gulp.task("jshint", function() {
gulp.src("cokescript.js")
.pipe(jshint())
.pipe(jshint.reporter(stylish));
});
gulp.task("release", ['build'], function() {
return browserify("./cokescript.js", {
debug: false,
standalone: "cokescript"
})
.bundle()
.pipe(source("cokescript.min.js"))
.pipe(streamify(uglify()))
.pipe(gulp.dest("./dist"));
});
gulp.task("default", function() {
gulp.start("build");
});
gulp.task("virtual", function() {
return browserify("./node_modules/virtual-dom/dist/virtual-dom.js", {
debug: false,
standalone: "virtual-dom"
})
.bundle()
.pipe(streamify(uglify()))
.pipe(gulp.dest("./dist"));
});
gulp.task("test", ['build'], function() {
gulp.src(['dist/cokescript.js'])
.pipe(shell("lib/coke.js --glob test/*.coke --convert"))
.pipe(istanbul()) // Covering files
.pipe(istanbul.hookRequire()) // Force `require` to return covered files
.on('finish', function () {
gulp.src(['test/*.js'])
.pipe(mocha())
.pipe(istanbul.writeReports()); // Creating the reports after tests runned
});
});