README
slush-coffeescript
Generates a Node module written in CoffeeScript
Installing
Install slush-coffeescript
globally:
$ npm install -g slush-coffeescript
Usage
Create a new folder for your project:
$ mkdir my-slush-coffeescript
Run the generator from within the new folder:
$ cd my-slush-coffeescript && slush coffeescript
and answer the proceeding questions.
Add bin script for CLI?
Answering yes to this question generates an executable script (by default in the
bin
directory) to be run from the command line, which calls a modulecli
to handle processing command-line arguments and running the application.Compile CoffeeScript to JS?
Answering no (the default) to this means that the module will contain pure CoffeeScript source and extend Node's
require
function to recognise CoffeeScript modules and automatically compile them at run-time when requested (via the coffee-script/register module).To have a more traditional module with CoffeeScript source compiled to JavaScript answering yes to this prompt lets you specify a build directory which the included
Gulpfile.js
will build to.
Automating module generation
Instead of answering the prompts to configure the generator you can specify the answers in a file called slush-config.json
in the directory you run the generator from. If the generator finds this file in the current directory when it is run then it reads slush-config.json
and overrides the default settings with any data it finds.
The following examples show all of the settings the generator currently supports:
slush-config.json
Basic CoffeeScript module designed to be directly used as a library - compilation is done at run-time.
{
"app_name": "my-node-lib",
"app_description": "My CoffeeScript library",
"app_version": "0.0.1",
"author_name": "James Skinner",
"author_email": "spiralx@gmail.com",
"user_name": "spiralx",
"license": "MIT",
"bin": false,
"compiled": false,
"source_dir": "lib",
"test_dir": "test"
}
slush-config-cli.json
A CoffeeScript module that can be run from the command-line and typically installed globally.
{
"app_name": "my-node-command",
"app_description": "My CoffeeScript CLI module",
"bin": true
}
slush-config-compiled.json
A JavaScript module built from CoffeeScript source using the included gulp
build script.
{
"app_name": "my-compiled-node-lib",
"app_description": "My CoffeeScript module",
"compiled": true,
"source_dir": "coffee",
"build_dir": "lib",
"test_dir": "test"
}
slush-config-both.json
A module with a CLI script, written in CoffeeScript and compiled to JavaScript.
{
"bin": true,
"compiled": true
}
Getting To Know Slush
Slush is a tool that uses Gulp for project scaffolding.
Slush does not contain anything "out of the box", except the ability to locate installed slush generators and to run them with liftoff.
To find out more about Slush, check out the documentation.
Contributing
See the CONTRIBUTING Guidelines
Support
If you have any problem or suggestion please open an issue here.
License
The MIT License
Copyright (c) 2014, James Skinner
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.