forked from purescript-halogen/purescript-halogen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
106 lines (99 loc) · 2.82 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
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
'use strict'
var gulp = require('gulp')
, purescript = require('gulp-purescript')
, browserify = require('gulp-browserify')
, run = require('gulp-run')
, runSequence = require('run-sequence')
, jsValidate = require('gulp-jsvalidate')
;
var paths = {
src: [
'src/**/*.purs',
],
bowerSrc: [
'bower_components/purescript-*/src/**/*.purs'
],
dest: '',
docs: [
{
dest: 'docs/Halogen.md',
src: 'src/Halogen.purs'
},
{
dest: 'docs/Halogen-Signal.md',
src: 'src/Halogen/Signal.purs'
},
{
dest: 'docs/Halogen-HTML.md',
src: [ 'src/Halogen/HTML.purs', 'src/Halogen/HTML/Attributes.purs' ]
},
{
dest: 'docs/Halogen-Component.md',
src: 'src/Halogen/Component.purs'
},
{
dest: 'docs/Halogen-Widgets.md',
src: 'src/Halogen/HTML/Widget.purs'
},
{
dest: 'docs/Halogen-HTML-Traversals.md',
src: 'src/Halogen/HTML/Traversals.purs'
},
{
dest: 'docs/Halogen-HTML-Renderer.md',
src: [ 'src/Halogen/HTML/Renderer/VirtualDOM.purs', 'src/Halogen/HTML/Renderer/String.purs' ]
},
{
dest: 'docs/Halogen-Forms.md',
src: 'src/Halogen/HTML/Events/Forms.purs'
},
{
dest: 'docs/Halogen-Target.md',
src: 'src/Halogen/HTML/Target.purs'
},
{
dest: 'docs/Halogen-Events.md',
src: [ 'src/Halogen/HTML/Events/Types.purs', 'src/Halogen/HTML/Events.purs', 'src/Halogen/HTML/Events/Handler.purs', 'src/Halogen/HTML/Events/Monad.purs' ]
},
{
dest: 'docs/Halogen-Mixin-UndoRedo.md',
src: 'src/Halogen/Mixin/UndoRedo.purs'
},
{
dest: 'docs/Halogen-Mixin-Router.md',
src: 'src/Halogen/Mixin/Router.purs'
}
]
};
function compile (compiler, src, opts) {
var psc = compiler(opts);
psc.on('error', function(e) {
console.error(e.message);
psc.end();
});
return gulp.src(src.concat(paths.bowerSrc))
.pipe(psc)
.pipe(jsValidate());
};
function docs (target) {
var docgen = purescript.pscDocs();
docgen.on('error', function(e) {
console.error(e.message);
docgen.end();
});
return gulp.src(target.src)
.pipe(docgen)
.pipe(gulp.dest(target.dest));
}
gulp.task('make', function() {
return compile(purescript.pscMake, paths.src, {})
.pipe(gulp.dest(paths.dest))
});
gulp.task('docs', function() {
return paths.docs.forEach(function(task) {
return docs(task);
});
});
gulp.task('default', function(cb) {
runSequence('make', 'docs', cb);
});