diff --git a/packages/app-next/src/App.tsx b/packages/app-next/src/App.tsx index aa9bb985c2..d844939cf2 100644 --- a/packages/app-next/src/App.tsx +++ b/packages/app-next/src/App.tsx @@ -17,6 +17,7 @@ import { createApp } from '@backstage/frontend-app-api'; import { pagesPlugin } from './examples/pagesPlugin'; import graphiqlPlugin from '@backstage/plugin-graphiql/alpha'; +import techRadarPlugin from '@backstage/plugin-tech-radar/alpha'; /* @@ -48,7 +49,7 @@ TODO: /* app.tsx */ const app = createApp({ - plugins: [graphiqlPlugin, pagesPlugin], + plugins: [graphiqlPlugin, pagesPlugin, techRadarPlugin], // bindRoutes({ bind }) { // bind(catalogPlugin.externalRoutes, { // createComponent: scaffolderPlugin.routes.root, diff --git a/plugins/tech-radar/alpha-api-report.md b/plugins/tech-radar/alpha-api-report.md new file mode 100644 index 0000000000..23c5d5d353 --- /dev/null +++ b/plugins/tech-radar/alpha-api-report.md @@ -0,0 +1,24 @@ +## API Report File for "@backstage/plugin-tech-radar" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts +import { BackstagePlugin } from '@backstage/frontend-plugin-api'; +import { Extension } from '@backstage/frontend-plugin-api'; + +// @alpha (undocumented) +const _default: BackstagePlugin; +export default _default; + +// @alpha (undocumented) +export const TechRadarPage: Extension<{ + height: number; + width: number; + title: string; + path: string; + pageTitle: string; + subTitle: string; +}>; + +// (No @packageDocumentation comment for this package) +``` diff --git a/plugins/tech-radar/package.json b/plugins/tech-radar/package.json index 1b048f49cd..300f3cd69a 100644 --- a/plugins/tech-radar/package.json +++ b/plugins/tech-radar/package.json @@ -22,6 +22,21 @@ "keywords": [ "backstage" ], + "exports": { + ".": "./src/index.ts", + "./alpha": "./src/alpha.tsx", + "./package.json": "./package.json" + }, + "typesVersions": { + "*": { + "alpha": [ + "src/alpha.tsx" + ], + "package.json": [ + "package.json" + ] + } + }, "sideEffects": false, "scripts": { "build": "backstage-cli package build", @@ -35,6 +50,7 @@ "dependencies": { "@backstage/core-components": "workspace:^", "@backstage/core-plugin-api": "workspace:^", + "@backstage/frontend-plugin-api": "workspace:^", "@backstage/theme": "workspace:^", "@material-ui/core": "^4.12.2", "@material-ui/icons": "^4.9.1", diff --git a/plugins/tech-radar/src/alpha.tsx b/plugins/tech-radar/src/alpha.tsx new file mode 100644 index 0000000000..29b170c957 --- /dev/null +++ b/plugins/tech-radar/src/alpha.tsx @@ -0,0 +1,64 @@ +/* + * Copyright 2023 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { createApiFactory, createRouteRef } from '@backstage/core-plugin-api'; +import { + createApiExtension, + createPageExtension, + createPlugin, + createSchemaFromZod, +} from '@backstage/frontend-plugin-api'; +import React from 'react'; +import { techRadarApiRef } from './api'; +import { SampleTechRadarApi } from './sample'; + +const techRadarRouteRef = createRouteRef({ id: 'plugin.techradar.page' }); + +/** @alpha */ +export const TechRadarPage = createPageExtension({ + id: 'plugin.techradar.page', + defaultPath: '/tech-radar', + routeRef: techRadarRouteRef, + configSchema: createSchemaFromZod(z => + z.object({ + title: z.string().default('Tech Radar'), + subTitle: z + .string() + .default('Pick the recommended technologies for your projects'), + pageTitle: z.string().default('Company Radar'), + path: z.string().default('/tech-radar'), + width: z.number().default(1500), + height: z.number().default(800), + }), + ), + loader: ({ config }) => + import('./components').then(m => ( + + )), +}); + +const sampleTechRadarApi = createApiExtension({ + api: techRadarApiRef, + factory() { + return createApiFactory(techRadarApiRef, new SampleTechRadarApi()); + }, +}); + +/** @alpha */ +export default createPlugin({ + id: 'tech-radar', + extensions: [TechRadarPage, sampleTechRadarApi], +});