Experro CLI is a command-line interface tool that you use to initialize environment file, fetch data from server, build, and deploy the theme.

Installation

You are already familiar with the process of installing the CLI. For reference, here is the command to install the CLI:
npm i -g experro-cli
After installation, you’ll get experro-cli command in terminal. Use the following command to show everything that’s available:
experro-cli --help
Usage:
  experro-cli [OPTIONS] <command>

Help Options:
  -h, --help  Show this help message

Available commands:
  build        Build the app
  environment  Environment related commands
  init         Init the project
  server       Start the local server
  version      Version creation
Some of the commands accept options. Option names are prefixed with double dash (--) characters. If options requires the value, it should be in --option-name=value format.

Available Commands

To use this commands you will need to have CLI token created, if you don’t have CLI token, Get CLI Token.

init


This command helps to create .env. This file will contain information for:
1. tenant-id
2. workspace-id
3. cli-token
4. store-url
For more information you can use help command: experro-cli init --help
experro-cli init --cli-token='XXXXX' --tenant-id=<tenant-id> --workspace-id=<workspace-id> --store-url=<store-hase>.experro.app --api-host=apis.experro.app --channel_ids=<channel_id_1>,<channel_id_2>
To obtain the required parameters, you can get it from the CLI token generated in the Experro Admin panel and set them in the experro-cli init command.

environment


This command lists the list of environments in the specified workspace. The information is retrieved from the .env file, which has been created using the aforementioned command experro-cli init <--content-->.
To list down the environment you can use the command:
experro-cli environment list

server


This command is useful to start the local server. It will help you fetch the data from Experro’s live store.
experro-cli server start

version


It allows you to create, delete, list and publish version’s of the themes.
To know more you can use this command:
experro-cli version --help

1. Create version
2. Delete version
3. List version
4. Publish version

1. Create a version :
To create a version, simply use the command as shown below. Just assigned values of the --name and --environment-id with your specific values, then execute this command. Your latest version will be created, and the build with the provided --name will be uploaded to the admin panel.

experro-cli version create --name=<theme-name/version-name> --environment-id=<environmnet-id>
image.png After successfully creating a version, you will see an output similar to the screenshot above.Note:
After successfully creating a version, an id will be displayed in your terminal (as shown in the screenshot above). Make sure to save this id for future reference, as it will be required to publish the uploaded version or perform other actions using Experro-cli.

2. Delete a version :
This option will helpful to delete a uploaded version. You just need to provide --tenant-id --wrokspace-id --cli-token and --version-id. Version-id will be same as we have seen in above command as below
experro-cli version delete --tenant-id=<tenent-id> --workspace-id=<workspace-id> --cli-token=<cli-token> --version-id=<version-id>

3. List version:
The list option in the version command for experro-cli will display a list of all the versions that have been uploaded to the workspace. It will also show the status of each version, indicating which version is currently published.
experro-cli version list 

4. Publish version:
Option publish version will allow theme-developer to direclty publish the version which is created using command as below
experro-cli version publish --tenant-id=<tenent-id> --workspace-id=<workspace-id> --cli-token=<cli-token> --environment-id=<environment-id> --version-id=<version-id>

build


This command is useful for creating an optimized local build.
 experro-cli build --tenant-id=<tenent-id> --workspace-id=<workspace-id> --cli-token=<cli-token> --version-id=<version-id>

If you’re facing any difficulties with the CLI, refer to the Troubleshooting section of the documentation for possible solutions. If you are facing any difficulties about CLI Token, then simply go ahead for Get CLI Token.