The catalyst json Configuration File

The catalyst.json file contains the configuration of the entire project’s directory, i.e., the functions and the client directories. An exmaple snippet is shown below:

    
copy
{ "functions": { "targets": [ "fn", "sendemail", "jaavafn", "mynode", "cert_gen_function" ], "ignore":[ ".output", ], "source":"functions" }, "client":{ "source":"client" } }

Parameters

It contains the following specifications of the functions and the client directories:

  • source: The source specifies the target folder names of the functions and the client directories. You must not modify these values.
  • targets: The targets specify the directory names of each individual function in the project.
  • ignore: This field specifies the files in the component directory, or in one of its sub-directories, that must be ignored while deploying the code to production. You can mention the files to be ignored inside the square brackets. You can list the files directly or use glob patterns to specify the files. For example, if you specify *.css , all CSS files in the particular directory will be ignored during the deployment.

Points to Remember

  • The catalyst.json file is created in the project directory irrespective of which components you initialize during the project creation from the CLI. Even if you do not select any components to initialize, the catalyst.json file will be created. Therefore, when you create a project from the Catalyst UI console, you must initialize it from the CLI for catalyst.json to be created with the configuration information of the project resources.

  • The catalyst.json file is not mandatory if you host your web application from the Catalyst console i.e., when you host the client resource and deploy the functions individually from the console. However, if you deploy your application as a whole from the CLI, or from an external source like GitHub, the catalyst.json file must be mandatorily present in the root folder of your application.

  • If you rename the functions or the client directory, you must update the changes in catalyst.json .

  • If you change the names of any of the functions, you must update the changes in catalyst.json .

  • If you execute the catalyst functions:setup , catalyst functions:add , catalyst client:setup , or catalyst pull commands from the CLI, the configuration information of the function or client is automatically updated in the catalyst.json file.

  • If you manually import any component files from an external development environment, you must create the configuration files in the format mentioned in this help page.

Note: If you are a Visual Studio Code IDE user, you can install the Catalyst Tools extension, and perform CLI operations using your IDE in place of the CLI. Steps to serve and deploy your Catalyst resources using the catalyst.json using Visual Studio Code IDE can be found here.

Last Updated 2024-01-09 17:07:13 +0530 +0530