# tower-recipe

> It's a generator, among other things.

Latest version **0.1.0** (published 2013-06-24) · 0 weekly downloads

## Install

```sh
npm install tower-recipe
pnpm add tower-recipe
yarn add tower-recipe
bun add tower-recipe
```

## Health

**Score 10/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2013-06-24 |
| First published | 2013-06-02 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | viatropos |

## Links

- npm: https://www.npmjs.com/package/tower-recipe
- Repository: http://github.com/tower/recipe
- npm.io page: https://npm.io/package/tower-recipe

## Dependencies (4)

- [ejs](https://npm.io/package/ejs.md) ~0.8.3
- [ansi](https://npm.io/package/ansi.md) ~0.1.2
- [tower-fs](https://npm.io/package/tower-fs.md) >= 0.5.0-pre2
- [tower-emitter](https://npm.io/package/tower-emitter.md) 0.1.0

## Recent versions

- 0.1.0 (latest) — 2013-06-24
- 0.1.0pre2 — 2013-06-02
- 0.1.0pre — 2013-06-02

## README

# Tower Recipe

It's a generator, among other things.

TODO:

- be able to save local generators to global (home directory).

## Install

Node:

```
npm install tower-recipe
```

## Usage

This library doesn't require anything on the command line. It's just the barebones functionality common to recipes, and should be easy to build upon.

Define a custom template (`./my-recipe/index.js`):

```js

/**
 * Example:
 *
 *    tower create app my-app
 */

exports.create = function(recipe, args, fn){
  var strcase = require('tower-strcase')
    , tinfo = require('tinfo')
    , now = new Date()
    , projectName = args[3];

  var options = require('commander')
    .option('-o, --output-directory [value]', 'Output directory', process.cwd())
    .option('-b --bin', 'include executable', false)
    .option('--component', 'Add component.json', false)
    .option('--package', 'Add package.json', true)
    .option('--travis', 'Include travis.yml', false)
    .parse(args);

  recipe.outputDirectory(options.outputDirectory);

  recipe
    .set('projectName', projectName)
    .set('date', { year: now.getFullYear() })
    .set('strcase', strcase);

  tinfo(function(info){
    recipe
      .set('userRealName', info.name)
      .set('userTwitterName', info.username)
      .set('userGitHubName', info.username)
      .set('userEmail', info.email);

    recipe.directory(projectName, function(){
      if (options.bin) {
        recipe.directory('bin', function(){
          recipe.file(projectName);
          recipe.executable(projectName);
        });
      }

      recipe.template('README.md');

      if (options.component)
        recipe.template('component.json');

      if (options.package)
        recipe.template('package.json');

      recipe.copy('.gitignore');
      recipe.copy('.npmignore');

      if (options.travis)
        recipe.copy('.travis.yml');

      recipe.template('app.js')
        .directory('models')
        .directory('routes')
        .directory('templates')
        .directory('views')
        .directory('public', function(){
          recipe.directory('images')
            .directory('javascripts')
            .directory('stylesheets');
        });

      recipe.directory('test', function(){
        recipe.template('index.js', 'test.js');
        recipe.template('index.html', 'test.html');
      });
    });

    fn();
  }, this);
}
```

In addition to `create`, you can use:

```
remove // to undo create
watch  // to do something on watch
update // to update to the latest app structure, for example
list
install
uninstall
build
```

## Notes

- https://github.com/sprinkle-tool/sprinkle

---
_Source: https://npm.io/package/tower-recipe · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
