Square Dashboard Add-Ons CLI Reference

Command line interface that lets you programmatically build, launch, and test an Add-on in the dashboard.

The Square Dashboard Add-ons CLI is a Node.js CLI that is provided to you in a .tgz file by the Square team. Additional documentation can be found in the README.md file that comes with the CLI. To properly set up the CLI, please follow the instructions in the Get Started guide.

CLI features

You can use the CLI to build, test, and publish Dashboard Add-ons to the Square Dashboard.

The CLI initializes a new Add-on that you can modify and build on top of. It will also start a local development server so that you can interact with your local Add-on in the Square Dashboard in real time. Any local changes made will be hot reloaded, and will be immediately visible in the Square Dashboard without needing to restart your local development server.

The following CLI features are provided for our Developer Preview:

  • Add-on app scaffolding: get started with an Add-on by creating the right file structure, packages, and automating many other steps required to get started. You can use the sample app as an example to start with, and iterate from there to create your unique Add-on experience.
  • Local development: start a local development server running your Add-on, and automatically launch into the Square Dashboard to view your local Add-on in preview mode.

Additionally as part of Developer Preview, the Dashboard Add-ons SDK is included within the CLI. The rest of the packages required for the SDK can be installed with npm install. In the future, the Dashboard Add-ons SDK will be installable from the public npm registry. For information about the SDK, see the Square Dashboard Add-Ons SDK Reference.

See the Get Started tutorial for steps that show how to set up and use the CLI. This will be important to ensure you have the square-cli available as a global command.

CLI commands

When you use the CLI, ensure you include the global square-cli link in the command, which allows you to use square-cli add-ons commands from the command line. If you are not able to find the square-cli command, please follow the steps in the Get Started tutorial.

$   square-cli add-ons COMMAND

Command reference

Command Description
add-ons build Build your Add-on for private or public publishing. This will build your Add-on in production mode. The output will be in the dist directory. This command is used to prepare your Add-on for publishing. Note that running this command is optional because it runs automatically when you upload your add-on.
add-ons init Creates a sample starter Add-on, written in TypeScript and React, that you can manage and edit. You will be able to choose which placements you want to use (Home Widgets, Items View, or Customers View).

The get started guide covers how the CLI loads the starter Add-on in the dashboard.
add-ons dev Launches a local server (running on localhost) to view and iterate on your Add-on for the chosen placement.

This command loads the Add-on on a development server running on localhost, and will open a browser window that launches into Square Dashboard if you’re logged in to your Square account. If you’re not already signed in, the browser opens the Square account sign-in page.
add-ons upload Uploads your Add-on to Square to be hosted on their server.