cli-rtg-generator
v1.0.2
Published
CLI tool to generate React components and TypeScript types.
Downloads
8
Maintainers
Readme
📦 rtg-cli-generator
A lightweight CLI to generate React components, TypeScript types, and constants in your src/ directory — with nested path support and short Angular-style commands.
🚀 Features
- ✅ Generate functional React components (
.tsx) insrc/ - ✅ Generate types in
src/types/and constants insrc/constants/ - ✅ Auto-creates missing folders
- ✅ Supports nested paths like
ui/Button - ✅ Supports short aliases:
g c,g t,g const - ✅ Automatically opens the created file in VS Code
📦 Installation
npm install -g cli-rtg-generator✨ Usage
🧱 Full Commands
rtg create-component components/MyCard
rtg create-type models/User
rtg create-constants config/theme⚡ Short Commands (Angular Style)
rtg g c components/MyCard # Create component
rtg g t models/User # Create type
rtg g const config/theme # Create constant📁 Output Example
| Command | Output Path |
|--------|--------------|
| rtg g c Button | src/Button.tsx |
| rtg g c ui/Card | src/ui/Card.tsx |
| rtg g t User | src/types/User.ts |
| rtg g t models/User | src/types/models/User.ts |
| rtg g const app | src/constants/app.ts |
| rtg g const config/theme | src/constants/config/theme.ts |
🛠 Notes
codeCLI must be available in your system PATH for file auto-open to work.- All files are created relative to
src/to keep your project clean and organized.
👨💻 Author
Created with ❤️ by Jaymin
MIT © jaymin shiroya
