From f2e6ecf22ba9ba2cffcce90eb2dec70990b39b1c Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Sun, 5 Sep 2021 22:11:47 +0200 Subject: [PATCH] dev-utils: API report warnings cleanup Signed-off-by: Patrik Oldsberg --- packages/dev-utils/api-report.md | 33 +++++++++++++++---- .../EntityGridItem/EntityGridItem.tsx | 1 + packages/dev-utils/src/devApp/index.tsx | 3 +- packages/dev-utils/src/devApp/render.tsx | 16 +++++---- 4 files changed, 39 insertions(+), 14 deletions(-) diff --git a/packages/dev-utils/api-report.md b/packages/dev-utils/api-report.md index 5f58b297d5..8d54d8f98d 100644 --- a/packages/dev-utils/api-report.md +++ b/packages/dev-utils/api-report.md @@ -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): 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, diff --git a/packages/dev-utils/src/components/EntityGridItem/EntityGridItem.tsx b/packages/dev-utils/src/components/EntityGridItem/EntityGridItem.tsx index 30288fe7bb..55327f35e5 100644 --- a/packages/dev-utils/src/components/EntityGridItem/EntityGridItem.tsx +++ b/packages/dev-utils/src/components/EntityGridItem/EntityGridItem.tsx @@ -34,6 +34,7 @@ const useStyles = makeStyles(theme => ({ }), })); +/** @public */ export const EntityGridItem = ({ entity, classes, diff --git a/packages/dev-utils/src/devApp/index.tsx b/packages/dev-utils/src/devApp/index.tsx index d72b4757c8..69394007d2 100644 --- a/packages/dev-utils/src/devApp/index.tsx +++ b/packages/dev-utils/src/devApp/index.tsx @@ -14,4 +14,5 @@ * limitations under the License. */ -export * from './render'; +export { createDevApp } from './render'; +export type { DevAppBuilder, DevAppPageOptions } from './render'; diff --git a/packages/dev-utils/src/devApp/render.tsx b/packages/dev-utils/src/devApp/render.tsx index 38cc0befe1..755289a060 100644 --- a/packages/dev-utils/src/devApp/render.tsx +++ b/packages/dev-utils/src/devApp/render.tsx @@ -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; - /** * 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(); private readonly apis = new Array(); private readonly rootChildren = new Array(); @@ -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();