exec cs process instead of requiring cs module

https://github.com/jashkenas/coffee-script/issues/1620
the coffee-script module isn't documented, everyone seems to prefer exec
This commit is contained in:
James Campos 2011-08-30 18:48:06 -07:00
parent 221ba438f0
commit 6c36d86535
2 changed files with 8 additions and 12 deletions

View File

@ -1,19 +1,15 @@
cs = require 'coffee-script'
fs = require 'fs'
{log} = console
{log} = console
{exec} = require 'child_process'
fs = require 'fs'
HEADER = fs.readFileSync 'header', 'utf8'
INFILE = 'script.coffee'
OUTFILE = '4chan_x.user.js'
build = ->
fs.readFile INFILE, 'utf8', (err, code) ->
exec 'coffee --print script.coffee', (err, stdout, stderr) ->
throw err if err
try
code = HEADER + cs.compile code
catch e
log e
fs.writeFile OUTFILE, code, (err) ->
fs.writeFile OUTFILE, HEADER + stdout, (err) ->
throw err if err
task 'build', ->

View File

@ -4,6 +4,6 @@
[install nodejs and npm](https://github.com/joyent/node/wiki/Installation),
install [coffee-script](https://github.com/jashkenas/coffee-script/) with
`npm install -g coffee-script`, clone 4chan x, cd into it and run
`npm link coffee-script`. actually build it with `cake build`. for development
(continuous builds), run `cake dev &`. kill the process with `killall node`.
`npm install -g coffee-script`, clone 4chan x, cd into it and actually build
with `cake build`. for development (continuous builds), run `cake dev &`.
kill the process with `killall node`.