cli: write serialized config schema to app output
This commit is contained in:
@@ -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}`);
|
||||
|
||||
@@ -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[];
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user