xref: /expo/packages/@expo/cli/src/utils/env.ts (revision ea0d7378)
1import { boolish, int, string } from 'getenv';
2
3// @expo/webpack-config -> expo-pwa -> @expo/image-utils: EXPO_IMAGE_UTILS_NO_SHARP
4
5// TODO: EXPO_CLI_USERNAME, EXPO_CLI_PASSWORD
6
7class Env {
8  /** Enable profiling metrics */
9  get EXPO_PROFILE() {
10    return boolish('EXPO_PROFILE', false);
11  }
12
13  /** Enable debug logging */
14  get EXPO_DEBUG() {
15    return boolish('EXPO_DEBUG', false);
16  }
17
18  /** Enable the beta version of Expo (TODO: Should this just be in the beta version of expo releases?) */
19  get EXPO_BETA() {
20    return boolish('EXPO_BETA', false);
21  }
22
23  /** Enable staging API environment */
24  get EXPO_STAGING() {
25    return boolish('EXPO_STAGING', false);
26  }
27
28  /** Enable local API environment */
29  get EXPO_LOCAL() {
30    return boolish('EXPO_LOCAL', false);
31  }
32
33  /** Is running in non-interactive CI mode */
34  get CI() {
35    return boolish('CI', false);
36  }
37
38  /** Disable telemetry (analytics) */
39  get EXPO_NO_TELEMETRY() {
40    return boolish('EXPO_NO_TELEMETRY', false);
41  }
42
43  /** local directory to the universe repo for testing locally */
44  get EXPO_UNIVERSE_DIR() {
45    return string('EXPO_UNIVERSE_DIR', '');
46  }
47
48  /** @deprecated Default Webpack host string */
49  get WEB_HOST() {
50    return string('WEB_HOST', '0.0.0.0');
51  }
52
53  /** Skip warning users about a dirty git status */
54  get EXPO_NO_GIT_STATUS() {
55    return boolish('EXPO_NO_GIT_STATUS', false);
56  }
57  /** Disable auto web setup */
58  get EXPO_NO_WEB_SETUP() {
59    return boolish('EXPO_NO_WEB_SETUP', false);
60  }
61  /** Disable auto TypeScript setup */
62  get EXPO_NO_TYPESCRIPT_SETUP() {
63    return boolish('EXPO_NO_TYPESCRIPT_SETUP', false);
64  }
65  /** Disable all API caches. Does not disable bundler caches. */
66  get EXPO_NO_CACHE() {
67    return boolish('EXPO_NO_CACHE', false);
68  }
69  /** Enable the experimental interstitial app select page. */
70  get EXPO_ENABLE_INTERSTITIAL_PAGE() {
71    return boolish('EXPO_ENABLE_INTERSTITIAL_PAGE', false);
72  }
73  /** The React Metro port that's baked into react-native scripts and tools. */
74  get RCT_METRO_PORT() {
75    return int('RCT_METRO_PORT', 0);
76  }
77  /** Skip validating the manifest during `export`. */
78  get EXPO_SKIP_MANIFEST_VALIDATION_TOKEN(): boolean {
79    return !!string('EXPO_SKIP_MANIFEST_VALIDATION_TOKEN');
80  }
81
82  /** Public folder path relative to the project root. Default to `public` */
83  get EXPO_PUBLIC_FOLDER(): string {
84    return string('EXPO_PUBLIC_FOLDER', 'public');
85  }
86}
87
88export const env = new Env();
89