Skip to content

pnarielwala/template-files-generator

Repository files navigation

template-files-generator

Tool to make it easy to create file/code templates and generate them for any given target directory with a config file and templates directory.

Installation

Install package globally

$ yarn global add template-files-generator

OR

$ yarn add template-files-generator -D

Usage

$ yarn tfg

// OR

$ npx template-files-generator

Configuration

tfgconfig.json

{
  "templates": {
    "custom-component": {
      "name": "My Custom Component",
      "directory": "./templates/custom-component",
      "variables": {
        "componentName": {
          "prompt": "Component name?"
        }
      }
    },
    "simple-component": {
      "name": "Simple Component",
      "directory": "./internal/templates/custom-component",
      "variables": {
        "componentName": {
          "prompt": "Component name?",
          "defaultCase": "camel"
        }
      }
    }
  }
}

Inspriation

Partially inspired by the generate-template-files tool, but was looking for a simpler approach without having to write much configuration in javascript. But check out generate-template-files for a more robust and configurable template file generator!