A super-simple way to create new projects based on templates.
Inspired by Khaos, but with a better CLI, schemas and a more up-to-date code.
npm install -g @fabiospampinato/template
- Template: What's a template and how to make one.
- Schema: What's a schema and how to use it to improve your templates.
- CLI: List of provided commands and how to use them.
First of all you've got to install a template, for example let's install fabiospampinato/template-typescript-package as the
template install fabiospampinato/template-typescript-package typescript-package
Now you should have that downloaded locally under your
~/.template directory. You may also put templates there manually, if you don't feel like creating a public repository for them.
It's time to use the newly installed template to create a new project called
template create typescript-package my-package
Now it will ask you to provide values for the placeholders found inside the template:
name: my-package description: This is a description version: 1.0.0 author: Fabio Spampinato owner: fabiospampinato email: email@example.com scoped: No
And that's it, inside the
my-package directory you'll have everything you need to get you started.
How it works
This program simply takes a folder containing some files as input, parses those files using handlebars, and then just outputs them to your desired folder. The file structure inside the template is left untouched.
Read more about templates here.
MIT © Fabio Spampinato