-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgulpfile.js
More file actions
115 lines (99 loc) · 2.61 KB
/
gulpfile.js
File metadata and controls
115 lines (99 loc) · 2.61 KB
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
var
gulp = require('gulp'),
purescript = require('gulp-purescript'),
concat = require('gulp-concat'),
gulpif = require('gulp-if'),
gulpFilter = require('gulp-filter'),
express = require('express'),
runSq = require('run-sequence'),
karma = require('gulp-karma'),
paths = {
test : {
src : [
"bower_components/chai/chai.js",
"bower_components/js-yaml/dist/js-yaml.js",
"bower_components/purescript-*/src/**/*.purs",
"bower_components/purescript-*/src/**/*.purs.hs",
"src/**/*.purs",
"tests/**/*.purs"
],
dest : 'tmp'
},
example : {
src : [
"bower_components/jquery/dist/jquery.js",
"bower_components/js-yaml/dist/js-yaml.js",
"bower_components/purescript-*/src/**/*.purs",
"bower_components/purescript-*/src/**/*.purs.hs",
"src/**/*.purs",
"example/**/*.purs"
],
dest : "example/js"
}
},
options = {
src :{
output : 'Presentable.js'
},
test :{
output : 'Test.js',
main : true,
runtimeTypeChecks : false,
externs : "extern.purs"
},
example : {
output : 'Main.js',
main : true,
modules : ["Main"],
externs : "extern.purs"
}
},
port = 3333,
server = express(),
build = function(k){
return function(){
var x = paths[k],
o = options[k],
psc = purescript.psc(o),
dot = purescript.dotPsci();
psc.on('error', function(e){
console.error(e.message);
psc.end();
});
gulp.src(x.src)
.pipe(gulpif(/purs/, dot));
return gulp.src(x.src)
.pipe(gulpif(/purs/, psc))
.pipe(concat(o.output))
.pipe( gulp.dest(x.dest));
};
}; // var
gulp.task('build:test', build('test'));
gulp.task('build:example', build('example'));
gulp.task('test:unit', function(){
setTimeout(function(){
gulp.src(options.test.output)
.pipe(karma({
configFile : "./tests/karma.conf.js",
noColors : true,
action : "run"
}));
}, 2000);
});
gulp.task('watch', function(){
gulp.watch(paths.example.src, ['build:example']);
});
gulp.task('serve', function(){
console.log("listening on port " + port);
server.use(express.static('./example'));
server.listen(port);
});
gulp.task('docgen', function(){
var noBower = gulpFilter(["*", "!bower_components/**/*"]);
gulp.src("src/**/*.purs")
.pipe(purescript.docgen())
.pipe( gulp.dest("DocGen.md"));
});
gulp.task('default', ['build:example','watch','serve']);
gulp.task('test', function(){ runSq('build:test','test:unit'); });
gulp.task('travis', ['build:example', 'test']);