Skip to content

Commit

Permalink
feat: expose providerInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Aug 9, 2023
1 parent 1d4ef96 commit 3c547d8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/flags.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
import { detectProvider, ProviderName } from "./providers";
import { env, nodeENV } from "./env";
import { toBoolean } from "./_utils";
import { _process } from "./_process";

const _providerInfo = detectProvider(env);
import { process } from "./process";

/** Value of process.platform */
export const platform = _process.platform;
export const platform = process.platform;

/** Current provider name */
export const provider: ProviderName = _providerInfo.name;
/** Current provider info */
export const providerInfo = detectProvider(env);
export const provider: ProviderName = providerInfo.name;

/** Detect if `CI` environment variable is set or a provider CI detected */
export const isCI = toBoolean(env.CI) || _providerInfo.ci !== false;
export const isCI = toBoolean(env.CI) || providerInfo.ci !== false;

/** Detect if stdout.TTY is available */
export const hasTTY = toBoolean(_process.stdout && _process.stdout.isTTY);
export const hasTTY = toBoolean(process.stdout && process.stdout.isTTY);

/** Detect if global `window` object is available */
export const hasWindow = typeof window !== "undefined";
Expand Down
1 change: 1 addition & 0 deletions test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ describe("std-env", () => {
"env",
"nodeENV",
"platform",
"providerInfo",
"provider",
"isCI",
"hasTTY",
Expand Down

0 comments on commit 3c547d8

Please sign in to comment.