CRAT is a dead-simple way to jumpstart projects, using CRA and a little bit of Ruby under the hood. You simply init a template, customize the configuration, and add some static files. It's not revolutionary, it just makes the life of a developer a little bit easier.
Simply clone the repo, cd into the project folder and run:
./install.sh
You'll need Ruby v2.4 or above and npm version 10 or above.
Basic usage: crat -n [project name] -t [template name]
List All Templates: crat -l
Create New Template: crat -c
CRAT stores templates (and everything else) in ~/.crat
. When you run crat -l
, it reads the
available template folders in ~/.crat/templates/
. When you create a new template with crat -c
, it creates the necessary template config file, template.json
, with some boilerplate and sets up the static
folder for static assets.
Example output of crat -l
:
There's not much to it. Run the create command and then migrate to your template directory. Inside, you'll find a template JSON file with some familiar fields:
{
"name": "New App",
"description": "",
"dependencies": {
"axios": "latest"
},
"folders": [
{
"path": "src/css"
}
]
}
Feel free to get rid of the fields in dependencies
and folders
and replace them with your own values. Here's a brief explanation of how to set these fields appropriately:
- Name: This is set automatically based on the terminal input from the creation step.
- Description: Mostly for your own tracking, this is used when listing the templates.
- Dependencies: This is an object holding the dependency names for any additional packages you'd like to include in your project. That is to say, they are in addition to what CRA automatically includes. Accepts the same values as a package.json file.
- Folders: Create an entry for the last folder in every path you'd like to create. For example, if you want
layouts/
andlayouts/dashboard
, you only need an entry forlayouts/dashboard
because the full path will be created. Note: the paths should be relative to the project root, not the src directory
Checkout the templates
folder for an example template.
This project is licensed under the MIT License.
Feel free to fork and contribute!