dev-utils: API report warnings cleanup

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2021-09-05 22:11:47 +02:00
parent 66e0626bb0
commit f2e6ecf22b
4 changed files with 39 additions and 14 deletions
+27 -6
View File
@@ -7,21 +7,42 @@
import { ApiFactory } from '@backstage/core-plugin-api';
import { AppTheme } from '@backstage/core-plugin-api';
import { BackstagePlugin } from '@backstage/core-plugin-api';
import { ComponentType } from 'react';
import { createPlugin } from '@backstage/core-plugin-api';
import { Entity } from '@backstage/catalog-model';
import { GridProps } from '@material-ui/core';
import { IconComponent } from '@backstage/core-plugin-api';
import { ReactNode } from 'react';
// Warning: (ae-forgotten-export) The symbol "DevAppBuilder" needs to be exported by the entry point index.d.ts
// Warning: (ae-missing-release-tag) "createDevApp" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public
export function createDevApp(): DevAppBuilder;
// Warning: (ae-missing-release-tag) "EntityGridItem" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public
export class DevAppBuilder {
addPage(opts: DevAppPageOptions): DevAppBuilder;
addRootChild(node: ReactNode): DevAppBuilder;
addThemes(themes: AppTheme[]): this;
build(): ComponentType<{}>;
registerApi<
Api,
Impl extends Api,
Deps extends {
[name in string]: unknown;
},
>(factory: ApiFactory<Api, Impl, Deps>): DevAppBuilder;
registerPlugin(...plugins: BackstagePlugin[]): DevAppBuilder;
render(): void;
}
// @public (undocumented)
export type DevAppPageOptions = {
path?: string;
element: JSX.Element;
children?: JSX.Element;
title?: string;
icon?: IconComponent;
};
// @public (undocumented)
export const EntityGridItem: ({
entity,
@@ -34,6 +34,7 @@ const useStyles = makeStyles<BackstageTheme, { entity: Entity }>(theme => ({
}),
}));
/** @public */
export const EntityGridItem = ({
entity,
classes,
+2 -1
View File
@@ -14,4 +14,5 @@
* limitations under the License.
*/
export * from './render';
export { createDevApp } from './render';
export type { DevAppBuilder, DevAppPageOptions } from './render';
+9 -7
View File
@@ -41,10 +41,10 @@ import {
attachComponentData,
configApiRef,
createApiFactory,
createPlugin,
createRouteRef,
IconComponent,
RouteRef,
BackstagePlugin,
} from '@backstage/core-plugin-api';
import { createApp, FlatRoutes } from '@backstage/core-app-api';
@@ -57,7 +57,8 @@ const GatheringRoute: (props: {
attachComponentData(GatheringRoute, 'core.gatherMountPoints', true);
type RegisterPageOptions = {
/** @public */
export type DevAppPageOptions = {
path?: string;
element: JSX.Element;
children?: JSX.Element;
@@ -65,14 +66,13 @@ type RegisterPageOptions = {
icon?: IconComponent;
};
// TODO(rugvip): export proper plugin type from core that isn't the plugin class
type BackstagePlugin = ReturnType<typeof createPlugin>;
/**
* DevApp builder that is similar to the App builder API, but creates an App
* with the purpose of developing one or more plugins inside it.
*
* @public
*/
class DevAppBuilder {
export class DevAppBuilder {
private readonly plugins = new Array<BackstagePlugin>();
private readonly apis = new Array<AnyApiFactory>();
private readonly rootChildren = new Array<ReactNode>();
@@ -118,7 +118,7 @@ class DevAppBuilder {
* If no path is provided one will be generated.
* If no title is provided, no sidebar item will be created.
*/
addPage(opts: RegisterPageOptions): DevAppBuilder {
addPage(opts: DevAppPageOptions): DevAppBuilder {
const path = opts.path ?? `/page-${this.routes.length + 1}`;
if (!this.defaultPage || path === '/') {
@@ -244,6 +244,8 @@ class DevAppBuilder {
/**
* Creates a dev app for rendering one or more plugins and exposing the touch points of the plugin.
*
* @public
*/
export function createDevApp() {
return new DevAppBuilder();