Skip to content

Commit dcb6311

Browse files
committed
Update chalk
1 parent b6e1612 commit dcb6311

5 files changed

Lines changed: 20 additions & 14 deletions

File tree

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
"prepare": "husky"
5555
},
5656
"dependencies": {
57-
"chalk": "4.1.2",
57+
"chalk": "5.6.2",
5858
"rxjs": "7.8.2",
5959
"shell-quote": "1.8.3",
6060
"supports-color": "10.2.2",

‎pnpm-lock.yaml‎

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

‎src/logger.ts‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import chalk, { Chalk } from 'chalk';
1+
import chalk, { Chalk, ChalkInstance } from 'chalk';
22
import Rx from 'rxjs';
33

44
import { Command, CommandIdentifier } from './command.js';
@@ -7,12 +7,12 @@ import * as defaults from './defaults.js';
77
import { escapeRegExp } from './utils.js';
88

99
const defaultChalk = chalk;
10-
const noColorChalk = new chalk.Instance({ level: 0 });
10+
const noColorChalk = new Chalk({ level: 0 });
1111

12-
function getChalkPath(chalk: Chalk, path: string): Chalk | undefined {
12+
function getChalkPath(chalk: ChalkInstance, path: string): ChalkInstance | undefined {
1313
return path
1414
.split('.')
15-
.reduce((prev, key) => (prev as unknown as Record<string, Chalk>)[key], chalk);
15+
.reduce((prev, key) => (prev as unknown as Record<string, ChalkInstance>)[key], chalk);
1616
}
1717

1818
export class Logger {
@@ -22,7 +22,7 @@ export class Logger {
2222
private readonly commandLength: number;
2323
private readonly dateFormatter: DateFormatter;
2424

25-
private chalk: Chalk = defaultChalk;
25+
private chalk = defaultChalk;
2626

2727
/**
2828
* How many characters should a prefix have.
@@ -154,7 +154,7 @@ export class Logger {
154154
}
155155

156156
colorText(command: Command, text: string) {
157-
let color: chalk.Chalk;
157+
let color: ChalkInstance;
158158
if (command.prefixColor?.startsWith('#')) {
159159
const [hexColor, ...modifiers] = command.prefixColor.split('.');
160160
color = this.chalk.hex(hexColor);
@@ -163,7 +163,7 @@ export class Logger {
163163
color = modifiedColor;
164164
}
165165
} else {
166-
const defaultColor = getChalkPath(this.chalk, defaults.prefixColors) as Chalk;
166+
const defaultColor = getChalkPath(this.chalk, defaults.prefixColors) as ChalkInstance;
167167
color = getChalkPath(this.chalk, command.prefixColor ?? '') ?? defaultColor;
168168
}
169169
return color(text);

‎src/prefix-color-selector.spec.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Chalk } from 'chalk';
1+
import { ChalkInstance } from 'chalk';
22
import { afterEach, describe, expect, it, vi } from 'vitest';
33

44
import { PrefixColorSelector } from './prefix-color-selector.js';
@@ -11,7 +11,7 @@ describe('#getNextColor()', () => {
1111
const customTests: Record<
1212
string,
1313
{
14-
acceptableConsoleColors?: Array<keyof Chalk>;
14+
acceptableConsoleColors?: Array<keyof ChalkInstance>;
1515
customColors?: string | string[];
1616
expectedColors: string[];
1717
}

‎src/prefix-color-selector.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Chalk } from 'chalk';
1+
import { ChalkInstance } from 'chalk';
22

33
function getConsoleColorsWithoutCustomColors(customColors: string[]): string[] {
44
return PrefixColorSelector.ACCEPTABLE_CONSOLE_COLORS.filter(
@@ -68,7 +68,7 @@ export class PrefixColorSelector {
6868
// Colors picked randomly, can be amended if required
6969
return [
7070
// Prevent duplicates, in case the list becomes significantly large
71-
...new Set<keyof Chalk>([
71+
...new Set<keyof ChalkInstance>([
7272
// Text colors
7373
'cyan',
7474
'yellow',

0 commit comments

Comments
 (0)