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
- Install npm package globally:
npm i -g pl8
- Place a
pl8rc.json
config file in root of project directory. - Run
plt
orpl8
from project root to open prompt for boilerplate generation.
Demo
Documentation
String
Title: Title of PL8 configuration, acts as the initial prompt header.
title: 'Boilerplates:'
String
Directory: Output directory for new files.
directory: 'output/files'
Array
Vars: Static variables to replace in boilerplate templates for new files.
vars:ref: 'name' // pl8 variable for replacement ... {pl8.name} = HelloWorldcontent: 'HelloWorld'// accepts tpl: 'path/to/tpl.ext' ... path to local template// accepts git: 'github.resource.url' ... url to github resource as template
Array
Inputs: Allow user to input custom variables for boilerplate templates.
inputs:title: 'What is the component name?' // prompt message to show userref: 'component' // pl8 variable for replacement ... {pl8.component} = User input value
Array
Files: Files to output from boilerplate templates.
files:name: 'index.js' // creates index.js filecontent: 'export default {}'name: '{pl8.name}.js' // pl8 variables will be replaced in all file names and directory pathstpl: 'templates/tpl.js' // accepts local template filesname: '{pl8.name}-e2e.js'git: 'https://github.com/pl8/pl8/blob/master/examples/templates/react-e2e.js' // accepts github resource urls for templates
Array
Choices: Allow users to choose between multiple boilerplate configurations.
// Object examplechoices:title: 'Javascript Component'vars:ref: 'name' // pl8 variable for replacement ... {pl8.name} = HelloWorldcontent: 'HelloWorld'// accepts tpl: 'path/to/tpl.ext' ... path to local template// accepts git: 'github.resource.url' ... url to github resource as templateinputs:title: 'What is the component name?' // prompt message to show userref: 'component' // pl8 variable for replacement ... {pl8.component} = User input valuefiles:name: 'index.js' // creates index.js filecontent: 'export default {}'name: '{pl8.name}.js' // pl8 variables will be replaced in all file names and directory pathstpl: 'templates/tpl.js' // accepts local template filesname: '{pl8.name}-e2e.js'git: 'https://github.com/pl8/pl8/blob/master/examples/templates/react-e2e.js' // accepts github resource urls for templates
// String examplechoices:'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 optiontitle: 'Boilerplates:'directory: 'output/files' // outputs all files to this directorychoices:// string example'examples/configs/react-component.json'// object exampletitle: 'Javascript Component'vars:ref: 'name' // pl8 variable for replacement ... {pl8.name} = HelloWorldcontent: 'HelloWorld'// accepts tpl: 'path/to/tpl.ext' ... path to local template// accepts git: 'github.resource.url' ... url to github resource as templateinputs:title: 'What is the component name?' // prompt message to show userref: 'component' // pl8 variable for replacement ... {pl8.component} = User input valuefiles:name: 'index.js' // creates index.js filecontent: 'export default {}'name: '{pl8.name}.js' // pl8 variables will be replaced in all file names and directory pathstpl: 'templates/tpl.js' // accepts local template filesname: '{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 awaydirectory: 'output/files'files:name: 'README.md' // creates README.md filecontent: '# README'