Templates CLI
Init
tps init
Initialize local settings
Options:
--version Show version number [boolean]
--verbose, -v More in-depth logging [boolean] [default: false]
--help Show help [boolean]
--force, -f Initialize tps in cwd no matter what [boolean]
--global, -g Initialize tps globally [boolean]
Initialize your repo as a tps repo. This will allow you to set tps template
settings and build templates for your repo. This command will create a .tps
folder and a .tpsrc
file inside of it.
| - .tps/
| - .tpsrc
Tps will throw an error if you try to initialize a child directory when a parent directory is already initialized. If you would like to do this anyways see forcing a repo.
Initializing a repo
First navigate into the directory that you wish to initialize local settings.
cd some/path/to/repo
Initialize template settings
tps init
Initializing tps globally
use the --global
flag when you want tps to be initialized globally. This will
place the .tps
folder and .tpsrc
file in your home directory
tps init --global
Forcing a repo
use the force flag when you want a repo to be initialized but a parent directory is already initialized
tps init --force
List
tps list
Show all available templates
Options:
--version Show version number [boolean]
--verbose, -v More in-depth logging [boolean] [default: false]
--help Show help [boolean]
--global, -g List out global files [boolean] [default: true]
--local, -l List out global files [boolean] [default: true]
List all available templates that you can use. local
refers to local
templates, which are templates available in your current working directory
(cwd). global
stands for global templates, accessible from anywhere on your
system.
Example
> tps list
Global:
- react-component
Local:
- new-test
- new-api
Copy
cli copy <template>
Copy a template
Options:
--version Show version number [boolean]
--verbose, -v More in-depth logging [boolean] [default: false]
--help Show help [boolean]
Copy a template to your local tps directory. Files can then be changed to fit users needs.
Useful when you like the template but want to add additional features or make a few modifications
Example
Copy Templates default react-component
.
> tps copy react-component
Produces:
| - <cwd>
| - .tps/
| - react-component/
| - <all packages and files from react-component template>
Create
tps [use] [buildPaths...]
render a new instance from a template
Options:
--version Show version number [boolean]
--verbose, -v More in-depth logging [boolean] [default: false]
--help Show help [boolean]
--use, -u Template package to create your with [string]
--packages, -p Additional Packages to use when building your template[array]
--default, -d Use all default answers to all prompts [boolean]
--newFolder, -f Create a new folder [boolean] [default: true]
--force force the template to be made. This will override any files
that tps needs to create [boolean]
--wipe force the template to be made. This will delete the directory
if exists [boolean]
Render a new instance of a template.
Checkout out the Template Options API for more information about template options
Single build path
tps react-component Nav
Long build path
tps react-component components/Nav
Multiple build paths
tps react-component components/Nav components/Button pages/Home
new
new template
tps new template <template>
create a new template
Options:
--version Show version number [boolean]
--verbose, -v More in-depth logging [boolean] [default: false]
--help Show help [boolean]
Example
tps new template react-component
Produces:
| - .tps
| - react-component/
| - default/
| - settings.json
new package
tps new package <template> <package>
create a new package in a template
Options:
--version Show version number [boolean]
--verbose, -v More in-depth logging [boolean] [default: false]
--help Show help [boolean]
Example
tps new package react-component css
Produces:
| - .tps
| - react-component/
| - css/
| - default/
| - <other files or directories...>