-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathcompile
More file actions
executable file
·39 lines (26 loc) · 981 Bytes
/
compile
File metadata and controls
executable file
·39 lines (26 loc) · 981 Bytes
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
#!./node_modules/.bin/coco
coco = require \coco
pegco = require \pegco
{ TaskPool, walk } = require \rbuild
{ argv }: optimist = require "optimist"
.usage "Compile all the necessary files of the project."
.boolean "help"
.alias "help", "h"
.describe "help", "You're staring at it."
.boolean "watch"
.alias "watch", "w"
.describe "watch", "Watch the source files for changes, and recompile when changes are detected."
if argv.help
console.log optimist.help!
process.exit 0
pool = new TaskPool watch: argv.watch
# Compile .co files to .js
walk "./src", /\.co$/, (abspath, relpath) ->
outfile = "./lib/" + relpath.replace /co$/, 'js'
pool.createTaskForFile abspath, outfile, (data) ->
coco.compile data
# Compile .pegco files to .js
walk "./src", /\.pegco$/, (abspath, relpath) ->
outfile = "./lib/" + relpath.replace /pegco$/, 'js'
pool.createTaskForFile abspath, outfile, (data) ->
pegco.compile data