diff --git a/docs/features/software-templates/writing-custom-field-extensions.md b/docs/features/software-templates/writing-custom-field-extensions.md index b63d29da7a..0a09d4baa8 100644 --- a/docs/features/software-templates/writing-custom-field-extensions.md +++ b/docs/features/software-templates/writing-custom-field-extensions.md @@ -100,14 +100,12 @@ import { export const ValidateKebabCaseFieldExtension = FormFieldBlueprint.make({ name: 'validate-kebab-case', params: { - field: () => - Promise.resolve( - createFormField({ - name: 'ValidateKebabCase', - component: ValidateKebabCase, - validation: validateKebabCaseValidation, - }), - ), + field: async () => + createFormField({ + name: 'ValidateKebabCase', + component: ValidateKebabCase, + validation: validateKebabCaseValidation, + }), }, }); ``` @@ -210,14 +208,12 @@ const CustomFieldExtensionComponent = (props: FieldExtensionComponentProps - Promise.resolve( - createFormField({ - name: 'custom-field', - component: CustomFieldExtensionComponent, - validation: ..., - }), - ), + field: async () => + createFormField({ + name: 'custom-field', + component: CustomFieldExtensionComponent, + validation: ..., + }), }, }); ``` @@ -285,14 +281,12 @@ import { export const MyCustomFieldWithOptionsExtension = FormFieldBlueprint.make({ name: 'MyCustomExtensionWithOptions', params: { - field: () => - Promise.resolve( - createFormField({ - name: 'MyCustomExtensionWithOptions', - component: MyCustomExtensionWithOptions, - schema: MyCustomExtensionWithOptionsSchema, - }), - ), + field: async () => + createFormField({ + name: 'MyCustomExtensionWithOptions', + component: MyCustomExtensionWithOptions, + schema: MyCustomExtensionWithOptionsSchema, + }), }, }); ``` diff --git a/docs/features/techdocs/how-to-guides.md b/docs/features/techdocs/how-to-guides.md index e3433e558b..9131d5c8da 100644 --- a/docs/features/techdocs/how-to-guides.md +++ b/docs/features/techdocs/how-to-guides.md @@ -124,39 +124,36 @@ overriding the `page:techdocs` extension. The TechDocs home page is a standard page extension created using `PageBlueprint`, which means you can override it just like any other page extension. -The simplest approach is to create a frontend module that provides a replacement -page extension with the same extension ID. Since the TechDocs page extension has -the ID `page:techdocs`, you can override it by creating a new page extension -under the `techdocs` plugin namespace: +The simplest approach is to use the `plugin.withOverrides` method to provide a +replacement page extension. Since the TechDocs page extension has the ID +`page:techdocs`, you can override it by creating a new page extension under the +`techdocs` plugin namespace: ```tsx title="packages/app/src/techdocs/TechDocsHomePage.tsx" -import { - PageBlueprint, - createFrontendModule, -} from '@backstage/frontend-plugin-api'; +import { PageBlueprint } from '@backstage/frontend-plugin-api'; +import techdocsPlugin from '@backstage/plugin-techdocs/alpha'; -const customTechDocsPage = PageBlueprint.make({ - params: { - path: '/docs', - loader: () => - import('./CustomTechDocsHome').then(m => ), - }, -}); - -export default createFrontendModule({ - pluginId: 'techdocs', - extensions: [customTechDocsPage], +export default techdocsPlugin.withOverrides({ + extensions: [ + PageBlueprint.make({ + params: { + path: '/docs', + loader: () => + import('./CustomTechDocsHome').then(m => ), + }, + }), + ], }); ``` -Then install the module in your app: +Then install the overridden plugin in your app: ```tsx title="packages/app/src/App.tsx" import { createApp } from '@backstage/frontend-defaults'; -import customTechDocsModule from './techdocs/TechDocsHomePage'; +import techdocsPlugin from './techdocs/TechDocsHomePage'; const app = createApp({ - features: [customTechDocsModule], + features: [techdocsPlugin], }); export default app.createRoot();