Skip to content

Commit

Permalink
feat!: node endpoint to check isatty and FORCE_TTY automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
AriPerkkio committed Dec 19, 2024
1 parent aae3a14 commit 42017d5
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/node.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
import { isatty } from 'node:tty'
import { createColors } from './index'
import {
createColors as originalCreateColors,
isSupported as originalIsSupported,
} from './index'

export * from './index'
export { Colors, Formatter, getDefaultColors } from './index'

export default createColors(process.env.FORCE_TTY !== undefined || isatty(1))
const isTTY = process.env.FORCE_TTY !== undefined || isatty(1)

export function isSupportted() {
return originalIsSupported(isTTY)
}

export function createColors() {
return originalCreateColors(isTTY)
}

export default originalCreateColors(isTTY)

0 comments on commit 42017d5

Please sign in to comment.