Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript. Learn more »

broken-record

1.0.8 • Public • Published

Broken Record

NPM version Build Status JavaScript Style Guide

A Handlebars powered CLI tool for defining file and directory structure templates.

Repeatably setting up new projects the same way can be annoying.

Broken Record allows you to define templates which can then be invoked and filled out in hassle-free way.

Install

Install with npm:

$ npm i broken-record -g

Usage

Show help information:

$ broken-record -h
 
Usage: broken-record [options] [command]
 
  Options:
 
    -V, --version         output the version number
    -h, --help            output usage information
 
  Commands:
 
    config [dir]          Displays or sets the templates directory
    register <dir>        Registers a template at a specified directory
    list                  Lists the available templates
    remove <name>         Removes a registered template
    get [options] <name>  Retrieves a registered template
    show [name]           Opens the templates directory or a template in the file explorer
 
  Template Specification:
 
    Directory Structure:
      <template-name>
          ├── template <-- template files directory
          └── template.json
 
    template.json:
      {
        "options": [
          {
            "name""<variable-name>"<-- required
            "message""<displayed-message>"<-- value of "name" used by default,
            "value""<default-value-or-choices-array>" <-- default value can be boolean
          },
          ...
        ],
        "embed"{
          "<template-name>"{
            "directory""<path-relative-to-template-dir>"<-- required
            "options"{
              "<option1>""<handlebars-template>",
              ...
            }
          },
          ...
        }
      }

Set the templates directory location:

$ broken-record config
Looks like this is your first time running this command!
? Where should the 'templates' directory be created? path/to/some/dir
path/to/some/dir

Try out an example:

$ git clone https://github.com/TomerAberbach/broken-record-templates.git
cd broken-record-templates
$ broken-record register mit
The provided template was successfully registered.
$ broken-record register js-npm-module
The provided template was successfully registered.
$ broken-record get js-npm-module

Related projects

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Running Tests

Install dev dependencies:

$ npm i -d && npm test

Author

Tomer Aberbach

License

Copyright © 2018 Tomer Aberbach Released under the MIT license.

install

npm i broken-record

Downloadsweekly downloads

9

version

1.0.8

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability