CBWIRE CLI
Michael Risby has created a CommandBox CLI for CBWIRE that you can use to quickly scaffold out CBWIRE components. You can find the CBWIRE CLI on ForgeBox.
Installation
Install via CommandBox like so:
box install cbwire-cli
Command Line Arguments
name
String
Name of the wire to create without extensions. Use @module
to place in a module's wires directory.
dataProps
String
A comma-delimited list of data property keys to add.
lockedDataProps
String
A comma-delimited list of data property keys to lock.
actions
String
A comma-delimited list of actions to generate.
outerElement
String
The outer element type to use for the wire. Defaults to "div"
.
jsWireRef
Boolean
If true
, includes livewire:init
& component.init
hooks and assigns a reference as window.wirename = $wire
.
lifeCycleEvents
String
A comma-delimited list of lifecycle event names to generate. If none provided, only onMount()
will be generated but commented out.
onHydrateProps
String
A comma-delimited list of properties to create onHydrate()
property methods for in the wire.
onUpdateProps
String
A comma-delimited list of properties to create onUpdate()
property methods for in the wire.
wiresDirectory
String
The directory where your wires are stored. Defaults to the standard wires directory.
appMapping
String
The root location of the application in the web root (e.g., MyApp/
) or leave blank if in the root.
description
String
The wire component's hint description.
open
Boolean
If true
, opens the wire component & template once generated.
force
Boolean
If true
, forces overwrite of existing wires.
singleFileWire
Boolean
If true
, creates a single file wire.
includePlaceholder
Boolean
If true
, inserts a placeholder action in the wire component for lazy loading wires.
Examples
Super Basic Example
cbwire create wire myWireName
Basic Example
cbwire create wire name="myWireName" dataProps="counter1,counter2,counter3" actions="saveSomething,doSomething,GetSomething" --jsWireRef --open
Basic Example with module name using myWireName@MyModuleName
cbwire create wire name="myWireName@MyModuleName" dataProps="counter1,counter2,counter3" actions="saveSomething,doSomething,GetSomething" --jsWireRef --open
Many options (WITHOUT singleFileWire)
cbwire create wire name="myWireName" dataProps="counter1,counter2,counter3" lockedDataProps="counter2,counter3" actions="saveSomething,doSomething,GetSomething" outerElement="p" lifeCycleEvents="onRender,onHydrate,onMount,onUpdate" onHydrateProps="counter2,counter3" onUpdateProps="counter1,counter2" description="This is my wire description" --jsWireRef --open --force
Many options (WITH singleFileWire)
cbwire create wire name="myWireName" dataProps="counter1,counter2,counter3" lockedDataProps="counter2,counter3" actions="saveSomething,doSomething,GetSomething" outerElement="p" lifeCycleEvents="onRender,onHydrate,onMount,onUpdate" onHydrateProps="counter2,counter3" onUpdateProps="counter1,counter2" description="This is my wire description" --jsWireRef --open --force --singleFileWire
Last updated
Was this helpful?