cli: write serialized config schema to app output

This commit is contained in:
Patrik Oldsberg
2020-11-09 00:27:24 +01:00
parent 3849e24112
commit e43aa0dc60
2 changed files with 11 additions and 1 deletions
+9 -1
View File
@@ -33,7 +33,7 @@ const WARN_AFTER_BUNDLE_GZIP_SIZE = 512 * 1024;
const WARN_AFTER_CHUNK_GZIP_SIZE = 1024 * 1024;
export async function buildBundle(options: BuildOptions) {
const { statsJsonEnabled } = options;
const { statsJsonEnabled, schema: configSchema } = options;
const paths = resolveBundlingPaths(options);
const config = await createConfig(paths, {
@@ -56,6 +56,14 @@ export async function buildBundle(options: BuildOptions) {
});
}
if (configSchema) {
await fs.writeJson(
resolvePath(paths.targetDist, '.config-schema.json'),
configSchema.serialize(),
{ spaces: 2 },
);
}
const { stats } = await build(compiler, isCi).catch(error => {
console.log(chalk.red('Failed to compile.\n'));
throw new Error(`Failed to compile.\n${error.message || error}`);
+2
View File
@@ -17,6 +17,7 @@
import { AppConfig, Config } from '@backstage/config';
import { BundlingPathsOptions } from './paths';
import { ParallelOption } from '../parallel';
import { ConfigSchema } from '@backstage/config-loader';
export type BundlingOptions = {
checksEnabled: boolean;
@@ -36,6 +37,7 @@ export type ServeOptions = BundlingPathsOptions & {
export type BuildOptions = BundlingPathsOptions & {
statsJsonEnabled: boolean;
parallel?: ParallelOption;
schema?: ConfigSchema;
frontendConfig: Config;
frontendAppConfigs: AppConfig[];
};