-
Notifications
You must be signed in to change notification settings - Fork 59
/
Copy pathrenderer.ts
26 lines (18 loc) · 1.01 KB
/
renderer.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import chalk from 'chalk'
import {ICONS} from '../../helpers/formatting'
import {CommitInfo} from './interfaces'
export const renderConfigurationError = (error: Error) => `${ICONS.FAILED} Configuration error: ${error}.`
export const renderFailedUpload = (errorMessage: string) => `${ICONS.FAILED} Failed upload: ${errorMessage}`
export const renderRetriedUpload = (errorMessage: string, attempt: number) =>
`[attempt ${attempt}] Retrying upload: ${errorMessage}`
export const renderSuccessfulCommand = (duration: number, dryRun: boolean) => {
if (dryRun) {
return chalk.green(`${ICONS.SUCCESS} [DRYRUN] Handled in ${duration} seconds.`)
} else {
return chalk.green(`${ICONS.SUCCESS} Uploaded in ${duration} seconds.`)
}
}
export const renderDryRunWarning = () => `${ICONS.WARNING} DRY-RUN MODE ENABLED. WILL NOT UPLOAD`
export const renderCommandInfo = (commit: CommitInfo) =>
`Reporting commit ${commit.hash} from repository ${commit.remote}.
${commit.trackedFiles.length} tracked file paths will be reported.`