xref: /expo/packages/@expo/config/build/Config.d.ts (revision 5697f03e)
1import { AppJSONConfig, ConfigFilePaths, ExpoConfig, 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;
30/**
31 * Get the static and dynamic config paths for a project. Also accounts for custom paths.
32 *
33 * @param projectRoot
34 */
35export declare function getConfigFilePaths(projectRoot: string): ConfigFilePaths;
36/**
37 * Attempt to modify an Expo project config.
38 * This will only fully work if the project is using static configs only.
39 * Otherwise 'warn' | 'fail' will return with a message about why the config couldn't be updated.
40 * The potentially modified config object will be returned for testing purposes.
41 *
42 * @param projectRoot
43 * @param modifications modifications to make to an existing config
44 * @param readOptions options for reading the current config file
45 * @param writeOptions If true, the static config file will not be rewritten
46 */
47export declare function modifyConfigAsync(projectRoot: string, modifications: Partial<ExpoConfig>, readOptions?: GetConfigOptions, writeOptions?: WriteConfigOptions): Promise<{
48    type: 'success' | 'warn' | 'fail';
49    message?: string;
50    config: AppJSONConfig | null;
51}>;
52export declare function getWebOutputPath(config?: {
53    [key: string]: any;
54}): string;
55export declare function getNameFromConfig(exp?: Record<string, any>): {
56    appName?: string;
57    webName?: string;
58};
59export declare function getDefaultTarget(projectRoot: string, exp?: Pick<ExpoConfig, 'sdkVersion'>): ProjectTarget;
60/**
61 * Return a useful name describing the project config.
62 * - dynamic: app.config.js
63 * - static: app.json
64 * - custom path app config relative to root folder
65 * - both: app.config.js or app.json
66 */
67export declare function getProjectConfigDescription(projectRoot: string): string;
68/**
69 * Returns a string describing the configurations used for the given project root.
70 * Will return null if no config is found.
71 *
72 * @param projectRoot
73 * @param projectConfig
74 */
75export declare function getProjectConfigDescriptionWithPaths(projectRoot: string, projectConfig: ConfigFilePaths): string;
76export * from './Config.types';
77