wakeb-starter-cli
v2.0.1
Published
A powerful CLI tool for generating CRUD modules, common modules, and components with Vue 3 form schemas, featuring intelligent field detection and automatic schema generation
Downloads
55
Maintainers
Readme
Wakeb CLI 🚀
A powerful Vue 3 development tool for rapid CRUD module generation, component management, and project scaffolding.
Features
- 🔧 CRUD Generation: Auto-generate complete CRUD modules with forms, views, and routing
- 📝 Smart Schema Generation: Parse payload formats to auto-generate form schemas
- 🧩 Component Management: Add and manage reusable components
- 📦 Module System: Organize your Vue 3 project with modular architecture
- 🎨 Template Support: Modal and Pages layout templates
- 🚀 Auto-routing: Automatic router configuration
- 📱 Sidebar Integration: Auto-update navigation sidebar
- 🔄 Interactive CLI: User-friendly prompts and choices
Installation
Global Installation
npm install -g wakeb-cliLocal Installation
npm install --save-dev wakeb-cliUsage
Quick Start
wbAvailable Commands
| Command | Description |
| ------------------ | ------------------------------------------ |
| wb create | Create a new CRUD module with form schemas |
| wb add:module | Add a common reusable module |
| wb add:component | Add a common component |
| wb help | Show help message |
Commands in Detail
1. Create CRUD Module
wb createWhat it does:
- Creates complete CRUD functionality (Create, Read, Update, Delete)
- Generates form schemas from payload data
- Sets up routing automatically
- Integrates with sidebar navigation
- Supports both Modal and Pages layouts
Interactive Process:
- Module Name: Enter module name (e.g.,
user,product) - Multiple CRUDs: Choose if module has multiple CRUD operations
- Layout Type: Select between Modal or Pages layout
- Help Models: Specify related models (comma-separated)
- Help Enums: Specify enums (comma-separated)
- Schema Generation: Auto-generate form schema from payload
- Sidebar Integration: Add to navigation sidebar
Example:
wb create
# Follow prompts:
# Module name: users
# Layout: Modal
# Help models: roles, departments
# Help enums: status, priority2. Add Module
wb add:moduleWhat it does:
- Adds pre-built common modules
- Shows available vs installed modules
- Supports batch selection
- Handles overwrite confirmation
Features:
- ✅ Shows installed modules
- ⬜ Shows available modules
- 📦 Checkbox selection interface
- ⚠️ Overwrite protection
3. Add Component
wb add:componentWhat it does:
- Adds reusable Vue components
- Supports folder structure navigation
- Batch component selection
- Smart conflict resolution
Features:
- 🧩 Component browser
- 📁 Folder navigation
- ✅ Bulk selection
- 🔄 Overwrite handling
Project Structure
Wakeb CLI expects and creates the following structure:
src/
├── modules/
│ ├── users/
│ │ ├── views/
│ │ │ ├── Users.vue
│ │ │ └── UserForm.vue
│ │ ├── schema/
│ │ │ └── users.js
│ │ └── router/
│ │ └── index.js
│ └── products/
│ └── ...
├── components/
│ └── common/
│ ├── forms/
│ ├── tables/
│ └── ...
└── data/
└── sidebarLinks.jsSchema Generation
Payload Format Support
The CLI can parse various payload formats and generate form schemas:
// Input payload format
user.name: John Doe
user.email: [email protected]
user.age: 30
user.active: true
user.role_id: select
user.created_at: 2023-05-20
user.login_time: 14:30Generated Schema
export const userSchema = {
"user.name": "text",
"user.email": "text",
"user.age": "number",
"user.active": "checkbox",
"user.role_id": "select",
"user.created_at": "date",
"user.login_time": "time",
};Supported Field Types
text- Text inputtextarea- Multi-line textselect- Dropdown selectioncheckbox- Boolean checkboxradio- Radio buttonsnumber- Number inputdate- Date pickertime- Time pickerpassword- Password inputphone- Phone numberemail- Email inputfile- File uploadimage- Image uploadeditor- Rich text editorotp- One-time passwordcaptcha- Captcha field
Configuration
String Utilities
The CLI includes powerful string transformation utilities:
import { toKebabCase, toCamelCase, toSnakeCase } from "./stringUtils.js";
// Examples
toKebabCase("UserProfile"); // → 'user-profile'
toCamelCase("user-profile"); // → 'userProfile'
toSnakeCase("UserProfile"); // → 'user_profile'Template System
- Modal Layout: Popup-based CRUD operations
- Pages Layout: Full-page CRUD operations
- Placeholder System: Dynamic content replacement
- Component Templates: Reusable UI components
Advanced Features
Auto-routing
Automatically updates router/index.js with new routes:
{
path: "/users",
name: "users",
component: () => import("@/modules/users/views/Users.vue"),
meta: {
is_searchable: true,
name: "users",
},
}Sidebar Integration
Auto-updates sidebarLinks.js with navigation:
{
to: "/users",
name: "sidebar.users",
permissions: "*",
hipath: "icons.users",
}Help Models & Enums
Support for related data:
// Auto-generated in components
const tables = ["roles", "departments"];
const enums = ["status", "priority"];
await Promise.all([
enumsStore.getHelpEnums(enums),
enumsStore.getHelpModels(tables),
]);Examples
Creating a User Management Module
wb create
# Module name: users
# Multiple CRUDs: No
# Layout: Modal
# Help models: roles, departments
# Help enums: status
# Schema: Yes
# Sidebar: Yes
# Icon: usersAdding Authentication Components
wb add:component
# Select: 📁 auth
# Choose: LoginForm, RegisterForm, ForgotPasswordBulk Module Installation
wb add:module
# Select multiple modules:
# ✅ authentication
# ⬜ file-manager
# ⬜ notificationsBest Practices
- Module Naming: Use singular names (
user, notusers) - Schema First: Always define schema before creating views
- Help Models: Define related models for better UX
- Consistent Icons: Use consistent icon naming
- Template Reuse: Leverage existing templates
Troubleshooting
Common Issues
Module already exists
- Use the overwrite option or choose different name
Invalid router format
- Check
router/index.jssyntax - Ensure proper export format
Schema generation fails
- Verify payload format
- Check field type mappings
Component conflicts
- Use selective installation
- Handle overwrite prompts
Contributing
- Fork the repository
- Create feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open Pull Request
License
MIT License - see LICENSE file for details
Support
- 📧 Email: [email protected]
- 🐛 Issues: GitHub Issues
- 📚 Docs: Documentation
Made with ❤️ by the Wakeb Team
