CLI

Overview

Available since io.Connect Browser 3.1

The @interopio/cli library is a tool that enhances the process of bootstrapping io.Connect apps for an io.Connect Browser project. It offers useful commands for easy and streamlined configuration and setup of an io.Connect Browser project, for creating the necessary io.Connect apps, and for installing additional plugins to the CLI.

Installation & Usage

To use the @interopio/cli library, install it globally:

npm install -g @interopio/cli

You can access the CLI functionalities using the iop command. For a full list of the available commands, see the Commands section.

Retrieving the version of the @interopio/cli library:

iop --version

Showing help for the available CLI commands:

iop --help

Commands

iop configure

The iop configure command allows you to specify a license key to be used for your io.Connect Browser project and to choose whether to use the embedded collection of templates for the io.Connect apps you want to create, or to fetch the templates from the remote repository.

Fetching the templates from the remote repository requires internet access (and may require explicit permission from your organization), but you will have the advantage of using the latest available templates without having to upgrade the @interopio/cli library to its lates version.

Using only iop configure without flags will start an interactive prompt for configuring your io.Connect Browser project with a license key and selecting a mode for template usage:

iop configure

The iop configure command can be modified with the following flags:

Flag Description
-m, --mode Specifies the template usage mode. The accepted options are auto, remote or offline. If auto is used, the CLI will try to fetch the templates for the io.Connect apps from the remote repository, and if that fails, will fallback to the embedded ones. Use remote or offline to specify explicitly that you want to use the remote or the locally available templates respectively.
-t, --token Use this flag to provide your valid license key for io.Connect Browser. If no license key is provided or if the provided license key is invalid, the CLI will still create the specified apps, but your io.Connect Browser project won't operate.
--help Shows help for the command.

Example usage of the iop configure command with flags:

iop configure --mode remote --token my-license-key

iop help

The iop help command displays information about the available CLI commands, their flags, and usage.

The iop help command can be modified with the following flags:

Flag Description
-n, --nested-commands Specifies whether to show information about all nested commands as well.

To display information about a specific command, provide the command name:

iop help configure

Alternatively, you can use the --help flag for each available command and also for the iop root command:

iop configure --help

iop new

The iop new command allows you to create io.Connect apps. You can create a Main app for an io.Connect Browser project, or Browser Client apps.

The iop new command accepts a required argument which specifies the type of the io.Connect app to create. The possible values are:

Argument Description
browser-platform Creates a Main app.
browser-client Creates browser client apps. Available since io.Connect Browser 3.2.

Using only iop new <NEWAPP> without flags will start an interactive prompt for providing a name and choosing the type of template for your io.Connect app:

iop new browser-platform

You can also provide a specific version of the app to create. If no version is provided, the latest available one will be used - either locally, or remotely, depending on the template usage configuration you have selected for the CLI:

iop new browser-platform@3.1

The iop new command can be modified with the following flags:

Flag Description
-n, --name Use this flag to provide a name for the io.Connect app you are creating.
-t, --template Specifies the type of template to use when creating the io.Connect app. The accepted options are vanilla-js, home-react-wsp and dev-react-seed for the iop new browser-platform command, and vanilla-js and react for the iop new browser-client command.
-y, --yes Use this flag to skip the prompts for name and template for your io.Connect app. When this flag is present, the default values for the respective type of app will be used: io-cb-platform as a name and vanilla-js as a template for a Main app; io-cb-client as a name and vanilla-js as a template for a Browser Client app.
--help Shows help for the command.

The --template flag accepts the following options when used with the respective commands:

Option Command Description
vanilla-js iop new browser-platform Will create a very basic JavaScript skeleton for a Main app.
home-react-wsp iop new browser-platform Will create fully-featured Home App of type Workspace based on the @interopio/home-ui-react library.
dev-react-seed iop new browser-platform Will bootstrap a React version of the Main app for development purposes based on the io.Connect Browser Seed Project. Available since io.Connect Browser 3.2.
vanilla-js iop new browser-client Will create a very basic JavaScript skeleton for a Browser Client app.
react iop new browser-client Will create a React template for a Browser Client app.

Example usage of the iop new command with flags for creating a Main app:

iop new browser-platform --name my-platform --template home-react-wsp

Example usage of the iop new command with flags for creating a Browser Client app:

iop new browser-client --name my-client --template react

iop plugins

The iop plugins command and its sub-commands allow you to install plugins to the CLI. These may be optional future plugins for the @interopio/cli library, or other third-party plugins you may want to use.

The functionality for this command is provided by the @oclif/plugin-plugins library. For more details on usage, see the README file for the library in GitHub.