# @cthru/jafar

> Folder based templating utility

Latest version **1.2.0** (published 2018-06-04) · ISC license · 0 weekly downloads

## Install

```sh
npm install @cthru/jafar
pnpm add @cthru/jafar
yarn add @cthru/jafar
bun add @cthru/jafar
```

Provides the commands `jafar`, `jafar-list`, `jafar-remove`, `jafar-register`.

## 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.2.0 |
| Published | 2018-06-04 |
| First published | 2018-06-01 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 8 |
| Unpacked size | 10 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | markh |

## Links

- npm: https://www.npmjs.com/package/@cthru/jafar
- npm.io page: https://npm.io/package/@cthru/jafar

## Dependencies (8)

- [ncp](https://npm.io/package/ncp.md) ^2.0.0
- [rmdir](https://npm.io/package/rmdir.md) ^1.2.0
- [mkdirp](https://npm.io/package/mkdirp.md) ^0.5.1
- [inquirer](https://npm.io/package/inquirer.md) ^5.2.0
- [commander](https://npm.io/package/commander.md) ^2.15.1
- [@cthru/obj](https://npm.io/package/@cthru/obj.md) ^0.2.0
- [handlebars](https://npm.io/package/handlebars.md) ^4.0.11
- [recursive-readdir](https://npm.io/package/recursive-readdir.md) ^2.2.2

## Recent versions

- 1.2.0 (latest) — 2018-06-04
- 1.1.0 — 2018-06-01
- 1.0.1 — 2018-06-01
- 1.0.0 — 2018-06-01

## README

# Jafar

> Easy folder-level templating

Jafar will prompt you for some values, then replace those values via handlebars in a duplicate folder.
You could think of it as Yeoman-lite. It serves the purpose of providing skeleton projects based on template folders.

## Installation

It is preferable to install this as a global utilty

```sh
npm install -g @chru/jafar
```

## Usage
Jafar takes two arguments -- the `source` folder and the `destination` folder.
It will look for `.jafar.js` configuration in the root of the source folder.

```JavaScript
module.exports = {
    prompts : [
        { 
            type: 'input', 
            name: 'variable.name', 
            message: 'Please input the variable value',
            default: 'default value'
        }
    ]
}
```

This will produce an hashmap of values that gets replaced using handlebars in each file found in `/src/**/*` and copy the resultant file to `/dest/**/*`

### Example Usage
```JavaScript
// src/package.json
{
  "name": "{{package.name}}",
  "version": "{{package.version}}",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "rmdir": "^1.2.0"
  }
}
```
```JavaScript
// src/.jafar.js
module.exports = {
    prompts : [
        { 
            type: 'input', 
            name: 'package.name', 
            message: 'What is your package name',
            default: 'default value'
        }
    ]
}
```

`jafar src/ dest/`

```JavaScript
// dest/package.json
{
  "name": "{{package.name}}",
  "version": "{{package.version}}",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "rmdir": "^1.2.0"
  }
}
```

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