Skip to content

Commit 7c80b0b

Browse files
authored
refactor: remove chalk in favor of consola.colorize (#2511)
1 parent c9eeca2 commit 7c80b0b

5 files changed

Lines changed: 6 additions & 20 deletions

File tree

packages/cli/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
},
2424
"dependencies": {
2525
"adm-zip": "^0.5.16",
26-
"chalk": "^5.3.0",
2726
"commander": "^14.0.0",
2827
"conf": "^13.1.0",
2928
"consola": "^3.4.2",
Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import chalk from 'chalk';
21
import { Command } from 'commander';
32
import consola from 'consola';
43

@@ -7,8 +6,8 @@ import PACKAGE_INFO from '../../package.json';
76
export const version = new Command('version')
87
.description('Display detailed version information.')
98
.action(() => {
10-
consola.log(chalk.cyanBright('\nVersion Information:'));
11-
consola.log(`${chalk.bold('CLI Version:')} ${PACKAGE_INFO.version}`);
12-
consola.log(`${chalk.bold('Node Version:')} ${process.version}`);
13-
consola.log(`${chalk.bold('Platform:')} ${process.platform} (${process.arch})\n`);
9+
consola.log('Version Information:');
10+
consola.log(`CLI Version: ${PACKAGE_INFO.version}`);
11+
consola.log(`Node Version: ${process.version}`);
12+
consola.log(`Platform: ${process.platform} (${process.arch})`);
1413
});

packages/cli/src/program.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import chalk from 'chalk';
21
import { Command } from 'commander';
32
import consola from 'consola';
3+
import { colorize } from 'consola/utils';
44

55
import PACKAGE_INFO from '../package.json';
66

@@ -13,7 +13,7 @@ import { version } from './commands/version';
1313

1414
export const program = new Command();
1515

16-
consola.log(chalk.cyanBright(`\n${PACKAGE_INFO.name} v${PACKAGE_INFO.version}\n`));
16+
consola.log(colorize('cyanBright', `${PACKAGE_INFO.name} v${PACKAGE_INFO.version}\n`));
1717

1818
program
1919
.name(PACKAGE_INFO.name)

packages/cli/tests/commands/version.spec.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,6 @@ import { beforeAll, expect, test, vi } from 'vitest';
55
import { version } from '../../src/commands/version';
66
import { program } from '../../src/program';
77

8-
vi.mock('chalk', () => ({
9-
default: new Proxy(
10-
{},
11-
{
12-
get: () => (str: string) => str,
13-
},
14-
),
15-
}));
16-
178
beforeAll(() => {
189
consola.mockTypes(() => vi.fn());
1910
});

pnpm-lock.yaml

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)