Working with the Client

Working with the Client

 

Introduction

Catalyst CLI enables you to set up and work with the project components that you did not initialize during the project initialization. You can set up the client and the functions directories from the CLI at any time while working with the project.

This feature is very convenient if you did not initialize the client package during the project initialization, or if you initialized an empty project, and then later need the client component to be added to your application. In such cases, you can quickly set up the client in its standard directory structure in your project directory. 

The CLI will ensure that all the required configuration files of the client are initialized in their boilerplate structures. The updated information about the newly created client component will also be added to the catalyst.json file automatically, when you set it up. You can also perform a remote delete operation on the client component and delete any of its previously hosted versions from the CLI.

 

Set Up Client

You can setup the client component from the CLI by navigating to your project directory and executing the following command:

$ catalyst client:setup
 

The procedure is the same as initializing the client directory during the project initialization. The CLI will prompt you to provide a name for the client component of your project. Enter a name and press Enter

The client directory will now be created in the project's directory and the catalyst.json file will be updated with its information.

The client directory will be set up with an index.html, a main.css, and a main.js file, along with the client-package.json configuration file. You can learn about the client directory structure in detail from the Project Directory Structure help page.

Note:
  • You can add any number of sub-folders and files in the client's directory like HTML files, JavaScript files, logo images, and more. However, the configuration files and dependencies need to be in the client directory's root.
  • You can also pull a hosted web client from the console to your local system using the catalyst pull command.

After you build and test the client component, you can either host it through Web Client Hosting in the Catalyst console or deploy the client from the CLI to the remote console. 

 

Delete Client

You can permanently delete any older version of the client component in your Catalyst project using the CLI. You can choose to delete the client from the remote console or from your local project directory while executing this command. You can also delete a client version from the console through Web Client Hosting.

Note:
  • You will not be able to delete the client version that is currently live. You can only delete a version that is not currently hosted live.
  • If a client version exists in both locations, it will only be deleted from the location you choose. For example, even if you delete the client version from the remote console, it will still be present in your local project directory until you delete it from the local machine separately.
  1. To delete an older version of your client component from the CLI, execute the following command from the project directory structure:
    $ catalyst client:delete
  2. The CLI will ask you to choose between the client in the remote console or the client in your local project directory. Select an option and press Enter.
  3. The CLI will display all the versions of your web application that have previously been hosted. Select any version from the list, other than the live version, then press Enter.

    The selected version will then be deleted from your Catalyst project from the chosen location.
Note: You can use the catalyst pull command to pull resources from the remote console to the local directory, or catalyst deploy to deploy resources to the remote console from the local directory if you require synchronization.

You can also directly specify the client version to be deleted in the following way:

$ catalyst client:delete [client_version]
 

For example:

$ catalyst client:delete 1.0.0
 

The CLI will then prompt you to select between the remote console or the local directory, then ask you for the delete confirmation in the same manner.

 

Delete Client Options

You can directly choose to list the versions of the client in either the remote console or in your local project directory to delete using the respective options.

To list the client versions available in your local project directory, execute the catalyst client:delete command as follows:

$ catalyst client:delete --local
 

To list the client versions available in the remote console of your project, execute the catalyst client:delete command as follows:

$ catalyst client:delete --remote
 

The CLI will list the client versions accordingly, and you can delete the required version as explained previously.

You can also directly delete a version from the remote console or the local directory as shown below:

$ catalyst client:delete 1.0.0 --remote

Share this post : FacebookTwitter

Still can't find what you're looking for?

Write to us: support@zohocatalyst.com