std-env 2.3.0 → 3.0.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/LICENCE +22 -0
- package/README.md +32 -28
- package/dist/index.cjs +100 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.mjs +84 -0
- package/package.json +20 -13
- package/index.d.ts +0 -20
- package/index.js +0 -70
package/LICENCE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 UnJS
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
package/README.md
CHANGED
|
@@ -1,48 +1,52 @@
|
|
|
1
1
|
# std-env
|
|
2
2
|
|
|
3
|
-
[](http://npmjs.com/package/std-env)
|
|
4
4
|
[](http://npmjs.com/package/std-env)
|
|
5
|
+
[](https://bundlephobia.com/result?p=std-env)
|
|
5
6
|
|
|
6
|
-
Detect
|
|
7
|
+
> Detect current Javascript environment
|
|
7
8
|
|
|
8
9
|
## Installation
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
```
|
|
11
|
+
```sh
|
|
12
|
+
# Using Yarn
|
|
13
13
|
yarn add std-env
|
|
14
|
-
```
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
```
|
|
15
|
+
# Using npm
|
|
19
16
|
npm i std-env
|
|
20
17
|
```
|
|
21
18
|
|
|
22
19
|
## Usage
|
|
23
20
|
|
|
24
21
|
```js
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
{
|
|
31
|
-
browser: false,
|
|
32
|
-
test: false,
|
|
33
|
-
dev: true,
|
|
34
|
-
production: false,
|
|
35
|
-
debug: false,
|
|
36
|
-
ci: false,
|
|
37
|
-
tty: true,
|
|
38
|
-
minimalCLI: false,
|
|
39
|
-
windows: false,
|
|
40
|
-
darwin: true,
|
|
41
|
-
linux: false
|
|
42
|
-
}
|
|
43
|
-
*/
|
|
22
|
+
// ESM
|
|
23
|
+
import { isWindows } from 'std-env'
|
|
24
|
+
|
|
25
|
+
// CommonJS
|
|
26
|
+
const { isCI } = require('std-env')
|
|
44
27
|
```
|
|
45
28
|
|
|
29
|
+
Available exports:
|
|
30
|
+
|
|
31
|
+
- `hasTTY`
|
|
32
|
+
- `hasWindow`
|
|
33
|
+
- `isCI`
|
|
34
|
+
- `isDebug`
|
|
35
|
+
- `isDevelopment`
|
|
36
|
+
- `isLinux`
|
|
37
|
+
- `isMacOS`
|
|
38
|
+
- `isMinimal`
|
|
39
|
+
- `isProduction`
|
|
40
|
+
- `isTest`
|
|
41
|
+
- `isWindows`
|
|
42
|
+
- `platform`
|
|
43
|
+
- `provider`
|
|
44
|
+
|
|
45
|
+
You can read more about how each flag works from [./src/index.ts](./src/index.ts).
|
|
46
|
+
|
|
47
|
+
List of well known providers can be found from [./src/providers.ts](./src/providers.ts).
|
|
48
|
+
|
|
49
|
+
|
|
46
50
|
## License
|
|
47
51
|
|
|
48
52
|
MIT
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
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
|
+
};
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
name: ""
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const processShim = typeof process !== "undefined" ? process : {};
|
|
68
|
+
const envShim = processShim.env || {};
|
|
69
|
+
const providerInfo = detectProvider(envShim);
|
|
70
|
+
const nodeENV = envShim.NODE_ENV || "";
|
|
71
|
+
const platform = processShim.platform;
|
|
72
|
+
const provider = providerInfo.name;
|
|
73
|
+
const isCI = toBoolean(envShim.CI) || providerInfo.ci !== false;
|
|
74
|
+
const hasTTY = toBoolean(processShim.stdout && processShim.stdout.isTTY);
|
|
75
|
+
const hasWindow = typeof window !== "undefined";
|
|
76
|
+
const isDebug = toBoolean(envShim.DEBUG);
|
|
77
|
+
const isTest = toBoolean(envShim.TEST);
|
|
78
|
+
const isProduction = nodeENV === "production";
|
|
79
|
+
const isDevelopment = nodeENV === "dev" || nodeENV === "development";
|
|
80
|
+
const isMinimal = toBoolean(envShim.MINIMAL) || isCI || isTest || !hasTTY;
|
|
81
|
+
const isWindows = /^win/i.test(platform);
|
|
82
|
+
const isLinux = /^linux/i.test(platform);
|
|
83
|
+
const isMacOS = /^darwin/i.test(platform);
|
|
84
|
+
function toBoolean(val) {
|
|
85
|
+
return val ? val !== "false" : false;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
exports.hasTTY = hasTTY;
|
|
89
|
+
exports.hasWindow = hasWindow;
|
|
90
|
+
exports.isCI = isCI;
|
|
91
|
+
exports.isDebug = isDebug;
|
|
92
|
+
exports.isDevelopment = isDevelopment;
|
|
93
|
+
exports.isLinux = isLinux;
|
|
94
|
+
exports.isMacOS = isMacOS;
|
|
95
|
+
exports.isMinimal = isMinimal;
|
|
96
|
+
exports.isProduction = isProduction;
|
|
97
|
+
exports.isTest = isTest;
|
|
98
|
+
exports.isWindows = isWindows;
|
|
99
|
+
exports.platform = platform;
|
|
100
|
+
exports.provider = provider;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
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';
|
|
2
|
+
declare type ProviderInfo = {
|
|
3
|
+
name: ProviderName;
|
|
4
|
+
[meta: string]: any;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
/** Value of process.platform */
|
|
8
|
+
declare const platform: NodeJS.Platform;
|
|
9
|
+
/** Current provider name */
|
|
10
|
+
declare const provider: ProviderName;
|
|
11
|
+
/** Detect if `CI` environment variable is set or a provider CI detected */
|
|
12
|
+
declare const isCI: boolean;
|
|
13
|
+
/** Detect if stdout.TTY is available */
|
|
14
|
+
declare const hasTTY: boolean;
|
|
15
|
+
/** Detect if global `window` object is available */
|
|
16
|
+
declare const hasWindow: boolean;
|
|
17
|
+
/** Detect if `DEBUG` environment variable is set */
|
|
18
|
+
declare const isDebug: boolean;
|
|
19
|
+
/** Detect if `NODE_ENV` environment variable is `test` */
|
|
20
|
+
declare const isTest: boolean;
|
|
21
|
+
/** Detect if `NODE_ENV` environment variable is `production` */
|
|
22
|
+
declare const isProduction: boolean;
|
|
23
|
+
/** Detect if `NODE_ENV` environment variable is `dev` or `development` */
|
|
24
|
+
declare const isDevelopment: boolean;
|
|
25
|
+
/** Detect if MINIMAL environment variable is set, running in CI or test or TTY is unavailable */
|
|
26
|
+
declare const isMinimal: boolean;
|
|
27
|
+
/** Detect if process.platform is Windows */
|
|
28
|
+
declare const isWindows: boolean;
|
|
29
|
+
/** Detect if process.platform is Linux */
|
|
30
|
+
declare const isLinux: boolean;
|
|
31
|
+
/** Detect if process.platform is macOS (darwin kernel) */
|
|
32
|
+
declare const isMacOS: boolean;
|
|
33
|
+
|
|
34
|
+
export { ProviderInfo, ProviderName, hasTTY, hasWindow, isCI, isDebug, isDevelopment, isLinux, isMacOS, isMinimal, isProduction, isTest, isWindows, platform, provider };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
const providers = [
|
|
2
|
+
["APPVEYOR"],
|
|
3
|
+
["AZURE_PIPELINES", "SYSTEM_TEAMFOUNDATIONCOLLECTIONURI"],
|
|
4
|
+
["AZURE_STATIC", "INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN"],
|
|
5
|
+
["APPCIRCLE", "AC_APPCIRCLE"],
|
|
6
|
+
["BAMBOO", "bamboo_planKey"],
|
|
7
|
+
["BITBUCKET", "BITBUCKET_COMMIT"],
|
|
8
|
+
["BITRISE", "BITRISE_IO"],
|
|
9
|
+
["BUDDY", "BUDDY_WORKSPACE_ID"],
|
|
10
|
+
["BUILDKITE"],
|
|
11
|
+
["CIRCLE", "CIRCLECI"],
|
|
12
|
+
["CIRRUS", "CIRRUS_CI"],
|
|
13
|
+
["CODEBUILD", "CODEBUILD_BUILD_ARN"],
|
|
14
|
+
["CODEFRESH", "CF_BUILD_ID"],
|
|
15
|
+
["DRONE"],
|
|
16
|
+
["DRONE", "DRONE_BUILD_EVENT"],
|
|
17
|
+
["DSARI"],
|
|
18
|
+
["GITHUB_ACTIONS"],
|
|
19
|
+
["GITLAB", "GITLAB_CI"],
|
|
20
|
+
["GITLAB", "CI_MERGE_REQUEST_ID"],
|
|
21
|
+
["GOCD", "GO_PIPELINE_LABEL"],
|
|
22
|
+
["LAYERCI"],
|
|
23
|
+
["HUDSON", "HUDSON_URL"],
|
|
24
|
+
["JENKINS", "JENKINS_URL"],
|
|
25
|
+
["MAGNUM"],
|
|
26
|
+
["NETLIFY"],
|
|
27
|
+
["NETLIFY", "NETLIFY_LOCAL", { ci: false }],
|
|
28
|
+
["NEVERCODE"],
|
|
29
|
+
["RENDER"],
|
|
30
|
+
["SAIL", "SAILCI"],
|
|
31
|
+
["SEMAPHORE"],
|
|
32
|
+
["SCREWDRIVER"],
|
|
33
|
+
["SHIPPABLE"],
|
|
34
|
+
["SOLANO", "TDDIUM"],
|
|
35
|
+
["STRIDER"],
|
|
36
|
+
["TEAMCITY", "TEAMCITY_VERSION"],
|
|
37
|
+
["TRAVIS"],
|
|
38
|
+
["VERCEL", "NOW_BUILDER"],
|
|
39
|
+
["APPCENTER", "APPCENTER_BUILD_ID"],
|
|
40
|
+
["CODESANDBOX", "CODESANDBOX_SSE", { ci: false }],
|
|
41
|
+
["STACKBLITZ"]
|
|
42
|
+
];
|
|
43
|
+
function detectProvider(env) {
|
|
44
|
+
for (const provider of providers) {
|
|
45
|
+
const envName = provider[1] || provider[0];
|
|
46
|
+
if (env[envName]) {
|
|
47
|
+
return {
|
|
48
|
+
name: provider[0].toLowerCase(),
|
|
49
|
+
...provider[2]
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
if (env.SHELL && env.SHELL === "/bin/jsh") {
|
|
54
|
+
return {
|
|
55
|
+
name: "stackblitz"
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
name: ""
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const processShim = typeof process !== "undefined" ? process : {};
|
|
64
|
+
const envShim = processShim.env || {};
|
|
65
|
+
const providerInfo = detectProvider(envShim);
|
|
66
|
+
const nodeENV = envShim.NODE_ENV || "";
|
|
67
|
+
const platform = processShim.platform;
|
|
68
|
+
const provider = providerInfo.name;
|
|
69
|
+
const isCI = toBoolean(envShim.CI) || providerInfo.ci !== false;
|
|
70
|
+
const hasTTY = toBoolean(processShim.stdout && processShim.stdout.isTTY);
|
|
71
|
+
const hasWindow = typeof window !== "undefined";
|
|
72
|
+
const isDebug = toBoolean(envShim.DEBUG);
|
|
73
|
+
const isTest = toBoolean(envShim.TEST);
|
|
74
|
+
const isProduction = nodeENV === "production";
|
|
75
|
+
const isDevelopment = nodeENV === "dev" || nodeENV === "development";
|
|
76
|
+
const isMinimal = toBoolean(envShim.MINIMAL) || isCI || isTest || !hasTTY;
|
|
77
|
+
const isWindows = /^win/i.test(platform);
|
|
78
|
+
const isLinux = /^linux/i.test(platform);
|
|
79
|
+
const isMacOS = /^darwin/i.test(platform);
|
|
80
|
+
function toBoolean(val) {
|
|
81
|
+
return val ? val !== "false" : false;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export { hasTTY, hasWindow, isCI, isDebug, isDevelopment, isLinux, isMacOS, isMinimal, isProduction, isTest, isWindows, platform, provider };
|
package/package.json
CHANGED
|
@@ -1,19 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "std-env",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Detect
|
|
3
|
+
"version": "3.0.0",
|
|
4
|
+
"description": "Detect current Javascript environment",
|
|
5
|
+
"repository": "unjs/std-env",
|
|
5
6
|
"license": "MIT",
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
"Pooya Parsa <pooya@pi0.ir>"
|
|
11
|
-
],
|
|
12
|
-
"dependencies": {
|
|
13
|
-
"ci-info": "^3.0.0"
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"exports": {
|
|
9
|
+
"import": "./dist/index.mjs",
|
|
10
|
+
"require": "./dist/index.cjs"
|
|
14
11
|
},
|
|
12
|
+
"main": "./dist/index.cjs",
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
15
14
|
"files": [
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
"dist"
|
|
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
|
+
"devDependencies": {
|
|
23
|
+
"standard-version": "^9.3.2",
|
|
24
|
+
"unbuild": "^0.5.11"
|
|
25
|
+
}
|
|
19
26
|
}
|
package/index.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
declare const env: {
|
|
2
|
-
readonly browser: boolean
|
|
3
|
-
|
|
4
|
-
readonly test: boolean
|
|
5
|
-
readonly dev: boolean
|
|
6
|
-
readonly production: boolean
|
|
7
|
-
readonly debug: boolean
|
|
8
|
-
|
|
9
|
-
readonly ci: boolean
|
|
10
|
-
readonly tty: boolean
|
|
11
|
-
|
|
12
|
-
readonly minimal: boolean
|
|
13
|
-
readonly minimalCLI: boolean
|
|
14
|
-
|
|
15
|
-
readonly windows: boolean
|
|
16
|
-
readonly darwin: boolean
|
|
17
|
-
readonly linux: boolean
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export default env;
|
package/index.js
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
// Gather initial information
|
|
2
|
-
var isCI = false
|
|
3
|
-
var debug = false
|
|
4
|
-
var tty = false
|
|
5
|
-
var nodeENV = 'development'
|
|
6
|
-
var browser = typeof window !== 'undefined'
|
|
7
|
-
var platform = ''
|
|
8
|
-
var minimal = false
|
|
9
|
-
|
|
10
|
-
// Boolean helper
|
|
11
|
-
function toBoolean(val) {
|
|
12
|
-
return (!val || val === 'false') ? false : true
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
// Process dependent
|
|
16
|
-
if (typeof process !== 'undefined') {
|
|
17
|
-
// Platform
|
|
18
|
-
if (process.platform) {
|
|
19
|
-
platform = String(process.platform)
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// TTY
|
|
23
|
-
if (process.stdout) {
|
|
24
|
-
tty = toBoolean(process.stdout.isTTY)
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// Is CI
|
|
28
|
-
isCI = Boolean(require('ci-info').isCI)
|
|
29
|
-
|
|
30
|
-
// Env dependent
|
|
31
|
-
if (process.env) {
|
|
32
|
-
// NODE_ENV
|
|
33
|
-
if (process.env.NODE_ENV) {
|
|
34
|
-
nodeENV = process.env.NODE_ENV
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// DEBUG
|
|
38
|
-
debug = toBoolean(process.env.DEBUG)
|
|
39
|
-
|
|
40
|
-
// MINIMAL
|
|
41
|
-
minimal = toBoolean(process.env.MINIMAL)
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// Construct env object
|
|
46
|
-
var env = {
|
|
47
|
-
browser: browser,
|
|
48
|
-
|
|
49
|
-
test: nodeENV === 'test',
|
|
50
|
-
dev: nodeENV === 'development' || nodeENV === 'dev',
|
|
51
|
-
production: nodeENV === 'production',
|
|
52
|
-
debug: debug,
|
|
53
|
-
|
|
54
|
-
ci: isCI,
|
|
55
|
-
tty: tty,
|
|
56
|
-
|
|
57
|
-
minimal: undefined,
|
|
58
|
-
minimalCLI: undefined,
|
|
59
|
-
|
|
60
|
-
windows: /^win/i.test(platform),
|
|
61
|
-
darwin: /^darwin/i.test(platform),
|
|
62
|
-
linux: /^linux/i.test(platform),
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// Compute minimal
|
|
66
|
-
env.minimal = minimal || env.ci || env.test || !env.tty
|
|
67
|
-
env.minimalCLI = env.minimal
|
|
68
|
-
|
|
69
|
-
// Export env
|
|
70
|
-
module.exports = Object.freeze(env)
|