@cthru/jafar
Folder based templating utility
Last updated 2 years ago by markh .
ISC · Original npm · Tarball · package.json
$ cnpm install @cthru/jafar 
SYNC missed versions from official npm registry.

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

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.

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

// 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"
  }
}
// src/.jafar.js
module.exports = {
    prompts : [
        { 
            type: 'input', 
            name: 'package.name', 
            message: 'What is your package name',
            default: 'default value'
        }
    ]
}

jafar src/ dest/

// 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"
  }
}

Current Tags

  • 1.2.0                                ...           latest (2 years ago)

4 Versions

  • 1.2.0                                ...           2 years ago
  • 1.1.0                                ...           2 years ago
  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 6
Dependencies (8)
Dev Dependencies (2)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |