Merge pull request #4307 from backstage/rugvip/devres

cli,config-loader,app-backend: fixes for module resolution and config loading
This commit is contained in:
Patrik Oldsberg
2021-01-29 19:24:11 +01:00
committed by GitHub
6 changed files with 67 additions and 7 deletions
+14 -6
View File
@@ -84,13 +84,21 @@ export async function readConfigs(options: ReadOptions): Promise<AppConfig[]> {
const schemaPath = resolvePath(appDistDir, '.config-schema.json');
if (await fs.pathExists(schemaPath)) {
const serializedSchema = await fs.readJson(schemaPath);
const schema = await loadConfigSchema({ serialized: serializedSchema });
const frontendConfigs = await schema.process(
[{ data: config.get() as JsonObject, context: 'app' }],
{ visibility: ['frontend'] },
);
appConfigs.push(...frontendConfigs);
try {
const schema = await loadConfigSchema({ serialized: serializedSchema });
const frontendConfigs = await schema.process(
[{ data: config.get() as JsonObject, context: 'app' }],
{ visibility: ['frontend'] },
);
appConfigs.push(...frontendConfigs);
} catch (error) {
throw new Error(
'Invalid schema embedded in the app bundle, to fix this issue you need ' +
`to correct the schema and then rebuild the app bundle. ${error}`,
);
}
}
return appConfigs;