update example now that the CoffeeScript compiler generates source maps

This commit is contained in:
Evan Wallace 2013-03-08 21:10:26 -08:00
parent 18992a7be6
commit 123fb717b2

View File

@ -20,22 +20,18 @@ The following terminal commands show a stack trace in node with CoffeeScript fil
bar()
foo()
$ npm install source-map-support
$ git clone https://github.com/michaelficarra/CoffeeScriptRedux.git
$ cd CoffeeScriptRedux && npm install && cd ..
$ CoffeeScriptRedux/bin/coffee --js -i demo.coffee > demo.js
$ echo '//@ sourceMappingURL=demo.js.map' >> demo.js
$ CoffeeScriptRedux/bin/coffee --source-map -i demo.coffee > demo.js.map
$ npm install source-map-support coffee-script
$ node_modules/coffee-script/bin/coffee --map --compile demo.coffee
$ node demo
demo.coffee:4
bar = -> throw new Error 'this is a demo'
^
^
Error: this is a demo
at bar (demo.coffee:4:19)
at bar (demo.coffee:4:21)
at foo (demo.coffee:5:3)
at Object.<anonymous> (demo.coffee:6:3)
at Object.<anonymous> (demo.coffee:6:6)
at Object.<anonymous> (demo.coffee:6)
at Object.<anonymous> (demo.coffee:2)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
@ -43,8 +39,6 @@ The following terminal commands show a stack trace in node with CoffeeScript fil
at Module.runMain (module.js:492:10)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)
Note that the steps above are just to demonstrate this library. If you want good stack traces for your own CoffeeScript project, you can run coffee files directly with CoffeeScriptRedux (use the `--eval` flag) and the stack traces will have the correct CoffeeScript line numbers.
### TypeScript Demo
The following terminal commands show a stack trace in node with TypeScript filenames: