std-env 3.0.1 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +2 -1
- package/package.json +18 -9
- package/dist/index.cjs +0 -102
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
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';
|
|
1
|
+
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' | 'stormkit';
|
|
2
2
|
declare type ProviderInfo = {
|
|
3
3
|
name: ProviderName;
|
|
4
4
|
[meta: string]: any;
|
package/dist/index.mjs
CHANGED
|
@@ -38,7 +38,8 @@ const providers = [
|
|
|
38
38
|
["VERCEL", "NOW_BUILDER"],
|
|
39
39
|
["APPCENTER", "APPCENTER_BUILD_ID"],
|
|
40
40
|
["CODESANDBOX", "CODESANDBOX_SSE", { ci: false }],
|
|
41
|
-
["STACKBLITZ"]
|
|
41
|
+
["STACKBLITZ"],
|
|
42
|
+
["STORMKIT"]
|
|
42
43
|
];
|
|
43
44
|
function detectProvider(env) {
|
|
44
45
|
for (const provider of providers) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "std-env",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "Detect current Javascript environment",
|
|
5
5
|
"repository": "unjs/std-env",
|
|
6
6
|
"license": "MIT",
|
|
@@ -14,13 +14,22 @@
|
|
|
14
14
|
"files": [
|
|
15
15
|
"dist"
|
|
16
16
|
],
|
|
17
|
-
"scripts": {
|
|
18
|
-
"prepack": "unbuild",
|
|
19
|
-
"release": "yarn test && standard-version && git push --follow-tags && npm publish",
|
|
20
|
-
"test": "node test.cjs"
|
|
21
|
-
},
|
|
22
17
|
"devDependencies": {
|
|
18
|
+
"@nuxtjs/eslint-config-typescript": "^9.0.0",
|
|
19
|
+
"c8": "^7.11.0",
|
|
20
|
+
"eslint": "^8.13.0",
|
|
21
|
+
"jiti": "^1.13.0",
|
|
23
22
|
"standard-version": "^9.3.2",
|
|
24
|
-
"unbuild": "^0.
|
|
25
|
-
|
|
26
|
-
}
|
|
23
|
+
"unbuild": "^0.7.4",
|
|
24
|
+
"vitest": "^0.9.3"
|
|
25
|
+
},
|
|
26
|
+
"packageManager": "pnpm@6.32.7",
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "unbuild",
|
|
29
|
+
"dev": "vitest",
|
|
30
|
+
"lint": "eslint --ext .ts .",
|
|
31
|
+
"release": "pnpm test && standard-version && git push --follow-tags && pnpm publish",
|
|
32
|
+
"test": "pnpm lint && vitest run"
|
|
33
|
+
},
|
|
34
|
+
"readme": "# std-env\n\n[](http://npmjs.com/package/std-env)\n[](http://npmjs.com/package/std-env)\n[](https://bundlephobia.com/result?p=std-env)\n\n> Detect current Javascript environment\n\n## Installation\n\n```sh\n# Using Yarn\nyarn add std-env\n\n# Using npm\nnpm i std-env\n```\n\n## Usage\n\n```js\n// ESM\nimport { isWindows } from 'std-env'\n\n// CommonJS\nconst { isCI } = require('std-env')\n```\n\nAvailable exports:\n\n- `hasTTY`\n- `hasWindow`\n- `isCI`\n- `isDebug`\n- `isDevelopment`\n- `isLinux`\n- `isMacOS`\n- `isMinimal`\n- `isProduction`\n- `isTest`\n- `isWindows`\n- `platform`\n- `provider`\n\nYou can read more about how each flag works from [./src/index.ts](./src/index.ts).\n\nList of well known providers can be found from [./src/providers.ts](./src/providers.ts).\n\n\n## License\n\nMIT\n"
|
|
35
|
+
}
|
package/dist/index.cjs
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
const providers = [
|
|
6
|
-
["APPVEYOR"],
|
|
7
|
-
["AZURE_PIPELINES", "SYSTEM_TEAMFOUNDATIONCOLLECTIONURI"],
|
|
8
|
-
["AZURE_STATIC", "INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN"],
|
|
9
|
-
["APPCIRCLE", "AC_APPCIRCLE"],
|
|
10
|
-
["BAMBOO", "bamboo_planKey"],
|
|
11
|
-
["BITBUCKET", "BITBUCKET_COMMIT"],
|
|
12
|
-
["BITRISE", "BITRISE_IO"],
|
|
13
|
-
["BUDDY", "BUDDY_WORKSPACE_ID"],
|
|
14
|
-
["BUILDKITE"],
|
|
15
|
-
["CIRCLE", "CIRCLECI"],
|
|
16
|
-
["CIRRUS", "CIRRUS_CI"],
|
|
17
|
-
["CODEBUILD", "CODEBUILD_BUILD_ARN"],
|
|
18
|
-
["CODEFRESH", "CF_BUILD_ID"],
|
|
19
|
-
["DRONE"],
|
|
20
|
-
["DRONE", "DRONE_BUILD_EVENT"],
|
|
21
|
-
["DSARI"],
|
|
22
|
-
["GITHUB_ACTIONS"],
|
|
23
|
-
["GITLAB", "GITLAB_CI"],
|
|
24
|
-
["GITLAB", "CI_MERGE_REQUEST_ID"],
|
|
25
|
-
["GOCD", "GO_PIPELINE_LABEL"],
|
|
26
|
-
["LAYERCI"],
|
|
27
|
-
["HUDSON", "HUDSON_URL"],
|
|
28
|
-
["JENKINS", "JENKINS_URL"],
|
|
29
|
-
["MAGNUM"],
|
|
30
|
-
["NETLIFY"],
|
|
31
|
-
["NETLIFY", "NETLIFY_LOCAL", { ci: false }],
|
|
32
|
-
["NEVERCODE"],
|
|
33
|
-
["RENDER"],
|
|
34
|
-
["SAIL", "SAILCI"],
|
|
35
|
-
["SEMAPHORE"],
|
|
36
|
-
["SCREWDRIVER"],
|
|
37
|
-
["SHIPPABLE"],
|
|
38
|
-
["SOLANO", "TDDIUM"],
|
|
39
|
-
["STRIDER"],
|
|
40
|
-
["TEAMCITY", "TEAMCITY_VERSION"],
|
|
41
|
-
["TRAVIS"],
|
|
42
|
-
["VERCEL", "NOW_BUILDER"],
|
|
43
|
-
["APPCENTER", "APPCENTER_BUILD_ID"],
|
|
44
|
-
["CODESANDBOX", "CODESANDBOX_SSE", { ci: false }],
|
|
45
|
-
["STACKBLITZ"]
|
|
46
|
-
];
|
|
47
|
-
function detectProvider(env) {
|
|
48
|
-
for (const provider of providers) {
|
|
49
|
-
const envName = provider[1] || provider[0];
|
|
50
|
-
if (env[envName]) {
|
|
51
|
-
return {
|
|
52
|
-
name: provider[0].toLowerCase(),
|
|
53
|
-
...provider[2]
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
if (env.SHELL && env.SHELL === "/bin/jsh") {
|
|
58
|
-
return {
|
|
59
|
-
name: "stackblitz",
|
|
60
|
-
ci: false
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
return {
|
|
64
|
-
name: "",
|
|
65
|
-
ci: false
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const processShim = typeof process !== "undefined" ? process : {};
|
|
70
|
-
const envShim = processShim.env || {};
|
|
71
|
-
const providerInfo = detectProvider(envShim);
|
|
72
|
-
const nodeENV = envShim.NODE_ENV || "";
|
|
73
|
-
const platform = processShim.platform;
|
|
74
|
-
const provider = providerInfo.name;
|
|
75
|
-
const isCI = toBoolean(envShim.CI) || providerInfo.ci !== false;
|
|
76
|
-
const hasTTY = toBoolean(processShim.stdout && processShim.stdout.isTTY);
|
|
77
|
-
const hasWindow = typeof window !== "undefined";
|
|
78
|
-
const isDebug = toBoolean(envShim.DEBUG);
|
|
79
|
-
const isTest = toBoolean(envShim.TEST);
|
|
80
|
-
const isProduction = nodeENV === "production";
|
|
81
|
-
const isDevelopment = nodeENV === "dev" || nodeENV === "development";
|
|
82
|
-
const isMinimal = toBoolean(envShim.MINIMAL) || isCI || isTest || !hasTTY;
|
|
83
|
-
const isWindows = /^win/i.test(platform);
|
|
84
|
-
const isLinux = /^linux/i.test(platform);
|
|
85
|
-
const isMacOS = /^darwin/i.test(platform);
|
|
86
|
-
function toBoolean(val) {
|
|
87
|
-
return val ? val !== "false" : false;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
exports.hasTTY = hasTTY;
|
|
91
|
-
exports.hasWindow = hasWindow;
|
|
92
|
-
exports.isCI = isCI;
|
|
93
|
-
exports.isDebug = isDebug;
|
|
94
|
-
exports.isDevelopment = isDevelopment;
|
|
95
|
-
exports.isLinux = isLinux;
|
|
96
|
-
exports.isMacOS = isMacOS;
|
|
97
|
-
exports.isMinimal = isMinimal;
|
|
98
|
-
exports.isProduction = isProduction;
|
|
99
|
-
exports.isTest = isTest;
|
|
100
|
-
exports.isWindows = isWindows;
|
|
101
|
-
exports.platform = platform;
|
|
102
|
-
exports.provider = provider;
|