register-component: migrated to new composability API

This commit is contained in:
Patrik Oldsberg
2021-02-04 19:57:44 +01:00
parent b3f0c38112
commit 9ec66c3459
5 changed files with 38 additions and 8 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-register-component': patch
---
Migrated to new composability API, exporting the plugin instance as `registerComponentPlugin`, and page as `RegisterComponentPage`.
+2 -2
View File
@@ -15,6 +15,6 @@
*/
import { createDevApp } from '@backstage/dev-utils';
import { plugin } from '../src/plugin';
import { registerComponentPlugin } from '../src/plugin';
createDevApp().registerPlugin(plugin).render();
createDevApp().registerPlugin(registerComponentPlugin).render();
+5 -1
View File
@@ -14,5 +14,9 @@
* limitations under the License.
*/
export { plugin } from './plugin';
export {
registerComponentPlugin,
registerComponentPlugin as plugin,
RegisterComponentPage,
} from './plugin';
export { Router } from './components/Router';
@@ -14,10 +14,10 @@
* limitations under the License.
*/
import { plugin } from './plugin';
import { registerComponentPlugin } from './plugin';
describe('register-component', () => {
it('should export plugin', () => {
expect(plugin).toBeDefined();
expect(registerComponentPlugin).toBeDefined();
});
});
+24 -3
View File
@@ -14,8 +14,29 @@
* limitations under the License.
*/
import { createPlugin } from '@backstage/core';
import {
createPlugin,
createRoutableExtension,
createRouteRef,
} from '@backstage/core';
export const plugin = createPlugin({
id: 'register-component',
const rootRouteRef = createRouteRef({
title: 'Register Component',
});
export const registerComponentPlugin = createPlugin({
id: 'register-component',
routes: {
root: rootRouteRef,
},
});
export const RegisterComponentPage = registerComponentPlugin.provide(
createRoutableExtension({
component: () =>
import('./components/RegisterComponentPage').then(
m => m.RegisterComponentPage,
),
mountPoint: rootRouteRef,
}),
);