Build and Run
Running Projects
Within a project directory, the run
command will invoke mcconfig
to generate the make
file based on the manifest.json
followed by building and running the project in the current environment simulator:
When not in the project directory, a path can be passed to run
:
Moddable examples
Use the --example
flag to run a project included with the Moddable SDK:
The --list-examples
provides a searchable list of available example projects:
Select a device target
The --device
flag allows for selecting a supported device or simulator target:
To dynamically select the device, use the --list-devices
flag:
This can be used in tandem with the --example
or --list-examples
flags to run an example project on a connected device:
Select a port address
The --port
flag accepts a path to port for connected device (defaults to: UPLOAD_PORT
environment variable):
This value can be discovered using the scan
command.
Display debugger output in the terminal
Use the --log
flag to display debug output in the terminal instead of opening the xsbug app:
This will still open the “mcsim” simulator app when running locally.
Set mc/config
arguments
Use the --config
flag to provide config arguments to the mc/config
module. This mechanism is often used to configure Wi-Fi credentials when running on a device:
Building projects for release
Within a project directory, the build
command takes the same flags as the run
command to invoke mcconfig
to generate the make
file based on the manifest.json
followed by only building the project for the target device:
The build --mode
can be set to production
for the optimized release code or development
for the debug-enabled release code. This will default to the NODE_ENV
environment variable or development
if that variable is not set.
The output directory can also be set using the --output
flag, overriding the default path of $MODDABLE/build
, where $MODDABLE
is the location of the Moddable tooling repo on your local filesystem.
If you want to immediately deploy the release build, use the --deploy
flag: