pl8
The most flexible boilerplate generator in the universe
Last updated 3 years ago by bk3 .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install pl8 
SYNC missed versions from official npm registry.

pl8

PL8

The most simple boilerplate generator in the universe.

Table of Contents

About

PL8 is a boilerplate generator focusing on simplicity, ease of use and extensibility. It doesn’t care what language or file type you want to use. Java? CSS? Python? No problem! Need to create some boilerplates? PL8 makes it easy!

  • PL8 doesn't care about your tech. Java? React? SASS? It won't argue with you.
  • PL8 doesn't care if you want to use Yeoman or another generator. It will still help out.
  • PL8 uses a simple JSON configuration file, don't waste time with building custom generators.

Installation

  1. Install npm package globally: npm i -g pl8
  2. Place a pl8rc.json config file in root of project directory.
  3. Run plt or pl8 from project root to open prompt for boilerplate generation.

Demo

Preview

Documentation

Title: String

Title of PL8 configuration, acts as the initial prompt header.

{
  title: 'Boilerplates:'
}

Directory: String

Output directory for new files.

{
  directory: 'output/files'
}

Vars: Array

Static variables to replace in boilerplate templates for new files.

{
  vars: [{
    ref: 'name', // pl8 variable for replacement ... {pl8.name} = HelloWorld
    content: 'HelloWorld',
    // accepts tpl: 'path/to/tpl.ext' ... path to local template
    // accepts git: 'github.resource.url' ... url to github resource as template
  }]
}

Inputs: Array

Allow user to input custom variables for boilerplate templates.

{
  inputs: [{
    title: 'What is the component name?', // prompt message to show user
    ref: 'component', // pl8 variable for replacement ... {pl8.component} = User input value
  }]
}

Files: Array

Files to output from boilerplate templates.

{
  files: [{
    name: 'index.js', // creates index.js file
    content: 'export default {}'
  }, {
    name: '{pl8.name}.js', // pl8 variables will be replaced in all file names and directory paths
    tpl: 'templates/tpl.js', // accepts local template files
  }, {
    name: '{pl8.name}-e2e.js',
    git: 'https://github.com/pl8/pl8/blob/master/examples/templates/react-e2e.js', // accepts github resource urls for templates
  }]
}

Choices: Array

Allow users to choose between multiple boilerplate configurations.

// Object example
{
  choices: [{
    title: 'Javascript Component',
    vars: [{
      ref: 'name', // pl8 variable for replacement ... {pl8.name} = HelloWorld
      content: 'HelloWorld',
      // accepts tpl: 'path/to/tpl.ext' ... path to local template
      // accepts git: 'github.resource.url' ... url to github resource as template
    }],
    inputs: [{
      title: 'What is the component name?', // prompt message to show user
      ref: 'component', // pl8 variable for replacement ... {pl8.component} = User input value
    }],
    files: [{
      name: 'index.js', // creates index.js file
      content: 'export default {}'
    }, {
      name: '{pl8.name}.js', // pl8 variables will be replaced in all file names and directory paths
      tpl: 'templates/tpl.js', // accepts local template files
    }, {
      name: '{pl8.name}-e2e.js',
      git: 'https://github.com/pl8/pl8/blob/master/examples/templates/react-e2e.js', // accepts github resource urls for templates
    }]
  }]
}
// String example
{
  choices: [
    'path/to/config.json',
    'path/to/different/config.json',
  ],
}

Example Config

All paths and files correspond to the examples/ directory.

pl8rc.json config

// Allow user to choose config option
{
  title: 'Boilerplates:',
  directory: 'output/files', // outputs all files to this directory
  choices: [
    // string example
    'examples/configs/react-component.json',

    // object example
    {
      title: 'Javascript Component',
      vars: [{
        ref: 'name', // pl8 variable for replacement ... {pl8.name} = HelloWorld
        content: 'HelloWorld',
        // accepts tpl: 'path/to/tpl.ext' ... path to local template
        // accepts git: 'github.resource.url' ... url to github resource as template
      }],
      inputs: [{
        title: 'What is the component name?', // prompt message to show user
        ref: 'component', // pl8 variable for replacement ... {pl8.component} = User input value
      }],
      files: [{
        name: 'index.js', // creates index.js file
        content: 'export default {}'
      }, {
        name: '{pl8.name}.js', // pl8 variables will be replaced in all file names and directory paths
        tpl: 'templates/tpl.js', // accepts local template files
      }, {
        name: '{pl8.name}-e2e.js',
        git: 'https://github.com/pl8/pl8/blob/master/examples/templates/react-e2e.js', // accepts github resource urls for templates
      }]
    }
  ]
}
// Or create some files right away
{
  directory: 'output/files',
  files: [{
    name: 'README.md', // creates README.md file
    content: '# README',
  }],
}

Current Tags

  • 0.3.4                                ...           latest (3 years ago)

11 Versions

  • 0.3.4                                ...           3 years ago
  • 0.3.3                                ...           3 years ago
  • 0.3.2                                ...           3 years ago
  • 0.3.1                                ...           3 years ago
  • 0.3.0                                ...           3 years ago
  • 0.2.0                                ...           3 years ago
  • 0.1.4                                ...           3 years ago
  • 0.1.3                                ...           3 years ago
  • 0.1.2                                ...           3 years ago
  • 0.1.1                                ...           3 years ago
  • 0.1.0                                ...           3 years ago
Maintainers (2)
Downloads
Today 0
This Week 0
This Month 11
Last Day 0
Last Week 0
Last Month 0
Dependencies (7)
Dev Dependencies (7)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |