Merge pull request #6884 from backstage/rugvip/wide
config-loader: broaden search for backstage packages in config schema collection
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/config-loader': patch
|
||||
---
|
||||
|
||||
Include `devDependencies` and `optionalDependencies` in the detection of Backstage packages when collecting configuration schema.
|
||||
@@ -87,6 +87,8 @@ describe('collectConfigSchemas', () => {
|
||||
dependencies: {
|
||||
c1: '0.0.0',
|
||||
c2: '0.0.0',
|
||||
},
|
||||
devDependencies: {
|
||||
'@backstage/mock': '0.0.0',
|
||||
},
|
||||
configSchema: { ...mockSchema, title: 'b' },
|
||||
|
||||
@@ -74,6 +74,8 @@ export async function collectConfigSchemas(
|
||||
const pkg = await fs.readJson(pkgPath);
|
||||
const depNames = [
|
||||
...Object.keys(pkg.dependencies ?? {}),
|
||||
...Object.keys(pkg.devDependencies ?? {}),
|
||||
...Object.keys(pkg.optionalDependencies ?? {}),
|
||||
...Object.keys(pkg.peerDependencies ?? {}),
|
||||
];
|
||||
|
||||
|
||||
@@ -30,9 +30,18 @@ describe('readAzureIntegrationConfig', () => {
|
||||
async function buildFrontendConfig(
|
||||
data: Partial<AzureIntegrationConfig>,
|
||||
): Promise<Config> {
|
||||
const schema = await loadConfigSchema({
|
||||
const fullSchema = await loadConfigSchema({
|
||||
dependencies: [require('../../package.json').name],
|
||||
});
|
||||
const serializedSchema = fullSchema.serialize() as {
|
||||
schemas: { path: string }[];
|
||||
};
|
||||
const schema = await loadConfigSchema({
|
||||
serialized: {
|
||||
...serializedSchema, // grab the schema from this package only
|
||||
schemas: serializedSchema.schemas.filter(s => s.path === 'config.d.ts'),
|
||||
},
|
||||
});
|
||||
const processed = schema.process(
|
||||
[{ data: { integrations: { azure: [data] } }, context: 'app' }],
|
||||
{ visibility: ['frontend'] },
|
||||
|
||||
@@ -30,9 +30,18 @@ describe('readBitbucketIntegrationConfig', () => {
|
||||
async function buildFrontendConfig(
|
||||
data: Partial<BitbucketIntegrationConfig>,
|
||||
): Promise<Config> {
|
||||
const schema = await loadConfigSchema({
|
||||
const fullSchema = await loadConfigSchema({
|
||||
dependencies: [require('../../package.json').name],
|
||||
});
|
||||
const serializedSchema = fullSchema.serialize() as {
|
||||
schemas: { path: string }[];
|
||||
};
|
||||
const schema = await loadConfigSchema({
|
||||
serialized: {
|
||||
...serializedSchema, // grab the schema from this package only
|
||||
schemas: serializedSchema.schemas.filter(s => s.path === 'config.d.ts'),
|
||||
},
|
||||
});
|
||||
const processed = schema.process(
|
||||
[{ data: { integrations: { bitbucket: [data] } }, context: 'app' }],
|
||||
{ visibility: ['frontend'] },
|
||||
|
||||
@@ -30,9 +30,18 @@ describe('readGitHubIntegrationConfig', () => {
|
||||
async function buildFrontendConfig(
|
||||
data: Partial<GitHubIntegrationConfig>,
|
||||
): Promise<Config> {
|
||||
const schema = await loadConfigSchema({
|
||||
const fullSchema = await loadConfigSchema({
|
||||
dependencies: [require('../../package.json').name],
|
||||
});
|
||||
const serializedSchema = fullSchema.serialize() as {
|
||||
schemas: { path: string }[];
|
||||
};
|
||||
const schema = await loadConfigSchema({
|
||||
serialized: {
|
||||
...serializedSchema, // grab the schema from this package only
|
||||
schemas: serializedSchema.schemas.filter(s => s.path === 'config.d.ts'),
|
||||
},
|
||||
});
|
||||
const processed = schema.process(
|
||||
[{ data: { integrations: { github: [data] } }, context: 'app' }],
|
||||
{ visibility: ['frontend'] },
|
||||
|
||||
@@ -30,9 +30,18 @@ describe('readGitLabIntegrationConfig', () => {
|
||||
async function buildFrontendConfig(
|
||||
data: Partial<GitLabIntegrationConfig>,
|
||||
): Promise<Config> {
|
||||
const schema = await loadConfigSchema({
|
||||
const fullSchema = await loadConfigSchema({
|
||||
dependencies: [require('../../package.json').name],
|
||||
});
|
||||
const serializedSchema = fullSchema.serialize() as {
|
||||
schemas: { path: string }[];
|
||||
};
|
||||
const schema = await loadConfigSchema({
|
||||
serialized: {
|
||||
...serializedSchema, // grab the schema from this package only
|
||||
schemas: serializedSchema.schemas.filter(s => s.path === 'config.d.ts'),
|
||||
},
|
||||
});
|
||||
const processed = schema.process(
|
||||
[{ data: { integrations: { gitlab: [data] } }, context: 'app' }],
|
||||
{ visibility: ['frontend'] },
|
||||
|
||||
Reference in New Issue
Block a user