ui
This commit is contained in:
+102
@@ -0,0 +1,102 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
const providers = [
|
||||
["APPVEYOR"],
|
||||
["AZURE_PIPELINES", "SYSTEM_TEAMFOUNDATIONCOLLECTIONURI"],
|
||||
["AZURE_STATIC", "INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN"],
|
||||
["APPCIRCLE", "AC_APPCIRCLE"],
|
||||
["BAMBOO", "bamboo_planKey"],
|
||||
["BITBUCKET", "BITBUCKET_COMMIT"],
|
||||
["BITRISE", "BITRISE_IO"],
|
||||
["BUDDY", "BUDDY_WORKSPACE_ID"],
|
||||
["BUILDKITE"],
|
||||
["CIRCLE", "CIRCLECI"],
|
||||
["CIRRUS", "CIRRUS_CI"],
|
||||
["CODEBUILD", "CODEBUILD_BUILD_ARN"],
|
||||
["CODEFRESH", "CF_BUILD_ID"],
|
||||
["DRONE"],
|
||||
["DRONE", "DRONE_BUILD_EVENT"],
|
||||
["DSARI"],
|
||||
["GITHUB_ACTIONS"],
|
||||
["GITLAB", "GITLAB_CI"],
|
||||
["GITLAB", "CI_MERGE_REQUEST_ID"],
|
||||
["GOCD", "GO_PIPELINE_LABEL"],
|
||||
["LAYERCI"],
|
||||
["HUDSON", "HUDSON_URL"],
|
||||
["JENKINS", "JENKINS_URL"],
|
||||
["MAGNUM"],
|
||||
["NETLIFY"],
|
||||
["NETLIFY", "NETLIFY_LOCAL", { ci: false }],
|
||||
["NEVERCODE"],
|
||||
["RENDER"],
|
||||
["SAIL", "SAILCI"],
|
||||
["SEMAPHORE"],
|
||||
["SCREWDRIVER"],
|
||||
["SHIPPABLE"],
|
||||
["SOLANO", "TDDIUM"],
|
||||
["STRIDER"],
|
||||
["TEAMCITY", "TEAMCITY_VERSION"],
|
||||
["TRAVIS"],
|
||||
["VERCEL", "NOW_BUILDER"],
|
||||
["APPCENTER", "APPCENTER_BUILD_ID"],
|
||||
["CODESANDBOX", "CODESANDBOX_SSE", { ci: false }],
|
||||
["STACKBLITZ"]
|
||||
];
|
||||
function detectProvider(env) {
|
||||
for (const provider of providers) {
|
||||
const envName = provider[1] || provider[0];
|
||||
if (env[envName]) {
|
||||
return {
|
||||
name: provider[0].toLowerCase(),
|
||||
...provider[2]
|
||||
};
|
||||
}
|
||||
}
|
||||
if (env.SHELL && env.SHELL === "/bin/jsh") {
|
||||
return {
|
||||
name: "stackblitz",
|
||||
ci: false
|
||||
};
|
||||
}
|
||||
return {
|
||||
name: "",
|
||||
ci: false
|
||||
};
|
||||
}
|
||||
|
||||
const processShim = typeof process !== "undefined" ? process : {};
|
||||
const envShim = processShim.env || {};
|
||||
const providerInfo = detectProvider(envShim);
|
||||
const nodeENV = envShim.NODE_ENV || "";
|
||||
const platform = processShim.platform;
|
||||
const provider = providerInfo.name;
|
||||
const isCI = toBoolean(envShim.CI) || providerInfo.ci !== false;
|
||||
const hasTTY = toBoolean(processShim.stdout && processShim.stdout.isTTY);
|
||||
const hasWindow = typeof window !== "undefined";
|
||||
const isDebug = toBoolean(envShim.DEBUG);
|
||||
const isTest = toBoolean(envShim.TEST);
|
||||
const isProduction = nodeENV === "production";
|
||||
const isDevelopment = nodeENV === "dev" || nodeENV === "development";
|
||||
const isMinimal = toBoolean(envShim.MINIMAL) || isCI || isTest || !hasTTY;
|
||||
const isWindows = /^win/i.test(platform);
|
||||
const isLinux = /^linux/i.test(platform);
|
||||
const isMacOS = /^darwin/i.test(platform);
|
||||
function toBoolean(val) {
|
||||
return val ? val !== "false" : false;
|
||||
}
|
||||
|
||||
exports.hasTTY = hasTTY;
|
||||
exports.hasWindow = hasWindow;
|
||||
exports.isCI = isCI;
|
||||
exports.isDebug = isDebug;
|
||||
exports.isDevelopment = isDevelopment;
|
||||
exports.isLinux = isLinux;
|
||||
exports.isMacOS = isMacOS;
|
||||
exports.isMinimal = isMinimal;
|
||||
exports.isProduction = isProduction;
|
||||
exports.isTest = isTest;
|
||||
exports.isWindows = isWindows;
|
||||
exports.platform = platform;
|
||||
exports.provider = provider;
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
declare type ProviderName = '' | 'appveyor' | 'azure_pipelines' | 'azure_static' | 'appcircle' | 'bamboo' | 'bitbucket' | 'bitrise' | 'buddy' | 'buildkite' | 'circle' | 'cirrus' | 'codebuild' | 'codefresh' | 'drone' | 'drone' | 'dsari' | 'github_actions' | 'gitlab' | 'gitlab' | 'gocd' | 'layerci' | 'hudson' | 'jenkins' | 'magnum' | 'netlify' | 'netlify' | 'nevercode' | 'render' | 'sail' | 'semaphore' | 'screwdriver' | 'shippable' | 'solano' | 'strider' | 'teamcity' | 'travis' | 'vercel' | 'appcenter' | 'codesandbox' | 'stackblitz';
|
||||
declare type ProviderInfo = {
|
||||
name: ProviderName;
|
||||
[meta: string]: any;
|
||||
};
|
||||
|
||||
/** Value of process.platform */
|
||||
declare const platform: NodeJS.Platform;
|
||||
/** Current provider name */
|
||||
declare const provider: ProviderName;
|
||||
/** Detect if `CI` environment variable is set or a provider CI detected */
|
||||
declare const isCI: boolean;
|
||||
/** Detect if stdout.TTY is available */
|
||||
declare const hasTTY: boolean;
|
||||
/** Detect if global `window` object is available */
|
||||
declare const hasWindow: boolean;
|
||||
/** Detect if `DEBUG` environment variable is set */
|
||||
declare const isDebug: boolean;
|
||||
/** Detect if `NODE_ENV` environment variable is `test` */
|
||||
declare const isTest: boolean;
|
||||
/** Detect if `NODE_ENV` environment variable is `production` */
|
||||
declare const isProduction: boolean;
|
||||
/** Detect if `NODE_ENV` environment variable is `dev` or `development` */
|
||||
declare const isDevelopment: boolean;
|
||||
/** Detect if MINIMAL environment variable is set, running in CI or test or TTY is unavailable */
|
||||
declare const isMinimal: boolean;
|
||||
/** Detect if process.platform is Windows */
|
||||
declare const isWindows: boolean;
|
||||
/** Detect if process.platform is Linux */
|
||||
declare const isLinux: boolean;
|
||||
/** Detect if process.platform is macOS (darwin kernel) */
|
||||
declare const isMacOS: boolean;
|
||||
|
||||
export { ProviderInfo, ProviderName, hasTTY, hasWindow, isCI, isDebug, isDevelopment, isLinux, isMacOS, isMinimal, isProduction, isTest, isWindows, platform, provider };
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
const providers = [
|
||||
["APPVEYOR"],
|
||||
["AZURE_PIPELINES", "SYSTEM_TEAMFOUNDATIONCOLLECTIONURI"],
|
||||
["AZURE_STATIC", "INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN"],
|
||||
["APPCIRCLE", "AC_APPCIRCLE"],
|
||||
["BAMBOO", "bamboo_planKey"],
|
||||
["BITBUCKET", "BITBUCKET_COMMIT"],
|
||||
["BITRISE", "BITRISE_IO"],
|
||||
["BUDDY", "BUDDY_WORKSPACE_ID"],
|
||||
["BUILDKITE"],
|
||||
["CIRCLE", "CIRCLECI"],
|
||||
["CIRRUS", "CIRRUS_CI"],
|
||||
["CODEBUILD", "CODEBUILD_BUILD_ARN"],
|
||||
["CODEFRESH", "CF_BUILD_ID"],
|
||||
["DRONE"],
|
||||
["DRONE", "DRONE_BUILD_EVENT"],
|
||||
["DSARI"],
|
||||
["GITHUB_ACTIONS"],
|
||||
["GITLAB", "GITLAB_CI"],
|
||||
["GITLAB", "CI_MERGE_REQUEST_ID"],
|
||||
["GOCD", "GO_PIPELINE_LABEL"],
|
||||
["LAYERCI"],
|
||||
["HUDSON", "HUDSON_URL"],
|
||||
["JENKINS", "JENKINS_URL"],
|
||||
["MAGNUM"],
|
||||
["NETLIFY"],
|
||||
["NETLIFY", "NETLIFY_LOCAL", { ci: false }],
|
||||
["NEVERCODE"],
|
||||
["RENDER"],
|
||||
["SAIL", "SAILCI"],
|
||||
["SEMAPHORE"],
|
||||
["SCREWDRIVER"],
|
||||
["SHIPPABLE"],
|
||||
["SOLANO", "TDDIUM"],
|
||||
["STRIDER"],
|
||||
["TEAMCITY", "TEAMCITY_VERSION"],
|
||||
["TRAVIS"],
|
||||
["VERCEL", "NOW_BUILDER"],
|
||||
["APPCENTER", "APPCENTER_BUILD_ID"],
|
||||
["CODESANDBOX", "CODESANDBOX_SSE", { ci: false }],
|
||||
["STACKBLITZ"]
|
||||
];
|
||||
function detectProvider(env) {
|
||||
for (const provider of providers) {
|
||||
const envName = provider[1] || provider[0];
|
||||
if (env[envName]) {
|
||||
return {
|
||||
name: provider[0].toLowerCase(),
|
||||
...provider[2]
|
||||
};
|
||||
}
|
||||
}
|
||||
if (env.SHELL && env.SHELL === "/bin/jsh") {
|
||||
return {
|
||||
name: "stackblitz",
|
||||
ci: false
|
||||
};
|
||||
}
|
||||
return {
|
||||
name: "",
|
||||
ci: false
|
||||
};
|
||||
}
|
||||
|
||||
const processShim = typeof process !== "undefined" ? process : {};
|
||||
const envShim = processShim.env || {};
|
||||
const providerInfo = detectProvider(envShim);
|
||||
const nodeENV = envShim.NODE_ENV || "";
|
||||
const platform = processShim.platform;
|
||||
const provider = providerInfo.name;
|
||||
const isCI = toBoolean(envShim.CI) || providerInfo.ci !== false;
|
||||
const hasTTY = toBoolean(processShim.stdout && processShim.stdout.isTTY);
|
||||
const hasWindow = typeof window !== "undefined";
|
||||
const isDebug = toBoolean(envShim.DEBUG);
|
||||
const isTest = toBoolean(envShim.TEST);
|
||||
const isProduction = nodeENV === "production";
|
||||
const isDevelopment = nodeENV === "dev" || nodeENV === "development";
|
||||
const isMinimal = toBoolean(envShim.MINIMAL) || isCI || isTest || !hasTTY;
|
||||
const isWindows = /^win/i.test(platform);
|
||||
const isLinux = /^linux/i.test(platform);
|
||||
const isMacOS = /^darwin/i.test(platform);
|
||||
function toBoolean(val) {
|
||||
return val ? val !== "false" : false;
|
||||
}
|
||||
|
||||
export { hasTTY, hasWindow, isCI, isDebug, isDevelopment, isLinux, isMacOS, isMinimal, isProduction, isTest, isWindows, platform, provider };
|
||||
Reference in New Issue
Block a user