From b99b158dfc148ec54422ff625ebcbbd442c295a9 Mon Sep 17 00:00:00 2001 From: blam Date: Fri, 30 Aug 2024 08:39:47 +0200 Subject: [PATCH] chore: deprecate the `namespace` option in blueprints and extensions Signed-off-by: blam --- .../frontend-plugin-api/src/blueprints/IconBundleBlueprint.ts | 1 - .../frontend-plugin-api/src/blueprints/ThemeBlueprint.test.ts | 2 +- packages/frontend-plugin-api/src/blueprints/ThemeBlueprint.ts | 1 - packages/frontend-plugin-api/src/wiring/createExtension.ts | 1 + .../frontend-plugin-api/src/wiring/createExtensionBlueprint.ts | 3 +++ plugins/app/src/extensions/App.tsx | 1 - plugins/app/src/extensions/AppLayout.tsx | 1 - plugins/app/src/extensions/AppNav.tsx | 1 - plugins/app/src/extensions/AppRoot.tsx | 1 - plugins/app/src/extensions/AppRoutes.tsx | 1 - plugins/app/src/extensions/elements.tsx | 2 -- 11 files changed, 5 insertions(+), 10 deletions(-) diff --git a/packages/frontend-plugin-api/src/blueprints/IconBundleBlueprint.ts b/packages/frontend-plugin-api/src/blueprints/IconBundleBlueprint.ts index 369ac052f5..51b3b6d633 100644 --- a/packages/frontend-plugin-api/src/blueprints/IconBundleBlueprint.ts +++ b/packages/frontend-plugin-api/src/blueprints/IconBundleBlueprint.ts @@ -24,7 +24,6 @@ const iconsDataRef = createExtensionDataRef<{ /** @public */ export const IconBundleBlueprint = createExtensionBlueprint({ kind: 'icon-bundle', - namespace: 'app', attachTo: { id: 'api:app/icons', input: 'icons' }, output: [iconsDataRef], config: { diff --git a/packages/frontend-plugin-api/src/blueprints/ThemeBlueprint.test.ts b/packages/frontend-plugin-api/src/blueprints/ThemeBlueprint.test.ts index 6d3f6280a3..89c2229fab 100644 --- a/packages/frontend-plugin-api/src/blueprints/ThemeBlueprint.test.ts +++ b/packages/frontend-plugin-api/src/blueprints/ThemeBlueprint.test.ts @@ -42,7 +42,7 @@ describe('ThemeBlueprint', () => { "inputs": {}, "kind": "theme", "name": "light", - "namespace": "app", + "namespace": undefined, "output": [ [Function], ], diff --git a/packages/frontend-plugin-api/src/blueprints/ThemeBlueprint.ts b/packages/frontend-plugin-api/src/blueprints/ThemeBlueprint.ts index ca33970125..323078bc4e 100644 --- a/packages/frontend-plugin-api/src/blueprints/ThemeBlueprint.ts +++ b/packages/frontend-plugin-api/src/blueprints/ThemeBlueprint.ts @@ -28,7 +28,6 @@ const themeDataRef = createExtensionDataRef().with({ */ export const ThemeBlueprint = createExtensionBlueprint({ kind: 'theme', - namespace: 'app', attachTo: { id: 'api:app/app-theme', input: 'themes' }, output: [themeDataRef], dataRefs: { diff --git a/packages/frontend-plugin-api/src/wiring/createExtension.ts b/packages/frontend-plugin-api/src/wiring/createExtension.ts index 445bbd8a68..ab999a2d0c 100644 --- a/packages/frontend-plugin-api/src/wiring/createExtension.ts +++ b/packages/frontend-plugin-api/src/wiring/createExtension.ts @@ -122,6 +122,7 @@ export type CreateExtensionOptions< UFactoryOutput extends ExtensionDataValue, > = { kind?: TKind; + /** @deprecated namespace is no longer required, you can safely remove this option and it will default to the `pluginId`. It will be removed in a future release. */ namespace?: TNamespace; name?: TName; attachTo: { id: string; input: string }; diff --git a/packages/frontend-plugin-api/src/wiring/createExtensionBlueprint.ts b/packages/frontend-plugin-api/src/wiring/createExtensionBlueprint.ts index 77d078f257..de788473b5 100644 --- a/packages/frontend-plugin-api/src/wiring/createExtensionBlueprint.ts +++ b/packages/frontend-plugin-api/src/wiring/createExtensionBlueprint.ts @@ -57,6 +57,7 @@ export type CreateExtensionBlueprintOptions< TDataRefs extends { [name in string]: AnyExtensionDataRef }, > = { kind: TKind; + /** @deprecated namespace is no longer required, you can safely remove this option and it will default to the `pluginId`. It will be removed in a future release. */ namespace?: TNamespace; attachTo: { id: string; input: string }; disabled?: boolean; @@ -111,6 +112,7 @@ export interface ExtensionBlueprint< TNewNamespace extends string | undefined, TNewName extends string | undefined, >(args: { + /** @deprecated namespace is no longer required, you can safely remove this option and it will default to the `pluginId`. It will be removed in a future release. */ namespace?: TNewNamespace; name?: TNewName; attachTo?: { id: string; input: string }; @@ -149,6 +151,7 @@ export interface ExtensionBlueprint< >; }, >(args: { + /** @deprecated namespace is no longer required, you can safely remove this option and it will default to the `pluginId`. It will be removed in a future release. */ namespace?: TNewNamespace; name?: TNewName; attachTo?: { id: string; input: string }; diff --git a/plugins/app/src/extensions/App.tsx b/plugins/app/src/extensions/App.tsx index 5c6d95bfbc..7f4b3d5ee1 100644 --- a/plugins/app/src/extensions/App.tsx +++ b/plugins/app/src/extensions/App.tsx @@ -27,7 +27,6 @@ import { ApiProvider } from '../../../../packages/core-app-api/src'; import { AppThemeProvider } from '../../../../packages/core-app-api/src/app/AppThemeProvider'; export const App = createExtension({ - namespace: 'app', attachTo: { id: 'root', input: 'app' }, inputs: { root: createExtensionInput([coreExtensionData.reactElement], { diff --git a/plugins/app/src/extensions/AppLayout.tsx b/plugins/app/src/extensions/AppLayout.tsx index 9fadba8a93..3a0560a807 100644 --- a/plugins/app/src/extensions/AppLayout.tsx +++ b/plugins/app/src/extensions/AppLayout.tsx @@ -23,7 +23,6 @@ import { import { SidebarPage } from '@backstage/core-components'; export const AppLayout = createExtension({ - namespace: 'app', name: 'layout', attachTo: { id: 'app/root', input: 'children' }, inputs: { diff --git a/plugins/app/src/extensions/AppNav.tsx b/plugins/app/src/extensions/AppNav.tsx index 3659f474b2..3e4fcebf8c 100644 --- a/plugins/app/src/extensions/AppNav.tsx +++ b/plugins/app/src/extensions/AppNav.tsx @@ -82,7 +82,6 @@ const SidebarNavItem = ( }; export const AppNav = createExtension({ - namespace: 'app', name: 'nav', attachTo: { id: 'app/layout', input: 'nav' }, inputs: { diff --git a/plugins/app/src/extensions/AppRoot.tsx b/plugins/app/src/extensions/AppRoot.tsx index bd786765f9..014f9a1354 100644 --- a/plugins/app/src/extensions/AppRoot.tsx +++ b/plugins/app/src/extensions/AppRoot.tsx @@ -53,7 +53,6 @@ import { RouteTracker } from '../../../../packages/frontend-app-api/src/routing/ import { getBasePath } from '../../../../packages/frontend-app-api/src/routing/getBasePath'; export const AppRoot = createExtension({ - namespace: 'app', name: 'root', attachTo: { id: 'app', input: 'root' }, inputs: { diff --git a/plugins/app/src/extensions/AppRoutes.tsx b/plugins/app/src/extensions/AppRoutes.tsx index 6ef7e2a271..5880d6182e 100644 --- a/plugins/app/src/extensions/AppRoutes.tsx +++ b/plugins/app/src/extensions/AppRoutes.tsx @@ -25,7 +25,6 @@ import { import { useRoutes } from 'react-router-dom'; export const AppRoutes = createExtension({ - namespace: 'app', name: 'routes', attachTo: { id: 'app/layout', input: 'content' }, inputs: { diff --git a/plugins/app/src/extensions/elements.tsx b/plugins/app/src/extensions/elements.tsx index 1ab7f97ba2..bbb6374ebe 100644 --- a/plugins/app/src/extensions/elements.tsx +++ b/plugins/app/src/extensions/elements.tsx @@ -19,7 +19,6 @@ import { AppRootElementBlueprint } from '@backstage/frontend-plugin-api'; import React from 'react'; export const oauthRequestDialogAppRootElement = AppRootElementBlueprint.make({ - namespace: 'app', name: 'oauth-request-dialog', params: { element: , @@ -28,7 +27,6 @@ export const oauthRequestDialogAppRootElement = AppRootElementBlueprint.make({ export const alertDisplayAppRootElement = AppRootElementBlueprint.makeWithOverrides({ - namespace: 'app', name: 'alert-display', config: { schema: {