discover backend feature factory
Co-authored-by: Patrik Oldsberg <poldsberg@gmail.com> Signed-off-by: Vincenzo Scamporlino <vincenzos@spotify.com>
This commit is contained in:
committed by
Philipp Hugenroth
parent
0c450c0e9e
commit
0b4dbb4082
@@ -78,6 +78,11 @@ export interface BackendPluginConfig {
|
||||
register(reg: BackendPluginRegistrationPoints): void;
|
||||
}
|
||||
|
||||
export const catalogPlugin = createBackendPlugin({
|
||||
pluginId: 'catalog',
|
||||
register() {},
|
||||
});
|
||||
|
||||
/**
|
||||
* Creates a new backend plugin.
|
||||
*
|
||||
@@ -89,7 +94,7 @@ export function createBackendPlugin<TOptions extends [options?: object] = []>(
|
||||
config: BackendPluginConfig | ((...params: TOptions) => BackendPluginConfig),
|
||||
): (...params: TOptions) => BackendFeature {
|
||||
const configCallback = typeof config === 'function' ? config : () => config;
|
||||
return (...options: TOptions): InternalBackendFeature => {
|
||||
const factory = (...options: TOptions): InternalBackendFeature => {
|
||||
const c = configCallback(...options);
|
||||
|
||||
let registrations: InternalBackendPluginRegistration[];
|
||||
@@ -144,6 +149,9 @@ export function createBackendPlugin<TOptions extends [options?: object] = []>(
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
factory.$$type = '@backstage/BackendFeatureFactory';
|
||||
return factory;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user