Catalyst CLI enables you to deploy only specific resources, such as just the client package, specific functions, or the API Gateway rules, using two deploy options. The following options are available for the catalyst deploy command.
The --only option allows you to define the specific resources to be deployed. You can use this with client , functions , or apig keywords. You can specify multiple resources separated by commas without any whitespace characters between them.
For example, to deploy just the client directory, run the following command in your terminal:
This initiates the deployment of the client directory alone. The deployment process is the same as discussed in the previous section.
You can also deploy a specific function or functions using the --only option. You must specify the names of the target functions in the command separated by commas as shown below:
You can also deploy the client and certain functions, or API Gateway rules and certain functions, alone as shown below:
This will deploy only the specified resources from the project directory.
The --except option allows you to define the resources to be excluded from deployment. It will deploy all the resources except for the ones that you specify.
For example, if you use the --except option with client , it will deploy only the functions directory and the API Gateway rules. You can execute this command in the following way:
You can also use this option to exclude specific functions. For example:
This will deploy all the other functions, the client, and the API Gateway rules.
Catalyst enables you to automate the CLI and terminal command executions by defining scripts in the catalyst.json file in your project directory. You can define two lifecycle scripts to execute before and after the catalyst deploy command respectively: predeploy, postdeploy. You can learn more about the lifecycle and custom scripts from the Scripts help page .
If you use the --ignore-scripts option while executing the catalyst deploy command, the CLI will ignore the actions configured for the predeploy and postdeploy scripts in the catalyst.json file of your project directory. The deployment process will proceed without the execution of these lifecycle scripts.
You can use the --ignore-scripts option as follows:
The deployment process will be the same as discussed earlier.
Last Updated 2023-04-19 15:32:07 +0530 +0530
Send your feedback to us