Skip to content

Commit

Permalink
feat: advance typescript teminal consolelog text color (#393)
Browse files Browse the repository at this point in the history
* feat: advance typescript teminal consolelog text color

* fix: ensure errorCount

* fix: sort import statements
  • Loading branch information
jaceechan committed Sep 5, 2024
1 parent 5f5b92a commit aa3d413
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/vite-plugin-checker/src/checkers/typescript/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import os from 'node:os'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import { parentPort } from 'node:worker_threads'
import chalk from 'chalk'
import invariant from 'tiny-invariant'
import ts from 'typescript'

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

if (terminal) {
const color = errorCount && errorCount > 0 ? 'red' : 'green'
consoleLog(
logChunk +
chalk[color](
logChunk +
os.EOL +
wrapCheckerSummary(
'TypeScript',
diagnostic.messageText.toString(),
),
)
),
)
}
})
Expand Down

0 comments on commit aa3d413

Please sign in to comment.