Commands - Enterprise-CMCS/macpro-mako GitHub Wiki

Yargs Scripts

Script Description
consts Sets the PROJECT and REGION_A environment variables.
validateEnvVariable Validates the environment variables.
setStageFromBranch Sets the Stage name from the branch name.
openUrl Opens a url in the browser.
runCommand Runs a command with the input args and optional input base location.
checkIfAuthenticated Checks if the user is authenticated using the AWS credentials from Kion.
confirmDestroyCommand Interactive script to confirm with the user that they want to destroy an environment’s infrastructure.
writeUiEnvFile Creates the environment file by retrieving the deployment output and configs from SSM. Also sets Google Analytics values if in main, val, or production.

Yargs Commands

Command Description Details
deploy Deploys the project to the Stage environment.

MACPro Application Admin AWS credentials required.

Must use the --stage <stage name> flag to set the Stage environment.
Runs the checkIfAuthenticated script. Runs the AWS cdk deploy script. Runs the writeUiEnvFile script. Builds the react app. Gets the AWS s3 bucket name and existing CloudFront distribution id for the environment. Removes the existing react app from the s3 bucket. Pushes the new react app to the s3 bucket. Invalidates the previous CloudFront distribution id.
destroy Deletes the project infrastructure from the Stage environment.

MACPro Application Admin AWS credentials required.

Must use the --stage <stage name> flag to set the Stage environment.

Using the --verify false flag skips the interactive confirmation of deletion.

Using the --wait false flag returns after the destroy command was sent without waiting for it to finish.

Using the --secgroup false flag does not destroy the security group associated with the Stage environment. Must have --wait on to use this flag.
Runs the checkIfAuthenticated script. Runs the confirmDestroyCommand script, unless the --verify false flag was set. Runs the AWS CloudFormation delete stack command. Waits until the stack is deleted, unless the --wait false flag was set. Runs the AWS EC2 describe security group command to get the security group id for the Stage environment and then runs the AWS EC2 delete security group command, unless the --secgroup false flag was set.
e2e Installs Playwright and run the end-to-end tests.

MACPro Application Admin AWS credentials required.

Using the --ui flag runs the end-to-end tests in Playwright UI mode.

Requires that the application is running.
Runs the checkIfAuthenticated script. Installs Playwright and dependencies. Runs end-to-end tests with tag @CI.
emails Starts a local development server for working with the email templates.

MACPro Application Admin or MACPro ReadOnly AWS credentials required.

Use the --stage <stage name> flag to set the Stage for the command, if not set it uses the setStageFromBranch command to set it to the current branch.
Runs the checkIfAuthenticated script. Starts a local development server that will watch your files and automatically rebuild your email template when you make changes (provided by react email).
get-cost Returns the costs of the AWS resources for the Stage environment for the last 14 days, the average of the last 14 days, and the cost for yesterday.

MACPro Application Admin or MACPro ReadOnly AWS credentials required.

Use the --stage <stage name> flag to set the Stage for the command, if not set it uses the setStageFromBranch command to set it to the current branch.
Runs the checkIfAuthenticated script. Determines the last 14 days. Uses the AWS GetCostAndUsageCommand to gets the daily values for each of those days. Gets an average from the results. Returns the list of daily values, the average of cost over the last 14 days, and the cost for yesterday.

Example:
Daily costs for the last 14 days:
2025-05-28: $0.00
2025-05-29: $0.00
2025-05-30: $0.00
2025-05-31: $0.00
2025-06-01: $0.00
2025-06-02: $0.00
2025-06-03: $0.00
2025-06-04: $0.00
2025-06-05: $0.00
2025-06-06: $0.00
2025-06-07: $0.00
2025-06-08: $0.00
2025-06-09: $0.00
Average daily cost over the past 14 days: $0.00
Yesterday, the stack [stage name] cost $0.00.
install Installs the dependencies. Runs the bun install command.
logs Streams a Lambda’s CloudWatch logs to the terminal.

MACPro Application Admin or MACPro ReadOnly AWS credentials required.

Must use the -f <function name> flag to set the logs to follow. If you use a partial name that matches multiple functions, it will list both and you can pick one.

Use the --stage <stage name> flag to set the Stage for the command, if not set it uses the setStageFromBranch command to set it to the current branch.
Runs the checkIfAuthenticated script. Retrieves the Lambda functions for the Project and Stage. Filters the functions by the -f flag value. If more than one function matches, it prompts the user to select one function. Gets the Lambda Group for the function. Uses the awslogs command to tail the Lambda logs to the terminal.
open-app Opens the browser to the deployed application.

MACPro Application Admin or MACPro ReadOnly AWS credentials required.

Use the --stage <stage name> flag to set the Stage for the command, if not set it uses the setStageFromBranch command to set it to the current branch.
Runs the checkIfAuthenticated script. Gets the application url from the deployment output. Runs the openUrl script to open the url in the browser.
open-kibana Opens the browser to the Kibana instance for the environment.

MACPro Application Admin or MACPro ReadOnly AWS credentials required.

Use the --stage <stage name> flag to set the Stage for the command, if not set it uses the setStageFromBranch command to set it to the current branch.
Runs the checkIfAuthenticated script. Gets the Kibana url from the deployment output. Runs the openUrl script to open the url in the browser.
test Runs the unit tests.

Using the --ui flag runs the unit tests in Vitest UI mode.

Using the --coverage flag runs the unit tests and displays the coverage results.

Cannot run --ui and --coverage at the same time.
Runs the bun run test, bun run test:coverage, or bun run test:ui command depending on the flags.
ui Builds the React app and starts it.

MACPro Application Admin or MACPro ReadOnly AWS credentials required.

Use the --stage <stage name> flag to set the Stage for the command, if not set it uses the setStageFromBranch command to set it to the current branch.
Runs the checkIfAuthenticated script. Runs the writeUiEnvFile script. Runs the bun run build command in the /react-app directory. Runs the bun run dev command in the /react-app directory.
watch Watches for changes in the code and automatically redeploys it.

MACPro Application Admin AWS credentials required.
Runs the checkIfAuthenticated script. Runs the writeUiEnvFile script. Runs the AWS cdk watch script to watch the project for changes to perform deployments and hotswaps.
⚠️ **GitHub.com Fallback** ⚠️