Initialize the Project from the CLI

You can now begin working on your Catalyst project from the CLI. The first step is to initialize the project in an empty directory. This will be the home directory of your project and all of the project files will be saved in it.

You can learn more about this from the Project Directory Structure help page. You can learn about initializing a project in detail from the CLI help documentation.

  1. Create a folder for the project on your local machine and navigate to it from the terminal.

  2. Initialize a project by executing the following command from that directory:

copy
$
catalyst init
  1. Select the preferred portal (or organization) by navigating using the arrow keys and press Enter to confirm. If you have no other organizations associated with the account, then the default one will be selected automatically.

select_portal

  1. Now, CLI will ask you to associate a Catalyst project with the directory. Associate it with the project that we created earlier from the console. Select GitHubBot from the list and press Enter.

select_default_project

  1. Select Functions using the space bar. Press the Enter key to initialize.

select_components

  1. The CLI will initiate the function setup. Select Integration as the function type.

function_type

  1. Select Cliq as the service and press Enter.

select_service

  1. All Cliq handlers classes will be selected by default. Press Enter.

select_handlers

  1. Select the latest supported runtime of Java as the function stack, and press Enter.

catalyst_gitbot_init_6

  1. Enter “GithubExtension” as the folder name and “MainClass” as the class name. Press Enter each time.

catalyst_gitbot_init_7

The CLI will download and install the latest Catalyst Java SDK package.

Note: Ensure that you enter the class name and folder name exactly as instructed, because the application's code contains the same names.
The functions directory is now created in the standard structure. Catalyst initialization is complete.

Your project directory is now set up with the functions directory (CATALYST_FUNCTIONS_HOME) along with configuration files and dependencies. The project directory also contains the catalyst.json configuration file and a hidden catalyst.rc file.

This will be the final structure of your project directory.

catalyst_gitbot_proj_dir_struct

Note: This image includes an additional file GithubConstants.java. We will create this file while configuring the functions directory in the next step.

Last Updated 2024-06-12 17:41:34 +0530 +0530