Clean up changesets and addon package API surface.
Signed-off-by: Eric Peterson <ericpeterson@spotify.com>
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
---
|
||||
'@backstage/plugin-techdocs-addons': minor
|
||||
'@backstage/techdocs-addons': minor
|
||||
---
|
||||
|
||||
Introducing an addon framework for TechDocs.
|
||||
Introducing `@backstage/techdocs-addons`, a web library you can use to create TechDocs addons.
|
||||
|
||||
Note: this package is not necessarily stable yet. After iteration on this package, its stability will be signaled by a major-version bump.
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
'@backstage/plugin-techdocs-addons': patch
|
||||
---
|
||||
|
||||
Separation between contexts and hooks
|
||||
@@ -2,15 +2,14 @@
|
||||
'@backstage/plugin-techdocs': minor
|
||||
---
|
||||
|
||||
TechDocs now supports a new method of customization: addons!
|
||||
TechDocs supports a new, experimental method of customization: addons!
|
||||
|
||||
To customize the standalone TechDocs reader page experience, update your `/packages/app/src/App.tsx` in the following way:
|
||||
|
||||
```diff
|
||||
import { TechDocsIndexPage, TechDocsReaderPage } from '@backstage/plugin-techdocs';
|
||||
+ import { TechDocsAddons } from '@backstage/plugin-techdocs-addons';
|
||||
+ import { TechDocsAddons } from '@backstage/techdocs-addons';
|
||||
+ import { SomeAddon } from '@backstage/plugin-some-plugin';
|
||||
- import { techDocsPage } from './components/techdocs/TechDocsPage';
|
||||
|
||||
// ...
|
||||
|
||||
@@ -19,7 +18,6 @@ import { TechDocsIndexPage, TechDocsReaderPage } from '@backstage/plugin-techdoc
|
||||
path="/docs/:namespace/:kind/:name/*"
|
||||
element={<TechDocsReaderPage />}
|
||||
>
|
||||
- {techDocsPage}
|
||||
+ <TechDocsAddons>
|
||||
+ <SomeAddon />
|
||||
+ </TechDocsAddons>
|
||||
@@ -32,7 +30,7 @@ To customize the TechDocs reader experience on the Catalog entity page, update y
|
||||
|
||||
```diff
|
||||
import { EntityTechdocsContent } from '@backstage/plugin-techdocs';
|
||||
+ import { TechDocsAddons } from '@backstage/plugin-techdocs-addons';
|
||||
+ import { TechDocsAddons } from '@backstage/techdocs-addons';
|
||||
+ import { SomeAddon } from '@backstage/plugin-some-plugin';
|
||||
|
||||
// ...
|
||||
|
||||
@@ -3,23 +3,19 @@
|
||||
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
||||
|
||||
```ts
|
||||
import { AsyncState } from 'react-use/lib/useAsyncFn';
|
||||
import { ComponentType } from 'react';
|
||||
import { Extension } from '@backstage/core-plugin-api';
|
||||
import { default as React_2 } from 'react';
|
||||
|
||||
// @public
|
||||
// @alpha
|
||||
export function createTechDocsAddon<TComponentProps>(
|
||||
options: TechDocsAddonOptions<TComponentProps>,
|
||||
): Extension<ComponentType<TComponentProps>>;
|
||||
|
||||
// @public
|
||||
// @alpha
|
||||
export const TECHDOCS_ADDONS_WRAPPER_KEY = 'techdocs.addons.wrapper.v1';
|
||||
|
||||
// @public
|
||||
export type TechDocsAddonAsyncMetadata<TValue> = AsyncState<TValue | undefined>;
|
||||
|
||||
// @public
|
||||
// @alpha
|
||||
export enum TechDocsAddonLocations {
|
||||
CONTENT = 'content',
|
||||
HEADER = 'header',
|
||||
@@ -28,17 +24,17 @@ export enum TechDocsAddonLocations {
|
||||
SUBHEADER = 'subheader',
|
||||
}
|
||||
|
||||
// @public
|
||||
// @alpha
|
||||
export type TechDocsAddonOptions<TAddonProps = {}> = {
|
||||
name: string;
|
||||
location: TechDocsAddonLocations;
|
||||
component: ComponentType<TAddonProps>;
|
||||
};
|
||||
|
||||
// @public
|
||||
// @alpha
|
||||
export const TechDocsAddons: React_2.ComponentType;
|
||||
|
||||
// @public
|
||||
// @alpha
|
||||
export const useTechDocsAddons: () => {
|
||||
renderComponentByName: (name: string) => React_2.ReactElement<
|
||||
{
|
||||
|
||||
@@ -42,8 +42,7 @@
|
||||
"@material-ui/styles": "^4.11.0",
|
||||
"jss": "~10.8.2",
|
||||
"react-helmet": "6.1.0",
|
||||
"react-router-dom": "6.0.0-beta.0",
|
||||
"react-use": "^17.2.4"
|
||||
"react-router-dom": "6.0.0-beta.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/react": "^16.13.1 || ^17.0.0",
|
||||
|
||||
@@ -31,13 +31,13 @@ export const TECHDOCS_ADDONS_KEY = 'techdocs.addons.addon.v1';
|
||||
|
||||
/**
|
||||
* Marks the <TechDocsAddons> registry component.
|
||||
* @public
|
||||
* @alpha
|
||||
*/
|
||||
export const TECHDOCS_ADDONS_WRAPPER_KEY = 'techdocs.addons.wrapper.v1';
|
||||
|
||||
/**
|
||||
* TechDocs Addon registry.
|
||||
* @public
|
||||
* @alpha
|
||||
*/
|
||||
export const TechDocsAddons: React.ComponentType = () => null;
|
||||
|
||||
@@ -49,7 +49,7 @@ const getDataKeyByName = (name: string) => {
|
||||
|
||||
/**
|
||||
* Create a TechDocs addon.
|
||||
* @public
|
||||
* @alpha
|
||||
*/
|
||||
export function createTechDocsAddon<TComponentProps>(
|
||||
options: TechDocsAddonOptions<TComponentProps>,
|
||||
@@ -93,7 +93,7 @@ const getAllTechDocsAddonsData = (collection: ElementCollection) => {
|
||||
|
||||
/**
|
||||
* hook to use addons in components
|
||||
* @public
|
||||
* @alpha
|
||||
*/
|
||||
export const useTechDocsAddons = () => {
|
||||
const node = useOutlet();
|
||||
|
||||
@@ -27,4 +27,4 @@ export {
|
||||
TECHDOCS_ADDONS_WRAPPER_KEY,
|
||||
} from './addons';
|
||||
export { TechDocsAddonLocations } from './types';
|
||||
export type { TechDocsAddonAsyncMetadata, TechDocsAddonOptions } from './types';
|
||||
export type { TechDocsAddonOptions } from './types';
|
||||
|
||||
@@ -15,11 +15,10 @@
|
||||
*/
|
||||
|
||||
import { ComponentType } from 'react';
|
||||
import { AsyncState } from 'react-use/lib/useAsyncFn';
|
||||
|
||||
/**
|
||||
* Locations for which TechDocs addons may be declared and rendered.
|
||||
* @public
|
||||
* @alpha
|
||||
*/
|
||||
export enum TechDocsAddonLocations {
|
||||
/**
|
||||
@@ -79,16 +78,10 @@ export enum TechDocsAddonLocations {
|
||||
|
||||
/**
|
||||
* Options for creating a TechDocs addon.
|
||||
* @public
|
||||
* @alpha
|
||||
*/
|
||||
export type TechDocsAddonOptions<TAddonProps = {}> = {
|
||||
name: string;
|
||||
location: TechDocsAddonLocations;
|
||||
component: ComponentType<TAddonProps>;
|
||||
};
|
||||
|
||||
/**
|
||||
* Common response envelope for addon-related hooks.
|
||||
* @public
|
||||
*/
|
||||
export type TechDocsAddonAsyncMetadata<TValue> = AsyncState<TValue | undefined>;
|
||||
|
||||
Reference in New Issue
Block a user