While I'm not sure if this is the best approach, you can technically write your package mainly in CoffeeScript.
Basically, you can write a JS file that simply wraps the coffee command, for example:
bin /howl.coffee
console.log 'Awwwooooo!'
bin / howl.js
#!/usr/bin/env node var path = require('path'); var exec = require('child_process').exec; var coffee = path.resolve(__dirname, '../node_modules/coffee-script/bin/coffee'); var howl = path.resolve(__dirname, './howl.coffee'); var command = coffee + ' ' + howl; exec(command, function(error, stdout) { if (error) { throw error }; console.log(stdout); });
Running node howl.js (or just howl when installed globally) now displays Awwooooo! . You can do something like require other CoffeeScript files and access the arguments by passing them from the JavaScript wrapper to CoffeeScript.
In any case, there may be reasons not to do this, but it has worked for me so far, so I decided to present this for an additional perspective.
For a simple example using this method, check out https://www.github.com/joshuabc/packdown .
joshuarh Jan 07 '15 at 6:39 2015-01-07 06:39
source share