# cmaker

> Configuration maker

Latest version **1.1.1** (published 2017-01-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install cmaker
pnpm add cmaker
yarn add cmaker
bun add cmaker
```

Provides the command `cmaker`.

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2017-01-31 |
| First published | 2017-01-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4.2.4 |
| Dependencies | 11 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Mark Holtzhausen |
| Maintainers | markh |

## Links

- npm: https://www.npmjs.com/package/cmaker
- Repository: https://nemesarial@bitbucket.org/nemesarial/cmake
- Homepage: https://bitbucket.org/nemesarial/cmake#readme
- npm.io page: https://npm.io/package/cmaker

## Dependencies (11)

- [sha1](https://npm.io/package/sha1.md) ^1.1.1
- [mkdirp](https://npm.io/package/mkdirp.md) ^0.5.1
- [xml2js](https://npm.io/package/xml2js.md) ^0.4.17
- [chokidar](https://npm.io/package/chokidar.md) ^1.6.1
- [mustache](https://npm.io/package/mustache.md) ^2.3.0
- [cli-color](https://npm.io/package/cli-color.md) ^1.1.0
- [commander](https://npm.io/package/commander.md) ^2.9.0
- [dateformat](https://npm.io/package/dateformat.md) ^2.0.0
- [deep-assign](https://npm.io/package/deep-assign.md) ^2.0.0
- [file-exists](https://npm.io/package/file-exists.md) ^2.0.0
- [filter-files](https://npm.io/package/filter-files.md) ^0.4.0

## Recent versions

- 1.1.1 (latest) — 2017-01-31
- 1.1.0 — 2017-01-31
- 1.0.0 — 2017-01-27

## README

# cmake

> A tool for generating config files from templates. A specified config file is
interpolated into a set of configuration templates.

[![NPM Version][npm-image]][npm-url]

## Install

```bash
npm i -g cmaker
```

## Usage

***cconfig.js***
```javascript
module.exports={
    // rootFolder:'',
    templateFolder: 'templates/',
    outputFolder: 'output/',
    user:{
        name: 'Peter',
        surname: 'Pan',
        email: 'peter.pan@neverland.org'
    }
}
```

***templates/someconfig.json***
```json
<cmake outputFile="someFolder/someFile.json" />
{
    "services":{
        "userService":{
            "nickName": "{{user.name}}",
            "fullName": "{{user.name}} {{user.surname}}",
            "authentication":{
                "username":"{{user.email}}"
            }
        }
    }
}
```
Invoke Cmake: `cmake cconfig.js`

This will result in ***output/somefolder/someFile.json***
```json
{
    "services":{
        "userService":{
            "nickName": "Peter",
            "fullName": "Peter Pan",
            "authentication":{
                "username":"peter.pan@neverland.org"
            }
        }
    }
}
```
## Options
 - **--help** Get help
 - **-w, --watch** Watch the config file and the templat folder for changes and
 render as changes occur
 - **-f, --force** Forces output even if files have not changed
 - **--root-folder \<rootFolder\>** Overrides root folder
 - **--template-folder \<templateFolder\>** Overrides template folder
 - **--output-folder \<outputFolder\>** Overrides output folder

## Features
 - Mustache used for templating. The template files should be valid Mustache templates.
 - Template folder is processed recursively so that you can organize a large
 number of templates into subfolders **without affecting their output folder**
 - Watching for changes to facilitate easy configuration change on multiple
services at once.
 - Command line overrides for **rootFolder** **templateFolder** and **outputFolder**
 - Only changed configs will be rendered.

## WishList
 - post-change triggers in `<cmake />` tag to allow service restart or other
 actions on output file change.

## ChangeLog
### V1.1.1
 - Fixed type in install section
 
### V1.1.0
 - Expose MakeFile function as an export
 - -f, --force flag to ensure output even when the resulting file has no changes.
 - updateAction trigger to execute shell command after a config file was 
 generated. Goes in the `ctag` definition of the template files.
 - deferredAction trigger to push a shell task onto a queue to be executed at 
 the end of all template renders.
## License

[MIT](http://vjpr.mit-license.org)

[npm-image]: https://img.shields.io/npm/v/cmaker.svg
[npm-url]: https://npmjs.org/package/cmaker

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