MCPcopy
hub / github.com/ionic-team/capacitor / loadExtConfig

Function loadExtConfig

cli/src/config.ts:151–172  ·  view source on GitHub ↗
(rootDir: string)

Source from the content-addressed store, hash-verified

149}
150
151async function loadExtConfig(rootDir: string): Promise<ExtConfigPairs> {
152 const extConfigFilePathTS = resolve(rootDir, CONFIG_FILE_NAME_TS);
153
154 if (await pathExists(extConfigFilePathTS)) {
155 return loadExtConfigTS(rootDir, CONFIG_FILE_NAME_TS, extConfigFilePathTS);
156 }
157
158 const extConfigFilePathJS = resolve(rootDir, CONFIG_FILE_NAME_JS);
159
160 if (await pathExists(extConfigFilePathJS)) {
161 return loadExtConfigJS(rootDir, CONFIG_FILE_NAME_JS, extConfigFilePathJS);
162 }
163
164 const extConfigFilePath = resolve(rootDir, CONFIG_FILE_NAME_JSON);
165
166 return {
167 extConfigType: 'json',
168 extConfigName: CONFIG_FILE_NAME_JSON,
169 extConfigFilePath: extConfigFilePath,
170 extConfig: (await tryFn(readJSON, extConfigFilePath)) ?? {},
171 };
172}
173
174async function loadCLIConfig(rootDir: string): Promise<CLIConfig> {
175 const assetsDir = 'assets';

Callers 1

loadConfigFunction · 0.85

Calls 3

tryFnFunction · 0.90
loadExtConfigTSFunction · 0.85
loadExtConfigJSFunction · 0.85

Tested by

no test coverage detected