Skip to content

Commit

Permalink
feat: switch from chalk to colorette for log colors
Browse files Browse the repository at this point in the history
  • Loading branch information
robherba committed Sep 10, 2024
1 parent 4a8e6b5 commit 0403d66
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 17 deletions.
12 changes: 8 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"@types/progress": "^2.0.5",
"ajv": "^8.17.1",
"ajv-formats": "^3.0.1",
"chalk": "^4.1.2",
"colorette": "^2.0.20",
"commander": "^12.0.0",
"consola": "^2.15.3",
"cosmiconfig": "^9.0.0",
Expand Down
14 changes: 7 additions & 7 deletions src/lib/log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Exports methods that MUST be used when writing to the console.
*/

import chalk from 'chalk';
import { cyan, red, yellow, green, dim, bold } from 'colorette';
import R from 'ramda';
import consolaGlobalInstance, { Consola } from 'consola';

Expand All @@ -18,12 +18,12 @@ export type LogMethod =
const logMethodColorMap: {
[name in LogMethod]: (message: string) => string;
} = {
info: chalk.cyan,
error: chalk.red.bold,
warn: chalk.yellow.bold,
debug: chalk.dim,
verbose: chalk.dim,
success: chalk.green,
info: cyan,
error: (message: string) => bold(red(message)),
warn: (message: string) => bold(yellow(message)),
debug: dim,
verbose: dim,
success: green,
};

const withColor =
Expand Down
10 changes: 5 additions & 5 deletions src/util/platform/getInitSuccessMessageForPlatform.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { LogMethod } from 'src/lib/log';
import chalk from 'chalk';
import { cyan } from 'colorette';

/**
* Returns the init success log messages for a given platform.
Expand Down Expand Up @@ -36,12 +36,12 @@ export default function getInitSuccessMessageForPlatform(
{
method: 'verbose',
message: `
${chalk.cyan('List systems')}: emulsify system list
${chalk.cyan('Install a system')}: emulsify system install "system-name"
${chalk.cyan(
${cyan('List systems')}: emulsify system list
${cyan('Install a system')}: emulsify system install "system-name"
${cyan(
'Install default system with default components',
)}: emulsify system install compound
${chalk.cyan(
${cyan(
'Install default system with all components',
)}: emulsify system install compound --all
`,
Expand Down

0 comments on commit 0403d66

Please sign in to comment.