tech-radar: Add alpha exports for page and api extensions

Signed-off-by: Johan Haals <johan.haals@gmail.com>
This commit is contained in:
Johan Haals
2023-09-19 14:29:33 +02:00
parent ad71255f5d
commit 0ca9a540e6
4 changed files with 106 additions and 1 deletions
+24
View File
@@ -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)
```
+16
View File
@@ -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",
+64
View File
@@ -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 => (
<m.RadarPage {...config} subtitle={config.subTitle} />
)),
});
const sampleTechRadarApi = createApiExtension({
api: techRadarApiRef,
factory() {
return createApiFactory(techRadarApiRef, new SampleTechRadarApi());
},
});
/** @alpha */
export default createPlugin({
id: 'tech-radar',
extensions: [TechRadarPage, sampleTechRadarApi],
});