@@ -17,7 +17,10 @@
|
||||
import { Command } from 'commander';
|
||||
import { stringify as stringifyYaml } from 'yaml';
|
||||
import { loadCliConfig } from '../../lib/config';
|
||||
import { mergeConfigSchemas } from '@backstage/config-loader';
|
||||
import {
|
||||
mergeConfigSchemas,
|
||||
ConfigSchemaPackageEntry,
|
||||
} from '@backstage/config-loader';
|
||||
|
||||
export default async (cmd: Command) => {
|
||||
const { schema } = await loadCliConfig({
|
||||
@@ -26,7 +29,9 @@ export default async (cmd: Command) => {
|
||||
mockEnv: true,
|
||||
});
|
||||
|
||||
const { schema: data } = mergeConfigSchemas(schema.serialize().schemas);
|
||||
const { schema: data } = mergeConfigSchemas(
|
||||
schema.serialize().schemas as ConfigSchemaPackageEntry[],
|
||||
);
|
||||
|
||||
if (cmd.format === 'json') {
|
||||
process.stdout.write(`${JSON.stringify(data, null, 2)}\n`);
|
||||
|
||||
@@ -15,6 +15,10 @@
|
||||
*/
|
||||
|
||||
export { readEnvConfig, loadConfigSchema, mergeConfigSchemas } from './lib';
|
||||
export type { ConfigSchema, ConfigVisibility } from './lib';
|
||||
export type {
|
||||
ConfigSchema,
|
||||
ConfigSchemaPackageEntry,
|
||||
ConfigVisibility,
|
||||
} from './lib';
|
||||
export { loadConfig } from './loader';
|
||||
export type { LoadConfigOptions } from './loader';
|
||||
|
||||
@@ -72,7 +72,11 @@ export function compileConfigSchemas(
|
||||
*/
|
||||
export function mergeConfigSchemas(
|
||||
schemas: ConfigSchemaPackageEntry[],
|
||||
): { schema: JSONSchema; parser: Ajv } {
|
||||
): {
|
||||
schema: JSONSchema;
|
||||
parser: Ajv;
|
||||
visibilityByPath: Map<string, ConfigVisibility>;
|
||||
} {
|
||||
// The ajv instance below is stateful and doesn't really allow for additional
|
||||
// output during validation. We work around this by having this extra piece
|
||||
// of state that we reset before each validation.
|
||||
|
||||
@@ -16,4 +16,8 @@
|
||||
|
||||
export { mergeConfigSchemas } from './compile';
|
||||
export { loadConfigSchema } from './load';
|
||||
export type { ConfigSchema, ConfigVisibility } from './types';
|
||||
export type {
|
||||
ConfigSchema,
|
||||
ConfigSchemaPackageEntry,
|
||||
ConfigVisibility,
|
||||
} from './types';
|
||||
|
||||
Reference in New Issue
Block a user