<commit_before>[![Travis Status][trav_img]][trav_site]
[![Coverage Status][cov_img]][cov_site]

Builder Initializer
===================

Initialize projects from [builder][] archetypes.

## Installation

Install this package as a global dependency.

```sh
$ npm install -g builder-init
```

Although we generally disfavor global installs, this tool _creates_ new projects
from scratch, so you have to start somewhere...


## Usage

```
TODO: Add usage, documentation.
https://github.com/FormidableLabs/builder-init/issues/6
```


## Templates

### Archetype Data

Archetypes provide data for template expansion via an `init.js` file in the
root of the archetype. The structure of the file is:

```js
module.exports = {
  prompts: // Questions and responses for the user
  derived: // Other fields derived from the data provided by the user
};
```

#### User Prompts

User prompts and responses are ingested using [inquirer][]. The `prompts` field
of the `init.js` object can either be an _array_ or _object_ of inquirer
[question objects][inq-questions]. For example:

```js
module.exports: {
  prompts: [
    {
      name: "name",
      message: "What is your name?",
      validate: function (val) {
        // Validate functions return `true` if valid.
        // If invalid, return `false` or an error message.
        return !!val.trim() || "Must enter a name!";
      }
    },
    {
      name: "quest",
      message: "What is your quest?"
    }
  ]
};
```

`builder-init` provides a short-cut of placing the `name` field as the key
value for a `prompts` object instead of an array:

```js
module.exports: {
  prompts: {
    name: {
      message: "What is your name?",
      validate: function (val) { return !!val.trim() || "Must enter a name!"; }
    },
    quest: {
      message: "What is your quest?"
    }
  }
};
```

**Note - Async**: Inquirer has some nice features, one of which is enabling
functions like `validate` to become async by using `this.async()`. For
example:

```js
name: {
  message: "What is your name?",
  validate: function (val) {
    var done = this.async();

    // Let's wait a second.
    setTimeout(function () {
      done(!!val.trim() || "Must enter a name!")<commit_msg>Fix more readme typos. cc @zachhale<commit_after>[![Travis Status][trav_img]][trav_site]
[![Coverage Status][cov_img]][cov_site]

Builder Initializer
===================

Initialize projects from [builder][] archetypes.

## Installation

Install this package as a global dependency.

```sh
$ npm install -g builder-init
```

Although we generally disfavor global installs, this tool _creates_ new projects
from scratch, so you have to start somewhere...


## Usage

```
TODO: Add usage, documentation.
https://github.com/FormidableLabs/builder-init/issues/6
```


## Templates

### Archetype Data

Archetypes provide data for template expansion via an `init.js` file in the
root of the archetype. The structure of the file is:

```js
module.exports = {
  prompts: // Questions and responses for the user
  derived: // Other fields derived from the data provided by the user
};
```

#### User Prompts

User prompts and responses are ingested using [inquirer][]. The `prompts` field
of the `init.js` object can either be an _array_ or _object_ of inquirer
[question objects][inq-questions]. For example:

```js
module.exports = {
  prompts: [
    {
      name: "name",
      message: "What is your name?",
      validate: function (val) {
        // Validate functions return `true` if valid.
        // If invalid, return `false` or an error message.
        return !!val.trim() || "Must enter a name!";
      }
    },
    {
      name: "quest",
      message: "What is your quest?"
    }
  ]
};
```

`builder-init` provides a short-cut of placing the `name` field as the key
value for a `prompts` object instead of an array:

```js
module.exports = {
  prompts: {
    name: {
      message: "What is your name?",
      validate: function (val) { return !!val.trim() || "Must enter a name!"; }
    },
    quest: {
      message: "What is your quest?"
    }
  }
};
```

**Note - Async**: Inquirer has some nice features, one of which is enabling
functions like `validate` to become async by using `this.async()`. For
example:

```js
name: {
  message: "What is your name?",
  validate: function (val) {
    var done = this.async();

    // Let's wait a second.
    setTimeout(function () {
      done(!!val.trim() || "Must enter a name!")
{'fraction_non_alphanumeric': 0.1366906474820144, 'fraction_numerical': 0.0004496402877697842, 'mean_word_length': 3.2655800575263663, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5462159', 'n_tokens_mistral': 1395, 'n_tokens_neox': 1341, 'n_words': 514}