catalog-import: migrated to new composability API

This commit is contained in:
Patrik Oldsberg
2021-02-02 19:44:05 +01:00
parent a5628df400
commit b712841d61
5 changed files with 26 additions and 6 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog-import': patch
---
Migrated to new composability API, exporting the plugin instance as `catalogImportPlugin`, and the page as `CatalogImportPage`.
+2 -2
View File
@@ -15,6 +15,6 @@
*/
import { createDevApp } from '@backstage/dev-utils';
import { plugin } from '../src/plugin';
import { catalogImportPlugin } from '../src/plugin';
createDevApp().registerPlugin(plugin).render();
createDevApp().registerPlugin(catalogImportPlugin).render();
+5 -1
View File
@@ -14,6 +14,10 @@
* limitations under the License.
*/
export { plugin } from './plugin';
export {
catalogImportPlugin,
catalogImportPlugin as plugin,
CatalogImportPage,
} from './plugin';
export { Router } from './components/Router';
export * from './api';
+2 -2
View File
@@ -14,10 +14,10 @@
* limitations under the License.
*/
import { plugin } from './plugin';
import { catalogImportPlugin } from './plugin';
describe('catalog-import', () => {
it('should export plugin', () => {
expect(plugin).toBeDefined();
expect(catalogImportPlugin).toBeDefined();
});
});
+12 -1
View File
@@ -21,6 +21,7 @@ import {
discoveryApiRef,
githubAuthApiRef,
configApiRef,
createRoutableExtension,
} from '@backstage/core';
import { catalogImportApiRef } from './api/CatalogImportApi';
import { CatalogImportClient } from './api/CatalogImportClient';
@@ -30,7 +31,7 @@ export const rootRouteRef = createRouteRef({
title: 'catalog-import',
});
export const plugin = createPlugin({
export const catalogImportPlugin = createPlugin({
id: 'catalog-import',
apis: [
createApiFactory({
@@ -44,4 +45,14 @@ export const plugin = createPlugin({
new CatalogImportClient({ discoveryApi, githubAuthApi, configApi }),
}),
],
routes: {
importPage: rootRouteRef,
},
});
export const CatalogImportPage = catalogImportPlugin.provide(
createRoutableExtension({
component: () => import('./components/Router').then(m => m.Router),
mountPoint: rootRouteRef,
}),
);