Skip to main content

CLI

The @modbros/dashboard-cli creates, runs and publishes widget packs. Install it globally using npm:

npm install --global @modbros/dashboard-cli

List all commands with dashboard-cli --help, and the options of a command with dashboard-cli [command] --help.

Commands​

All commands except generate operate on the widget pack in the current directory.

CommandDescription
generate <name>Creates a new widget pack project named <name> from the skeleton.
devRegisters the widget pack with the local MoBro and rebuilds it on every change, see Run and Test Locally.
bundleBundles the widget pack into dist/<name>_<version>.zip without publishing it.
publishBundles the widget pack and publishes it as a new version, see Publish and Install.
publish --updateReplaces the content of an already published version.
publish --unpublish-onlyRemoves the widget pack from the marketplace, so users can no longer find and install it.
publish --publish-onlyPublishes a previously unpublished widget pack again, without uploading a new version.
versionsLists all versions of the widget pack in the marketplace.
delete-version --version <version>Deletes a version of the widget pack from the marketplace.
update-infoUpdates the listing information from the mobro-widget-pack-config.json.
update-logoUpdates the logo from the logo.svg or logo.png file.
update-storepageUpdates the store page from the storepage.md file.
updateUpdates the project files, scripts and dependencies to the latest skeleton.
update overwrites files

The update command replaces all project files except the src/ directory, README.md, mobro-widget-pack-config.json and package.json with the files of the latest skeleton. In the package.json, it replaces the scripts, dependencies and devDependencies. Commit your changes before running it, and review the result afterwards.

Validation​

Before doing anything else, all commands except generate and update validate the mobro-widget-pack-config.json and the mobro-widget-config.json of every widget against the JSON schemas. The dev command validates again on every change.

All widget configs are checked before the command stops, so every broken widget is listed at once. Each problem is reported once, together with where it is, from the config or layout array down to the property:

src/widgets/gauge/mobro-widget-config.json has 4 problems:
• config › "mode" (select): missing "options"
• config › "levels" (thresholds): unknown type "thresholds", use one of: string, number, slider, …
• layout › #2 (row) › #1 "label": can't be put here, use one of: column
• config › "border_color" (color) › visibleIf: unknown property "equal"

Fields are named by their name and type, other items by their position, counted from 1. Paths are relative to the widget pack. A widget config that isn't valid JSON is reported as unreadable, together with the problems of the other widgets.

tip

Set up the JSON schemas in your IDE to see these problems while you type, instead of when running the CLI.

Options​

OptionCommandsDescription
-wd, --working-directory <path>allRuns the command for the widget pack in the given directory instead of the current one.
-ak, --api-key <key>all marketplace commandsThe marketplace API key, see API Key.
-u, --url <url>all marketplace commandsThe marketplace URL. Only needed for testing against a different marketplace.

Environment Variables​

Instead of passing options, marketplace commands read the following variables from the environment or a .env file in the current directory:

VariableReplaces
MODBROS_MARKETPLACE_API_KEY--api-key
MODBROS_MARKETPLACE_URL--url