-
Notifications
You must be signed in to change notification settings - Fork 57
Open
Labels
enhancementNew feature or requestNew feature or request
Description
The preferred method of determining whether Node.js is being run within a TTY context is to check that the value of the process.stdout.isTTY property is true:
$ node -p -e "Boolean(process.stdout.isTTY)" true $ node -p -e "Boolean(process.stdout.isTTY)" | cat false
https://nodejs.org/api/tty.html#tty
Line 1 in 20fc196
| import * as tty from "tty" |
Line 15 in 20fc196
| tty && tty.isatty && tty.isatty(1) && env.TERM && !isDumbTerminal |
globalThis.process?.stdout?.isTTY && env.TERM && !isDumbTerminal This would also remove the dependency on the node:tty module and make it "more easier" for use in the browser. i.e. NO TRANSPILATION required, you can just import ... from "./node_modules/colorette/index.js"
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request