tech-radar: migrated to new composability API

This commit is contained in:
Patrik Oldsberg
2021-02-10 18:16:21 +01:00
parent 53d3e2d626
commit 804502a5c7
5 changed files with 42 additions and 8 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-tech-radar': patch
---
Migrated to new composability API, exporting the plugin instance as `techRadarPlugin` and the page as `TechRadarPage`.
+9 -2
View File
@@ -14,7 +14,14 @@
* limitations under the License.
*/
import React from 'react';
import { createDevApp } from '@backstage/dev-utils';
import { plugin } from '../src';
import { techRadarPlugin, TechRadarPage } from '../src';
createDevApp().registerPlugin(plugin).render();
createDevApp()
.registerPlugin(techRadarPlugin)
.addPage({
title: 'Tech Radar',
element: <TechRadarPage width={1280} height={720} />,
})
.render();
+5 -1
View File
@@ -14,7 +14,11 @@
* limitations under the License.
*/
export { plugin } from './plugin';
export {
techRadarPlugin,
techRadarPlugin as plugin,
TechRadarPage,
} from './plugin';
export { RadarPage as Router } from './components/RadarPage';
+2 -2
View File
@@ -14,10 +14,10 @@
* limitations under the License.
*/
import { plugin } from './plugin';
import { techRadarPlugin } from './plugin';
describe('tech-radar', () => {
it('should export plugin', () => {
expect(plugin).toBeDefined();
expect(techRadarPlugin).toBeDefined();
});
});
+21 -3
View File
@@ -14,8 +14,26 @@
* limitations under the License.
*/
import { createPlugin } from '@backstage/core';
import {
createPlugin,
createRouteRef,
createRoutableExtension,
} from '@backstage/core';
export const plugin = createPlugin({
id: 'tech-radar',
const rootRouteRef = createRouteRef({
title: 'Tech Radar',
});
export const techRadarPlugin = createPlugin({
id: 'tech-radar',
routes: {
root: rootRouteRef,
},
});
export const TechRadarPage = techRadarPlugin.provide(
createRoutableExtension({
component: () => import('./components/RadarPage').then(m => m.RadarPage),
mountPoint: rootRouteRef,
}),
);