Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/services/notices.service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ui } from '../utils/ui.js';
import { colors, symbols } from '../utils/styling.js';
import { colors } from '../utils/styling.js';
import { compareSemver } from './version.service.js';

export type NoticeLevel = 'deprecation' | 'warn' | 'info' | 'marketing';
Expand Down Expand Up @@ -106,12 +106,11 @@ function renderNotice(notice: Notice, opts: RenderNoticesOptions): void {

switch (notice.level) {
case 'deprecation':
// Red ⚠ so a deprecation reads as more serious than a plain (yellow) warn.
opts.out(`${colors.error('⚠')} ${colors.bold(notice.title)}`);
opts.out(ui.deprecation(colors.bold(notice.title)));
opts.out(ui.branch(rows));
break;
case 'warn':
opts.out(`${symbols.warning} ${colors.bold(notice.title)}`);
opts.out(ui.warn(colors.bold(notice.title)));
opts.out(ui.branch(rows));
break;
case 'marketing':
Expand Down
1 change: 1 addition & 0 deletions src/utils/styling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const stripAnsi = (s: string): string => s.replace(/\u001B\[[0-9;]*m/g, '
*/
export const symbols = {
cancelled: chalk.gray('⊘'),
deprecation: chalk.red('⚠'),
error: chalk.red('✗'),
info: chalk.blue('ℹ'),
pending: chalk.yellow('⏸'),
Expand Down
5 changes: 5 additions & 0 deletions src/utils/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ export const ui = {
});
},

/** `⚠ message` in red — a deprecation; reads as more serious than a (yellow) {@link warn}. */
deprecation(message: string): string {
return `${symbols.deprecation} ${message}`;
},

/** `ℹ message` — neutral, standalone information. */
info(message: string): string {
return `${symbols.info} ${message}`;
Expand Down
Loading