CBWIRE CLI
Michael Rigsby has created a CommandBox CLI tool for CBWIRE that rapidly scaffolds components, templates, and boilerplate code. The CLI supports both standard components and single-file components with extensive customization options.
Install the CBWIRE CLI from ForgeBox.
Installation
Install via CommandBox like so:
box install cbwire-cliBasic Usage
Create a simple component:
cbwire create wire myComponentCreate a component with data properties and actions:
cbwire create wire name="userProfile" dataProps="name,email,isActive" actions="save,cancel" --openConfiguration Options
Component Structure
name
String
Component name without extensions. Use @module to place in a module's wires directory
singleFileWire
Boolean
Creates a single-file component combining template and logic
outerElement
String
Template outer element type. Defaults to "div"
description
String
Component hint description
Data Properties
dataProps
String
Comma-delimited list of data property keys to generate
lockedDataProps
String
Comma-delimited list of data properties to lock from client modifications
Component Behavior
actions
String
Comma-delimited list of action methods to generate
lifeCycleEvents
String
Lifecycle event methods to generate (onRender, onHydrate, onMount, onUpdate)
onHydrateProps
String
Properties to create onHydrate property methods for
onUpdateProps
String
Properties to create onUpdate property methods for
includePlaceholder
Boolean
Inserts placeholder action for lazy loading components
JavaScript Integration
jsWireRef
Boolean
Includes livewire:init & component.init hooks with window._{name} = $wire reference using the name provided in name argument
File Management
wiresDirectory
String
Custom directory for wires. Defaults to standard wires directory
appMapping
String
Application root location in web root (e.g., MyApp/)
open
Boolean
Opens generated component and template files
force
Boolean
Overwrites existing files
Advanced Examples
Module Component
Create a component in a specific module:
cbwire create wire name="dashboard@AdminModule" dataProps="stats,alerts" actions="refreshData"Full-Featured Component
Generate a component with comprehensive features:
cbwire create wire name="userManager" \
dataProps="users,selectedUser,searchTerm" \
lockedDataProps="selectedUser" \
actions="loadUsers,selectUser,deleteUser" \
lifeCycleEvents="onMount,onUpdate" \
onUpdateProps="searchTerm" \
description="User management component" \
--jsWireRef --openSingle-File Component
Create a single-file component with all features:
cbwire create wire name="taskList" \
dataProps="tasks,newTask,filter" \
lockedDataProps="tasks" \
actions="addTask,toggleTask,removeTask" \
outerElement="section" \
lifeCycleEvents="onMount,onRender" \
--singleFileWire --jsWireRef --openLazy Loading Component
Generate a component optimized for lazy loading:
cbwire create wire name="heavyChart" \
dataProps="chartData,isLoaded" \
actions="loadChart" \
--includePlaceholder --openLast updated
Was this helpful?