-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.ls
More file actions
121 lines (105 loc) · 2.73 KB
/
gulpfile.ls
File metadata and controls
121 lines (105 loc) · 2.73 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
116
117
118
119
120
121
require! <[
express
run-sequence
js-string-escape
gulp
gulp-if
gulp-karma
gulp-concat
gulp-rename
gulp-purescript
gulp-livescript
gulp-filter
gulp-file-include
]>
paths =
prod:
src: <[
bower_components/node-uuid/uuid.js
bower_components/Chart.js/Chart.js
bower_components/js-yaml/dist/js-yaml.js
bower_components/socket.io-client/socket.io.js
bower_components/moment/moment.js
bower_components/purescript-*/src/**/*.purs
bower_components/purescript-*/src/**/*.purs.hs
bower_components/presentable*/src/**/*.purs
src/**/*.ls
src/**/*.purs
]>
dest: "public/js"
test:
src: <[
bower_components/chai/chai.js
bower_components/tiny-trigger/dist/tinytrigger.js
bower_components/js-yaml/dist/js-yaml.js
bower_components/socket.io-client/socket.io.js
bower_components/moment/moment.js
bower_components/purescript-*/src/**/*.purs
bower_components/purescript-*/src/**/*.purs.hs
bower_components/presentable*/src/**/*.purs
src/**/*.ls
src/**/*.purs
]>
dest: "tmp"
options =
prod:
output: "App.js"
main: true
test:
output: "Test.js"
main: true
externs: "extern.purs"
port = 3333
server = express()
build = (k) -> ->
x = paths[k]
o = options[k]
psc = gulp-purescript.psc o
lsc = gulp-livescript bare : true
fil = gulp-filter (file) ->
if k is "test"
then not /Main.purs/.test file.path
else not /Test/ig.test file.path
psc.on "error" ({message}) ->
console.error message
psc.end()
gulp.src x.src
.pipe fil
.pipe gulp-if /.purs/, psc
.pipe gulp-if /.ls/, lsc
.pipe gulp-concat o.output
.pipe gulp.dest x.dest
gulp.task "build:test", build "test"
gulp.task "build:prod", build "prod"
gulp.task "build:html" ->
inc = gulp-file-include(
prefix : "@"
basepath : "yaml"
filters :
escape : js-string-escape
)
gulp.src "yaml/html.html"
.pipe inc
.pipe gulp-rename "index.html"
.pipe gulp.dest "public"
gulp.task "test:unit" ->
gulp.src options.test.output .pipe gulp-karma(
configFile : "./karma.conf.ls"
noColors : true
action : "run"
)
gulp.task "watch" ->
gulp.watch paths.prod.src, <[ build:prod ]>
gulp.watch <[ yaml/* ]>, <[ build:html ]>
gulp.task "serve" ->
console.log "listening on port " + port
server.use express.static "./public"
server.listen port
gulp.task "doc" ->
gulp.src "src/**/*.purs"
.pipe purescript.docgen()
.pipe gulp.dest "DocGen.md"
gulp.task "build" <[build:prod build:html]>
gulp.task "default" <[build watch serve]>
gulp.task "test" -> run-sequence "build:test" "test:unit"
gulp.task "travis" <[build test]>