Skip to content

Commit

Permalink
fix: update push-status messages (#1425)
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorKarpiuk authored Feb 13, 2024
1 parent 4d01896 commit 8d5e8a8
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
10 changes: 5 additions & 5 deletions packages/cli/src/cms/commands/__tests__/push-status.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ describe('handlePushStatus()', () => {
);
expect(process.stdout.write).toHaveBeenCalledTimes(1);
expect(process.stdout.write).toHaveBeenCalledWith(
'🚀 PREVIEW deployment succeeded.\nPreview URL: https://test-url\n'
'🚀 Preview deploy success.\nPreview URL: https://test-url\n'
);
});

Expand All @@ -110,10 +110,10 @@ describe('handlePushStatus()', () => {
);
expect(process.stdout.write).toHaveBeenCalledTimes(2);
expect(process.stdout.write).toHaveBeenCalledWith(
'🚀 PREVIEW deployment succeeded.\nPreview URL: https://test-url\n'
'🚀 Preview deploy success.\nPreview URL: https://test-url\n'
);
expect(process.stdout.write).toHaveBeenCalledWith(
'🚀 PRODUCTION deployment succeeded.\nPreview URL: https://test-url\n'
'🚀 Production deploy success.\nProduction URL: https://test-url\n'
);
});

Expand All @@ -139,7 +139,7 @@ describe('handlePushStatus()', () => {
mockConfig
);
expect(exitWithError).toHaveBeenCalledWith(
'❌ PREVIEW deployment failed.\nPreview URL: https://test-url'
'❌ Preview deploy fail.\nPreview URL: https://test-url'
);
});

Expand Down Expand Up @@ -176,7 +176,7 @@ describe('handlePushStatus()', () => {
);
expect(process.stdout.write).toHaveBeenCalledTimes(4);
expect(process.stdout.write).toHaveBeenCalledWith(
'🚀 PREVIEW deployment succeeded.\nPreview URL: https://test-url\n'
'🚀 Preview deploy success.\nPreview URL: https://test-url\n'
);
expect(process.stdout.write).toHaveBeenCalledWith('\nScorecard:');
expect(process.stdout.write).toHaveBeenCalledWith(
Expand Down
11 changes: 6 additions & 5 deletions packages/cli/src/cms/commands/push-status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Spinner } from '../../utils/spinner';
import { DeploymentError } from '../utils';
import { yellow } from 'colorette';
import { ReuniteApiClient, getApiKeys, getDomain } from '../api';
import { capitalize } from '../../utils/js-utils';

import type { DeploymentStatus, PushResponse, ScorecardItem } from '../api/types';

Expand Down Expand Up @@ -177,15 +178,15 @@ function displayDeploymentAndBuildStatus({
case 'success':
spinner.stop();
return process.stdout.write(
`${colors.green(
`🚀 ${buildType.toLocaleUpperCase()} deployment succeeded.`
)}\n${colors.magenta('Preview URL')}: ${colors.cyan(previewUrl!)}\n`
`${colors.green(`🚀 ${capitalize(buildType)} deploy success.`)}\n${colors.magenta(
`${capitalize(buildType)} URL`
)}: ${colors.cyan(previewUrl!)}\n`
);
case 'failed':
spinner.stop();
throw new DeploymentError(
`${colors.red(`❌ ${buildType.toLocaleUpperCase()} deployment failed.`)}\n${colors.magenta(
'Preview URL'
`${colors.red(`❌ ${capitalize(buildType)} deploy fail.`)}\n${colors.magenta(
`${capitalize(buildType)} URL`
)}: ${colors.cyan(previewUrl!)}`
);
case 'pending':
Expand Down
7 changes: 7 additions & 0 deletions packages/cli/src/utils/js-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,10 @@ export function keysOf<T>(obj: T) {
if (!obj) return [];
return Object.keys(obj) as (keyof T)[];
}

export function capitalize(s: string) {
if (s?.length > 0) {
return s[0].toUpperCase() + s.slice(1);
}
return s;
}

1 comment on commit 8d5e8a8

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements 76.19% 4326/5678
🟡 Branches 65.97% 2258/3423
🟡 Functions 68.93% 699/1014
🟡 Lines 76.39% 4067/5324

Test suite run success

710 tests passing in 101 suites.

Report generated by 🧪jest coverage report action from 8d5e8a8

Please sign in to comment.