I have used CoffeeScript for a while. Now I need to write a npm package, can I write it in CoffeeScript, or I should compile CoffeeScript into JavaScript?
If a lot of your modules have coffee-script
in their devDependencies
, it's useful to just globally install coffee-script
instead of install it for each module (which takes much longer).
coffee-build is a global version manager for coffee-script
.
Just add these 2 scripts to your package.json
:
{
"name": "my-coffee-module",
"scripts": {
"build": "coffee-build -v 1.11.x -b -o js src",
"postinstall": "npm run build"
}
}
Notice how -v 1.11.x
is not an exact version, which allows implicit upgrades.
The only downfall is that users must npm install -g coffee-build
before they can install your module.