Skip to content

Commit

Permalink
style: code style updated and use eslint flat config
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhengqbbb committed Sep 5, 2024
1 parent 497c350 commit dd3a8b3
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions packages/@cz-git/plugin-inquirer/src/shared/utils/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,27 @@ import process from 'node:process'
/**
* Check current is support color command text
*
* @param colorSupoort can force output not colorizen
* @param colorSupport can force output not colorizen
* @param fd Channel. Provide options to allow users to customize the judgment.
* e.g, logs and TUI are 2 stderr. In this case, only when the user operates on 2 does the color output need to be disabled.
* COMMAND 2 > runtime.log. All logs need to remove colorizen code
*/
export function isColorizenSupport(colorSupoort = true, fd = 1) {
export function isColorizenSupport(colorSupport = true, fd = 1) {
return (
(colorSupoort
&& !('NO_COLOR' in process.env)
&& !(process.env?.NODE_ENV === 'test')
&& (process.platform === 'win32' || (tty.isatty(fd) && process.env.TERM !== 'dumb') || 'CI' in process.env))
|| (!process.env.VITEST && 'FORCE_COLOR' in process.env)
(
colorSupport
&& !('NO_COLOR' in process.env)
&& (
process.platform === 'win32'
|| (tty.isatty(fd) && process.env.TERM !== 'dumb')
|| 'CI' in process.env
)
) || (
!process.env.VITEST && 'FORCE_COLOR' in process.env
)
)
}

/**
* Provide to formatter. If has close tag, replace it
*/
Expand Down

0 comments on commit dd3a8b3

Please sign in to comment.