Skip to content

Commit aa3d413

Browse files
authored
feat: advance typescript teminal consolelog text color (#393)
* feat: advance typescript teminal consolelog text color * fix: ensure errorCount * fix: sort import statements
1 parent 5f5b92a commit aa3d413

File tree

1 file changed

+6
-2
lines changed
  • packages/vite-plugin-checker/src/checkers/typescript

1 file changed

+6
-2
lines changed

packages/vite-plugin-checker/src/checkers/typescript/main.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import os from 'node:os'
22
import path from 'node:path'
33
import { fileURLToPath } from 'node:url'
44
import { parentPort } from 'node:worker_threads'
5+
import chalk from 'chalk'
56
import invariant from 'tiny-invariant'
67
import ts from 'typescript'
78

@@ -107,13 +108,16 @@ const createDiagnostic: CreateDiagnostic<'typescript'> = (pluginConfig) => {
107108
}
108109

109110
if (terminal) {
111+
const color = errorCount && errorCount > 0 ? 'red' : 'green'
110112
consoleLog(
111-
logChunk +
113+
chalk[color](
114+
logChunk +
112115
os.EOL +
113116
wrapCheckerSummary(
114117
'TypeScript',
115118
diagnostic.messageText.toString(),
116-
),
119+
)
120+
),
117121
)
118122
}
119123
})

0 commit comments

Comments
 (0)