diff --git a/package.json b/package.json index 1aa9280..e84975e 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@mondaycom/apps-cli", - "version": "1.1.0", + "version": "1.2.0", "description": "A cli tool to manage apps (and monday-code projects) in monday.com", "author": "monday.com Apps Team", "type": "module", diff --git a/src/services/push-service.ts b/src/services/push-service.ts index 5d65043..767b304 100644 --- a/src/services/push-service.ts +++ b/src/services/push-service.ts @@ -1,4 +1,5 @@ import axios from 'axios'; +import chalk from 'chalk'; import { ListrTaskWrapper } from 'listr2'; import { getAppVersionDeploymentStatusUrl, getDeploymentSignedUrl } from 'consts/urls'; @@ -62,7 +63,10 @@ export const getAppVersionDeploymentStatus = async (appVersionId: number) => { export const pollForDeploymentStatus = async ( appVersionId: number, retryAfter: number, - options: { ttl?: number; progressLogger?: (message: keyof typeof DeploymentStatusTypesSchema) => void } = {}, + options: { + ttl?: number; + progressLogger?: (message: keyof typeof DeploymentStatusTypesSchema, tip?: string) => void; + } = {}, ): Promise => { const { ttl, progressLogger } = options; @@ -79,7 +83,7 @@ export const pollForDeploymentStatus = async ( const response = await getAppVersionDeploymentStatus(appVersionId); if (statusesToKeepPolling.includes(response.status)) { if (progressLogger) { - progressLogger(response.status); + progressLogger(response.status, response.tip); } return false; @@ -199,10 +203,12 @@ export const handleDeploymentTask = async ( const ttl = TimeInMs.minute * 30; const deploymentStatus = await pollForDeploymentStatus(ctx.appVersionId, retryAfter, { ttl, - progressLogger: (message: keyof typeof DeploymentStatusTypesSchema) => { + progressLogger: (message: keyof typeof DeploymentStatusTypesSchema, tip?: string) => { const deltaInSeconds = (Date.now() - now) / TimeInMs.second; task.title = `Deployment in progress: ${message}`; - task.output = createProgressBarString(MAX_PROGRESS_VALUE, STATUS_TO_PROGRESS_VALUE[message], deltaInSeconds); + const customTip = tip ? `\n ${chalk.italic(chalk.green(tip))}` : ''; + task.output = + createProgressBarString(MAX_PROGRESS_VALUE, STATUS_TO_PROGRESS_VALUE[message], deltaInSeconds) + customTip; }, }); diff --git a/src/services/schemas/push-service-schemas.ts b/src/services/schemas/push-service-schemas.ts index 2af8ac0..3cdac2f 100644 --- a/src/services/schemas/push-service-schemas.ts +++ b/src/services/schemas/push-service-schemas.ts @@ -24,6 +24,7 @@ export const deploymentStatusTypesSchema = z.enum(deploymentStatusTypesArray); export const appVersionDeploymentStatusSchema = z .object({ status: deploymentStatusTypesSchema, + tip: z.string().optional(), deployment: z .object({ url: z.string(),