Skip to content

Commit

Permalink
Fix Vite support (#92)
Browse files Browse the repository at this point in the history
Allows colorette to work both in Node and in the browser as an ESM module.
  • Loading branch information
kibertoad committed Jun 7, 2022
1 parent 106748e commit e83603a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions index.js
@@ -1,11 +1,13 @@
import * as tty from "tty"

const env = process.env || {}
const argv = process.argv || []
const proc = typeof process === "undefined" ? {} : process

const env = proc.env || {}
const argv = proc.argv || []

const isDisabled = "NO_COLOR" in env || argv.includes("--no-color")
const isForced = "FORCE_COLOR" in env || argv.includes("--color")
const isWindows = process.platform === "win32"
const isWindows = proc.platform === "win32"
const isDumbTerminal = env.TERM === "dumb"

const isCompatibleTerminal =
Expand Down

0 comments on commit e83603a

Please sign in to comment.