From 22b2f53d1144d10980c1d0ce28727f9c0432c281 Mon Sep 17 00:00:00 2001 From: Philipp Hugenroth Date: Mon, 11 Dec 2023 17:35:50 +0100 Subject: [PATCH] Add context to make writing documentation on DI easier Co-authored-by: Patrik Oldsberg Co-authored-by: Camila Belo Signed-off-by: Philipp Hugenroth --- .../architecture/03-extensions.md | 62 +++++++- .../architecture/04-plugins.md | 84 +++++++++++ .../architecture/05-extension-overrides.md | 38 +++++ .../frontend-system/architecture/07-routes.md | 139 ++++++++++++++++++ .../architecture/08-references.md | 17 +++ 5 files changed, 333 insertions(+), 7 deletions(-) create mode 100644 docs/frontend-system/architecture/08-references.md diff --git a/docs/frontend-system/architecture/03-extensions.md b/docs/frontend-system/architecture/03-extensions.md index 3d08bf1721..7deafbd74f 100644 --- a/docs/frontend-system/architecture/03-extensions.md +++ b/docs/frontend-system/architecture/03-extensions.md @@ -18,6 +18,10 @@ Each extensions has a number of different properties that define how it behaves ### ID + + The ID of an extension is used to uniquely identity it, and it should ideally by unique across the entire Backstage ecosystem. For each frontend app instance there can only be a single extension for any given ID. Installing multiple extensions with the same ID will either result in an error or one of the extensions will override the others. The ID is also used to reference the extensions from other extensions, in configuration, and in other places such as developer tools and analytics. ### Output @@ -85,20 +89,64 @@ TODO ## Extension Inputs -TODO + + +## Extension Configuration + + ## Extension Creators -TODO + ## Extension Boundary -TODO + diff --git a/docs/frontend-system/architecture/04-plugins.md b/docs/frontend-system/architecture/04-plugins.md index a1e85f8407..a385a309e0 100644 --- a/docs/frontend-system/architecture/04-plugins.md +++ b/docs/frontend-system/architecture/04-plugins.md @@ -7,3 +7,87 @@ description: Frontend plugins --- > **NOTE: The new frontend system is in a highly experimental phase** + +## Introduction + + + +## Creating a Plugin + + + +```ts +export const myPlugin = createPlugin({ + id: 'my-plugin', +}); +``` + + + +### Plugin ID + + + +### Plugin Extensions + + + +### Plugin Routes + + + +### Plugin External Routes + + + +### Plugin Feature Flags + + + +## Installing a Plugin in an App + + diff --git a/docs/frontend-system/architecture/05-extension-overrides.md b/docs/frontend-system/architecture/05-extension-overrides.md index 743a5ea59e..14d15efb74 100644 --- a/docs/frontend-system/architecture/05-extension-overrides.md +++ b/docs/frontend-system/architecture/05-extension-overrides.md @@ -7,3 +7,41 @@ description: Frontend extension overrides --- > **NOTE: The new frontend system is in a highly experimental phase** + +## Introduction + + + +## Creating a Extension Override + + + +## Overriding Existing Extensions + + diff --git a/docs/frontend-system/architecture/07-routes.md b/docs/frontend-system/architecture/07-routes.md index 354eaeda13..de099e25ec 100644 --- a/docs/frontend-system/architecture/07-routes.md +++ b/docs/frontend-system/architecture/07-routes.md @@ -9,3 +9,142 @@ description: Frontend routes > **NOTE: The new frontend system is in a highly experimental phase** See [routing system docs](../../plugins/composability.md#routing-system) + +## Introduction + + + +## Route References + + + +### Creating a Route Reference + + + +### Using a Route Reference + + + +### Route Path Parameters + + + +### Providing Route References to Plugins + + + +## External Router References + + + +### Binding External Route References + + + +### Optional External Route References + + + +## Sub Route References + + + +```ts +/* + +Some examples + +export const indexPageRouteRef = createRouteRef() + +export const catalogPlugin = createPlugin({ + id: 'catalog, + routes: { + index: indexPageRouteRef, + }, +}) + +// in catalog plugin + +import {indexPageRouteRef} from '../../routes + +const link = useRouteRef(indexPageRouteRef) + +// scaffolder + +export const catalogIndexPageRouteRef = createExternalRouteRef({ + defaultTarget: 'catalog/index', +}) + +export const scaffolderPlugin = createPlugin({ + id: 'scaffolder, + externalRoutes: { + catalogIndex: catalogIndexPageRouteRef, + }, +}) + + +import {catalogIndexPageRouteRef} from '../../routes + +const link = useRouteRef(catalogIndexPageRouteRef) + +// app + +import {catalogPlugin} from '@backstage/plugin-catalog' + +const app = createApp({ + bindRoutes({bind}) { + bind(scaffolderPlugin, { + catalogIndex: catalogPlugin.routes.index, + }) + }, +}) +*/ +``` diff --git a/docs/frontend-system/architecture/08-references.md b/docs/frontend-system/architecture/08-references.md new file mode 100644 index 0000000000..30e941c44e --- /dev/null +++ b/docs/frontend-system/architecture/08-references.md @@ -0,0 +1,17 @@ +--- +id: references +title: Value References +sidebar_label: Value References +# prettier-ignore +description: Value References +--- + +> **NOTE: The new frontend system is in a highly experimental phase** + +