|
|
|
@ -19,21 +19,25 @@ task 'compile', 'Compile all CoffeeScript files', ->
|
|
|
|
|
# prepare lib directory |
|
|
|
|
if not fs.existsSync 'lib' |
|
|
|
|
fs.mkdirSync 'lib' |
|
|
|
|
|
|
|
|
|
# run coffee-script compile |
|
|
|
|
exec "cat #{sourcestring} > lib/index.coffee" |
|
|
|
|
|
|
|
|
|
files = glob.sync('src/mappings/*.json') |
|
|
|
|
mappings = [] |
|
|
|
|
for file in files |
|
|
|
|
data = JSON.parse(fs.readFileSync(file)) |
|
|
|
|
mappings.push data |
|
|
|
|
fs.writeFileSync('lib/mappings.json', JSON.stringify(mappings)) |
|
|
|
|
code = fs.readFileSync("lib/index.coffee") |
|
|
|
|
writestr = "mappings = JSON.parse('#{JSON.stringify(mappings)}')" |
|
|
|
|
code = writestr + "\n\n" + code |
|
|
|
|
fs.writeFileSync("lib/index.coffee", code) |
|
|
|
|
|
|
|
|
|
# run coffee-script compile |
|
|
|
|
exec "cat #{sourcestring} > lib/index.coffee" |
|
|
|
|
exec "node_modules/coffeescript/bin/coffee --compile --map --no-header lib/index.coffee", (err, stdout, stderr) -> |
|
|
|
|
if err |
|
|
|
|
util.log err |
|
|
|
|
process.exit 1 # abort npm packaging |
|
|
|
|
fs.unlink("lib/index.coffee", () -> ) |
|
|
|
|
#fs.unlink("lib/index.coffee", () -> ) |
|
|
|
|
util.log "Compiled CoffeeScript." |
|
|
|
|
|
|
|
|
|
task 'build', 'Compile and minify all CoffeeScript files', -> |
|
|
|
|