2026-01-27 16:03:48 +03:00
# Template-based file generator
2026-01-26 20:31:06 +03:00
2026-01-27 16:03:48 +03:00
CLI utility for generating files and folder structures from customizable templates.
2026-01-26 20:31:06 +03:00
2026-01-27 16:03:48 +03:00
## Installation
2026-01-27 12:33:11 +03:00
2026-01-27 16:03:48 +03:00
### Quick Start with npx
2026-01-27 12:33:11 +03:00
```bash
2026-01-27 16:03:48 +03:00
npx @gromlab/create < template > < name >
2026-01-27 12:33:11 +03:00
```
2026-01-27 16:03:48 +03:00
### Global Installation (Recommended)
Global installation provides the `create` command with **autocomplete** for template names.
2026-01-27 13:07:44 +03:00
2026-01-27 16:03:48 +03:00
**1. Install:**
2026-01-27 13:07:44 +03:00
```bash
2026-01-27 16:03:48 +03:00
npm i -g @gromlab/create && create install-autocomplete
2026-01-27 15:18:43 +03:00
```
2026-01-27 16:03:48 +03:00
**2. Reload your shell:**
2026-01-27 15:18:43 +03:00
```bash
2026-01-27 16:03:48 +03:00
# macOS (zsh)
source ~/.zshrc
2026-01-27 15:18:43 +03:00
2026-01-27 16:03:48 +03:00
# Linux (bash)
source ~/.bashrc
2026-01-27 13:07:44 +03:00
2026-01-27 16:03:48 +03:00
# Linux (fish)
exec fish
```
2026-01-27 12:33:11 +03:00
2026-01-27 16:03:48 +03:00
## Usage
2026-01-26 20:31:06 +03:00
```bash
2026-01-27 16:03:48 +03:00
create < template > < name > [path] [options]
2026-01-26 20:31:06 +03:00
```
2026-01-27 16:03:48 +03:00
If `[path]` is not specified, files are created in the current directory.
2026-01-27 12:33:11 +03:00
2026-01-27 16:03:48 +03:00
## Example
2026-01-26 20:31:06 +03:00
```bash
2026-01-27 16:03:48 +03:00
# Create a component from template
2026-01-27 15:18:43 +03:00
create component Button
2026-01-26 20:31:06 +03:00
2026-01-27 16:03:48 +03:00
# Specify output folder positionally
2026-01-27 15:18:43 +03:00
create component Button src/components
2026-01-26 20:31:06 +03:00
```
2026-01-27 16:03:48 +03:00
## Templates
Templates are stored in the `.templates/` folder at the project root. Each subfolder is a separate template.
### Creating a Template
1. Create a folder in `.templates/` with the template name
2. Add files and folders using variables in names and content
3. Variables are enclosed in double curly braces: `{{variable}}`
The number of variables is unlimited — use any names you need.
2026-01-26 20:31:06 +03:00
2026-01-27 16:03:48 +03:00
### Structure
2026-01-26 20:31:06 +03:00
```
.templates/
2026-01-27 16:03:48 +03:00
├── component/
│ └── {{name.pascalCase}}/
│ ├── index.ts
│ ├── {{name.pascalCase}}.tsx
│ └── {{name.pascalCase}}.module.css
└── zustand-store/
└── {{name.camelCase}}Store/
├── index.ts
├── {{name.camelCase}}Store.ts
└── {{name.camelCase}}Store.type.ts
2026-01-26 20:31:06 +03:00
```
2026-01-27 16:03:48 +03:00
### Variables
2026-01-26 20:31:06 +03:00
2026-01-27 16:03:48 +03:00
Variables are substituted in file/folder names and file contents. You can use any variables in templates — the CLI will prompt for values for all found variables.
2026-01-26 20:31:06 +03:00
2026-01-27 16:03:48 +03:00
- `name` — required variable, set by positional argument
- Custom variables are passed via flags: `--author "John Doe"`
**Case Modifiers:**
| Syntax | Result for `myButton` |
|--------|----------------------|
| `{{name}}` | myButton |
| `{{name.pascalCase}}` | MyButton |
| `{{name.camelCase}}` | myButton |
| `{{name.kebabCase}}` | my-button |
| `{{name.snakeCase}}` | my_button |
| `{{name.screamingSnakeCase}}` | MY_BUTTON |
```bash
# Template with {{name}} and {{author}} variables
create component Button --author "John Doe"
```
### Template Content Example
```tsx
// {{name.pascalCase}}.tsx
import styles from './{{name.pascalCase}}.module.css'
export const {{name.pascalCase}} = () => {
return < div className = {styles.wrapper} > {{name.pascalCase}}< / div >
}
```
2026-01-27 12:33:11 +03:00
2026-01-27 16:03:48 +03:00
## Options
2026-01-26 20:31:06 +03:00
2026-01-27 16:03:48 +03:00
| Option | Description |
|--------|-------------|
| `--overwrite` | Overwrite existing files |
| `--skip-update` | Skip CLI update check |
| `--<variable> <value>` | Custom template variable |