xref: /expo/packages/@expo/config/build/Config.d.ts (revision f2fbea2e)
1import { AppJSONConfig, ConfigFilePaths, ExpoConfig, ExpRc, GetConfigOptions, PackageJSONConfig, ProjectConfig, ProjectTarget, WriteConfigOptions } from './Config.types';
2/**
3 * Evaluate the config for an Expo project.
4 * If a function is exported from the `app.config.js` then a partial config will be passed as an argument.
5 * The partial config is composed from any existing app.json, and certain fields from the `package.json` like name and description.
6 *
7 * If options.isPublicConfig is true, the Expo config will include only public-facing options (omitting private keys).
8 * The resulting config should be suitable for hosting or embedding in a publicly readable location.
9 *
10 * **Example**
11 * ```js
12 * module.exports = function({ config }) {
13 *   // mutate the config before returning it.
14 *   config.slug = 'new slug'
15 *   return { expo: config };
16 * }
17 * ```
18 *
19 * **Supports**
20 * - `app.config.ts`
21 * - `app.config.js`
22 * - `app.config.json`
23 * - `app.json`
24 *
25 * @param projectRoot the root folder containing all of your application code
26 * @param options enforce criteria for a project config
27 */
28export declare function getConfig(projectRoot: string, options?: GetConfigOptions): ProjectConfig;
29export declare function getPackageJson(projectRoot: string): PackageJSONConfig;
30export declare function readConfigJson(projectRoot: string, skipValidation?: boolean, skipSDKVersionRequirement?: boolean): ProjectConfig;
31/**
32 * Get the static and dynamic config paths for a project. Also accounts for custom paths.
33 *
34 * @param projectRoot
35 */
36export declare function getConfigFilePaths(projectRoot: string): ConfigFilePaths;
37export declare function findConfigFile(projectRoot: string): {
38    configPath: string;
39    configName: string;
40    configNamespace: 'expo';
41};
42export declare function configFilename(projectRoot: string): string;
43export declare function readExpRcAsync(projectRoot: string): Promise<ExpRc>;
44export declare function resetCustomConfigPaths(): void;
45export declare function setCustomConfigPath(projectRoot: string, configPath: string): void;
46/**
47 * Attempt to modify an Expo project config.
48 * This will only fully work if the project is using static configs only.
49 * Otherwise 'warn' | 'fail' will return with a message about why the config couldn't be updated.
50 * The potentially modified config object will be returned for testing purposes.
51 *
52 * @param projectRoot
53 * @param modifications modifications to make to an existing config
54 * @param readOptions options for reading the current config file
55 * @param writeOptions If true, the static config file will not be rewritten
56 */
57export declare function modifyConfigAsync(projectRoot: string, modifications: Partial<ExpoConfig>, readOptions?: GetConfigOptions, writeOptions?: WriteConfigOptions): Promise<{
58    type: 'success' | 'warn' | 'fail';
59    message?: string;
60    config: AppJSONConfig | null;
61}>;
62export declare function writeConfigJsonAsync(projectRoot: string, options: object): Promise<ProjectConfig>;
63export declare function getWebOutputPath(config?: {
64    [key: string]: any;
65}): string;
66export declare function getNameFromConfig(exp?: Record<string, any>): {
67    appName?: string;
68    webName?: string;
69};
70export declare function getDefaultTarget(projectRoot: string, exp?: Pick<ExpoConfig, 'sdkVersion'>): ProjectTarget;
71/**
72 * Return a useful name describing the project config.
73 * - dynamic: app.config.js
74 * - static: app.json
75 * - custom path app config relative to root folder
76 * - both: app.config.js or app.json
77 */
78export declare function getProjectConfigDescription(projectRoot: string): string;
79/**
80 * Returns a string describing the configurations used for the given project root.
81 * Will return null if no config is found.
82 *
83 * @param projectRoot
84 * @param projectConfig
85 */
86export declare function getProjectConfigDescriptionWithPaths(projectRoot: string, projectConfig: ConfigFilePaths): string;
87export * from './Config.types';
88export { isLegacyImportsEnabled } from './isLegacyImportsEnabled';
89