Skip to content

Commit

Permalink
refactor: remove property from env
Browse files Browse the repository at this point in the history
color is only used inside the parse-env function and can be made local
  • Loading branch information
ComradeVanti committed Dec 14, 2023
1 parent f34f958 commit 36acaa5
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/utils/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ type Region = "us" | "cn";

export type Env = {
cwd: string;
color: boolean;
systemUser: boolean;
wsl: boolean;
upstream: boolean;
Expand All @@ -58,7 +57,6 @@ export const parseEnv = async function (
env.cwd = "";
env.namespace = openUpmReverseDomainName;
env.upstream = true;
env.color = true;
env.upstreamRegistry = {
url: registryUrl("https://packages.unity.com"),
auth: null,
Expand All @@ -70,9 +68,9 @@ export const parseEnv = async function (
// log level
log.level = options._global.verbose ? "verbose" : "notice";
// color
if (options._global.color === false) env.color = false;
if (process.env.NODE_ENV == "test") env.color = false;
if (!env.color) {
const useColor =
options._global.color === true && process.env.NOVE_ENV !== "test";
if (!useColor) {
chalk.level = 0;
log.disableColor();
}
Expand Down

0 comments on commit 36acaa5

Please sign in to comment.