4 releases
Uses new Rust 2024
| 0.1.3 | Dec 30, 2025 |
|---|---|
| 0.1.2 | Dec 30, 2025 |
| 0.1.1 | Dec 29, 2025 |
| 0.1.0 | Dec 29, 2025 |
#180 in Template engine
60KB
1.5K
SLoC
Scaffy
A convenient project template scaffolding TUI.
Installation
cargo install scaffy
Usage
Just run scaffy in any directory, you can choose any template and where to clone it within the TUI. Keyboard navigation instructions are provided at the bottom of the TUI.
Searchbar
The searchbar considers strictly spelled case-insensitive queries separated by spaces, which are each filtered through every template to see if their name, description, or tags contain it.
Making a Template
1. Add information to /templates/templates.json
Every template should be a subdirectory of /templates and have a corresponding entry within templates/templates.json.
templates.json contains an array of objects with the following entries (all required):
| Key | Value Type | Value Description |
|---|---|---|
| name | string | A display name; serves as the header for the TUI list entry |
| path | string | The name of the template folder in /templates. This should be unique from any other template. Do not include a leading slash. |
| author | string | The author's Github username, preferably |
| description | string | A concise description about the template's contents. Try to make this less than 100 characters, as extraneous characters are cut off in the TUI. |
| tags |
|
This holds the tags associated with the template. Each tag category holds a record instead of an array in order to have an associated version string, with null being an unspecified vesion. |
2. Make Template
Add the files/folders of the template to /templates/<path specified in templates.json>. Make sure that when you're done, there shouldn't be any unnecessary files (such as node_modules or package_lock.json for node.js, but they should be in the .gitignore).
Project Info Replacement Strings
The user can provide a project name in the initialization stage, which can be used in any template file as needed. Just insert the following strings at where the project name should be:
Replacement strings chart
| Replacement String | Resulting Inserted Project Name (assuming user entered Project name example) |
|---|---|
| @@SCAFFY_PROJECT_NAME@@ | Project name example |
| @@SCAFFY_PROJECT_NAME_TITLECASE@@ | Project Name Example |
| @@SCAFFY_PROJECT_NAME_UPPERCASE@@ | PROJECT NAME EXAMPLE |
| @@SCAFFY_PROJECT_NAME_LOWERCASE@@ | project name example |
| @@SCAFFY_PROJECT_NAME_SNAKECASE@@ | Project_name_example |
| @@SCAFFY_PROJECT_NAME_LOWERSNAKECASE@@ | project_name_example |
| @@SCAFFY_PROJECT_NAME_UPPERSNAKECASE@@ | PROJECT_NAME_EXAMPLE |
| @@SCAFFY_PROJECT_NAME_LOWERCAMELCASE@@ | projectNameExample |
| @@SCAFFY_PROJECT_NAME_UPPERCAMELCASE@@ | ProjectNameExample |
| @@SCAFFY_PROJECT_NAME_KEBABCASE@@ | Project-name-example |
| @@SCAFFY_PROJECT_NAME_LOWERKEBABCASE@@ | project-name-example |
| @@SCAFFY_PROJECT_NAME_UPPERKEBABCASE@@ | PROJECT-NAME-EXAMPLE |
3. Generate associated files
After making a template, run node scripts/gen-paths.js in order to generate an associated file in templates/__scaffy_template_contents. This file is currently neccesary for each template, but this requirement may eventually be unneccesary.
Dependencies
~22–39MB
~553K SLoC