Skip to content

Commit

Permalink
Update chalk usage
Browse files Browse the repository at this point in the history
  • Loading branch information
tmeasday committed Sep 12, 2023
1 parent 373c15d commit 942d60c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
8 changes: 3 additions & 5 deletions node-src/ui/messages/errors/invalidConfigurationFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,14 @@ export const invalidConfigurationFile = (configFile: string, err: ZodError) => {
const { formErrors, fieldErrors } = err.flatten();

return dedent(chalk`
${error} Configuration file ${chalk.bold(
configFile
)} was invalid, please check the allowed keys.
${error} Configuration file {bold configFile} was invalid, please check the allowed keys.
${
formErrors.length
? `\n${formErrors.map((msg) => `- ${chalk.bold(msg)}`).join('\n ')}\n\n`
? `\n${formErrors.map((msg) => chalk`- {bold ${msg}}`).join('\n ')}\n\n`
: ''
}
${Object.entries(fieldErrors)
.map(([field, msg]) => `- ${chalk.bold(field)}: ${msg}`)
.map(([field, msg]) => chalk`- {bold ${field}}: ${msg}`)
.join('\n ')}
`);
};
4 changes: 2 additions & 2 deletions node-src/ui/messages/errors/missingConfigurationFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { error } from '../../components/icons';

export const missingConfigurationFile = (configFile: string) =>
dedent(chalk`
${error} Configuration file ${chalk.bold(configFile)} could not be found.
${error} Configuration file {bold configFile} could not be found.
Check the ${chalk.bold(`--config-file`)} flag of the CLI.
Check the {bold --config-file} flag of the CLI.
`);
4 changes: 2 additions & 2 deletions node-src/ui/messages/errors/unparseableConfigurationFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { error } from '../../components/icons';

export const unparseableConfigurationFile = (configFile: string, err: Error) =>
dedent(chalk`
${error} Configuration file ${chalk.bold(configFile)} could not be parsed, is it valid JSON?
${error} Configuration file {bold ${configFile}} could not be parsed, is it valid JSON?
The error was: ${chalk.bold(err.message)}
The error was: {bold ${err.message}}
`);

0 comments on commit 942d60c

Please sign in to comment.