forked from angular/angular-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenvironment-options.ts
33 lines (27 loc) · 1.13 KB
/
environment-options.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
function isPresent(variable: string | undefined): variable is string {
return typeof variable === 'string' && variable !== '';
}
function isDisabled(variable: string | undefined): boolean {
return isPresent(variable) && (variable === '0' || variable.toLowerCase() === 'false');
}
function isEnabled(variable: string | undefined): boolean {
return isPresent(variable) && (variable === '1' || variable.toLowerCase() === 'true');
}
function optional(variable: string | undefined): boolean | undefined {
if (!isPresent(variable)) {
return undefined;
}
return isEnabled(variable);
}
export const analyticsDisabled = isDisabled(process.env['NG_CLI_ANALYTICS']);
export const isCI = isEnabled(process.env['CI']);
export const disableVersionCheck = isEnabled(process.env['NG_DISABLE_VERSION_CHECK']);
export const ngDebug = isEnabled(process.env['NG_DEBUG']);
export const forceAutocomplete = optional(process.env['NG_FORCE_AUTOCOMPLETE']);