docs: добавлен английский README, обновлены заголовки документации

This commit is contained in:
2026-01-27 16:03:48 +03:00
parent b53248e134
commit 9ab9dd005d
3 changed files with 204 additions and 50 deletions

131
README.md
View File

@@ -1,84 +1,119 @@
# @gromlab/create # Template-based file generator
CLI-утилита для генерации файлов из шаблонов. CLI utility for generating files and folder structures from customizable templates.
## Установка ## Installation
Глобально: ### Quick Start with npx
```bash ```bash
npm i -g @gromlab/create npx @gromlab/create <template> <name>
```
При запуске CLI проверяет доступность новой версии. Если вы выбираете «нет»,
повторный запрос появится через 24 часа. Чтобы пропустить проверку, используйте
флаг `--skip-update`.
## Автодополнение
Установка вместе с автодополнением (одной командой):
**bash**
```bash
npm i -g @gromlab/create && create install-autocomplete --shell bash && source ~/.bashrc
``` ```
**zsh** ### Global Installation (Recommended)
Global installation provides the `create` command with **autocomplete** for template names.
**1. Install:**
```bash ```bash
npm i -g @gromlab/create && create install-autocomplete --shell zsh && source ~/.zshrc npm i -g @gromlab/create && create install-autocomplete
``` ```
**fish** **2. Reload your shell:**
```bash ```bash
npm i -g @gromlab/create && create install-autocomplete --shell fish && exec fish # macOS (zsh)
source ~/.zshrc
# Linux (bash)
source ~/.bashrc
# Linux (fish)
exec fish
``` ```
## Usage
## Использование
```bash ```bash
create <шаблон> <имя> [путь] [опции] create <template> <name> [path] [options]
``` ```
Если `[путь]` не указан, файлы создаются в директории, где запущен CLI. If `[path]` is not specified, files are created in the current directory.
## Пример ## Example
```bash ```bash
# Создать компонент из шаблона # Create a component from template
create component Button create component Button
# Указать папку вывода позиционно # Specify output folder positionally
create component Button src/components create component Button src/components
``` ```
## Шаблоны ## Templates
Шаблоны хранятся в папке `.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.
### Structure
``` ```
.templates/ .templates/
── component/ ── component/
── {{name.pascal}}/ ── {{name.pascalCase}}/
│ ├── index.ts │ ├── index.ts
├── {{name.pascal}}.tsx ├── {{name.pascalCase}}.tsx
└── {{name.pascal}}.module.css └── {{name.pascalCase}}.module.css
└── zustand-store/
└── {{name.camelCase}}Store/
├── index.ts
├── {{name.camelCase}}Store.ts
└── {{name.camelCase}}Store.type.ts
``` ```
### Переменные ### Variables
В именах файлов и содержимом доступны переменные: 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.
- `{{name}}` — исходное значение
- `{{name.pascal}}` — PascalCase
- `{{name.camel}}` — camelCase
- `{{name.kebab}}` — kebab-case
- `{{name.snake}}` — snake_case
Переменная `name` задается только позиционным аргументом `<имя>`. Использование `--name` запрещено. - `name` — required variable, set by positional argument
- Custom variables are passed via flags: `--author "John Doe"`
## Опции **Case Modifiers:**
| Опция | Описание | | Syntax | Result for `myButton` |
|-------|----------| |--------|----------------------|
| `--overwrite` | Перезаписать существующие файлы | | `{{name}}` | myButton |
| `--skip-update` | Не проверять обновления CLI | | `{{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>
}
```
## Options
| Option | Description |
|--------|-------------|
| `--overwrite` | Overwrite existing files |
| `--skip-update` | Skip CLI update check |
| `--<variable> <value>` | Custom template variable |

119
README_RU.md Normal file
View File

@@ -0,0 +1,119 @@
# Генератор файлов из шаблонов
CLI-утилита для генерации файлов и структуры папок из настраиваемых шаблонов.
## Установка
### Быстрый запуск через npx
```bash
npx @gromlab/create <шаблон> <имя>
```
### Глобальная установка ( Рекомендуется )
При глобальной установке доступна команда `create` с **автодополнением** имен шаблонов.
**1. Установка:**
```bash
npm i -g @gromlab/create && create install-autocomplete
```
**2. Перезагрузка оболочки:**
```bash
# macOS (zsh)
source ~/.zshrc
# Linux (bash)
source ~/.bashrc
# Linux (fish)
exec fish
```
## Использование
```bash
create <шаблон> <имя> [путь] [опции]
```
Если `[путь]` не указан, файлы создаются в директории, где запущен CLI.
## Пример
```bash
# Создать компонент из шаблона
create component Button
# Указать папку вывода позиционно
create component Button src/components
```
## Шаблоны
Шаблоны хранятся в папке `.templates/` в корне проекта. Каждая подпапка — отдельный шаблон.
### Создание шаблона
1. Создайте папку в `.templates/` с именем шаблона
2. Добавьте файлы и папки, используя переменные в именах и содержимом
3. Переменные заключаются в двойные фигурные скобки: `{{переменная}}`
Количество переменных не ограничено — используйте любые имена.
### Структура
```
.templates/
├── 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
```
### Переменные
Переменные подставляются в имена файлов/папок и в содержимое файлов. В шаблоне можно использовать любые переменные — при генерации CLI потребует значения для всех найденных.
- `name` — обязательная переменная, задается позиционным аргументом
- Произвольные переменные передаются через флаги: `--author "John Doe"`
**Модификаторы регистра:**
| Синтаксис | Результат для `myButton` |
|-----------|--------------------------|
| `{{name}}` | myButton |
| `{{name.pascalCase}}` | MyButton |
| `{{name.camelCase}}` | myButton |
| `{{name.kebabCase}}` | my-button |
| `{{name.snakeCase}}` | my_button |
| `{{name.screamingSnakeCase}}` | MY_BUTTON |
```bash
# Шаблон с переменными {{name}} и {{author}}
create component Button --author "John Doe"
```
### Пример содержимого шаблона
```tsx
// {{name.pascalCase}}.tsx
import styles from './{{name.pascalCase}}.module.css'
export const {{name.pascalCase}} = () => {
return <div className={styles.wrapper}>{{name.pascalCase}}</div>
}
```
## Опции
| Опция | Описание |
|-------|----------|
| `--overwrite` | Перезаписать существующие файлы |
| `--skip-update` | Не проверять обновления CLI |
| `--<переменная> <значение>` | Произвольная переменная шаблона |

View File

@@ -1,6 +1,6 @@
{ {
"name": "@gromlab/create", "name": "@gromlab/create",
"version": "0.1.4", "version": "0.1.6",
"description": "Template-based file generator CLI", "description": "Template-based file generator CLI",
"license": "MIT", "license": "MIT",
"publishConfig": { "publishConfig": {