-
Notifications
You must be signed in to change notification settings - Fork 3
/
control.ls
37 lines (29 loc) · 957 Bytes
/
control.ls
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
require! {
child_process: {spawn}
chalk: {blue, white, red, green}, chokidar, del
'./lib/parser': {writeParser}
}
export build, watch, clean, clean-all
if process.argv.2 then
console.log green 'Starting task', white that
module.exports[that]!
.then -> console.log green 'Done task', white that
.catch (.stack) >> red >> console.log
function build
clean! .then -> writeParser './dist/peg-html-parser.js'
function watch
suffix = if /^win/.test(process.platform) then '.cmd' else ''
clean-watch! .then ->
var p
chokidar.watch ['src/**/*.pegls'] .on 'change', (file) ->
p?.kill!
p := spawn "lsc#suffix", ['lib/runner.ls', file], cwd: process.cwd!, stdio: ['inherit', 'inherit', 'pipe']
p.stderr.on 'data', red >> console.log
function clean
clean-watch! .then clean-dist
function clean-watch
del ['.watch']
function clean-dist
del ['dist']
function clean-all
clean! .then -> del ['node_modules']