diff --git a/workspaces/quickstart/.changeset/remove-ofs-reexports.md b/workspaces/quickstart/.changeset/remove-ofs-reexports.md new file mode 100644 index 00000000000..86d583ba6ec --- /dev/null +++ b/workspaces/quickstart/.changeset/remove-ofs-reexports.md @@ -0,0 +1,10 @@ +--- +'@red-hat-developer-hub/backstage-plugin-quickstart': major +--- + +**Breaking:** Legacy (OFS) component exports have been removed from the main `./` entry point and are now exclusively available at the `./legacy` subpath. OFS consumers must update their imports: + +```diff +- import { QuickstartDrawerProvider } from '@red-hat-developer-hub/backstage-plugin-quickstart'; ++ import { QuickstartDrawerProvider } from '@red-hat-developer-hub/backstage-plugin-quickstart/legacy'; +``` diff --git a/workspaces/quickstart/packages/app-legacy/src/components/Root/QuickstartSidebarItem.tsx b/workspaces/quickstart/packages/app-legacy/src/components/Root/QuickstartSidebarItem.tsx index dbb4077b6b9..5a6488cfff0 100644 --- a/workspaces/quickstart/packages/app-legacy/src/components/Root/QuickstartSidebarItem.tsx +++ b/workspaces/quickstart/packages/app-legacy/src/components/Root/QuickstartSidebarItem.tsx @@ -16,13 +16,13 @@ import { SidebarItem } from '@backstage/core-components'; import WavingHandOutlinedIcon from '@mui/icons-material/WavingHandOutlined'; -import { useQuickstartDrawerContext } from '@red-hat-developer-hub/backstage-plugin-quickstart'; -import { configApiRef, useApi } from '@backstage/core-plugin-api'; -import { useMemo } from 'react'; import { + useQuickstartDrawerContext, filterQuickstartItemsByRole, QuickstartItemData, -} from '@red-hat-developer-hub/backstage-plugin-quickstart'; +} from '@red-hat-developer-hub/backstage-plugin-quickstart/legacy'; +import { configApiRef, useApi } from '@backstage/core-plugin-api'; +import { useMemo } from 'react'; export const QuickstartSidebarItem = () => { const configApi = useApi(configApiRef); diff --git a/workspaces/quickstart/packages/app-legacy/src/components/Root/Root.tsx b/workspaces/quickstart/packages/app-legacy/src/components/Root/Root.tsx index 8c882d34965..fc02027a3af 100644 --- a/workspaces/quickstart/packages/app-legacy/src/components/Root/Root.tsx +++ b/workspaces/quickstart/packages/app-legacy/src/components/Root/Root.tsx @@ -45,7 +45,7 @@ import { QuickstartDrawerProvider, QuickstartDrawerContent, QuickstartDrawerStateExposer, -} from '@red-hat-developer-hub/backstage-plugin-quickstart'; +} from '@red-hat-developer-hub/backstage-plugin-quickstart/legacy'; import { QuickstartSidebarItem } from './QuickstartSidebarItem'; import { Administration } from '@backstage-community/plugin-rbac'; import { ApplicationDrawer } from './ApplicationDrawer'; diff --git a/workspaces/quickstart/plugins/quickstart/README.md b/workspaces/quickstart/plugins/quickstart/README.md index 77d7eb7b9b8..6ad1aa2ec2b 100644 --- a/workspaces/quickstart/plugins/quickstart/README.md +++ b/workspaces/quickstart/plugins/quickstart/README.md @@ -20,9 +20,9 @@ If you want to install the plugin as a dynamic plugin in Red Hat Developer Hub: - Follow the [Installing plugins guide](https://github.com/redhat-developer/rhdh/blob/main/docs/dynamic-plugins/installing-plugins.md) - Add the content of `app-config.dynamic.yaml` into your `app-config.local.yaml` -#### Dynamic plugin configuration +#### Dynamic plugin configuration (OFS) -Add the extension point inside your `app-config.yaml` or `app-config.local.yaml` file: +Legacy exports require `module: Legacy`. Add the extension point inside your `app-config.yaml` or `app-config.local.yaml` file: ```yaml dynamicPlugins: @@ -34,18 +34,34 @@ dynamicPlugins: mountPoints: - mountPoint: application/provider importName: QuickstartDrawerProvider + module: Legacy - mountPoint: application/internal/drawer-state importName: QuickstartDrawerStateExposer + module: Legacy - mountPoint: application/internal/drawer-content importName: QuickstartDrawerContent + module: Legacy config: id: quickstart - mountPoint: global.header/help importName: QuickstartButton + module: Legacy config: priority: 100 ``` +### Legacy / OFS consumers + +Legacy component imports have been **removed from the main package path**. OFS consumers must update imports to use the `./legacy` subpath: + +```ts +// Before (no longer works) +import { QuickstartDrawerProvider } from '@red-hat-developer-hub/backstage-plugin-quickstart'; + +// After (required) +import { QuickstartDrawerProvider } from '@red-hat-developer-hub/backstage-plugin-quickstart/legacy'; +``` + ### Static Installation 1. Install the plugin package: @@ -58,7 +74,7 @@ yarn add --cwd packages/app @red-hat-developer-hub/backstage-plugin-quickstart 2. Add the plugin to your Backstage app by modifying `packages/app/src/App.tsx`: ```tsx -import { QuickstartDrawerProvider } from '@red-hat-developer-hub/backstage-plugin-quickstart'; +import { QuickstartDrawerProvider } from '@red-hat-developer-hub/backstage-plugin-quickstart/legacy'; // Wrap your app with the QuickstartDrawerProvider const App = () => ( @@ -171,7 +187,7 @@ app: Access quickstart drawer functionality in your components: ```tsx -import { useQuickstartDrawerContext } from '@red-hat-developer-hub/backstage-plugin-quickstart'; +import { useQuickstartDrawerContext } from '@red-hat-developer-hub/backstage-plugin-quickstart/legacy'; const MyComponent = () => { const { openDrawer, closeDrawer, isDrawerOpen } = diff --git a/workspaces/quickstart/plugins/quickstart/app-config.dynamic.yaml b/workspaces/quickstart/plugins/quickstart/app-config.dynamic.yaml index 177ced9f062..9f38ca3cd58 100644 --- a/workspaces/quickstart/plugins/quickstart/app-config.dynamic.yaml +++ b/workspaces/quickstart/plugins/quickstart/app-config.dynamic.yaml @@ -1,19 +1,24 @@ dynamicPlugins: frontend: red-hat-developer-hub.backstage-plugin-quickstart: + # Legacy exports require `module: Legacy` — they are not available on the default module. translationResources: - importName: quickstartTranslations ref: quickstartTranslationRef mountPoints: - mountPoint: application/provider importName: QuickstartDrawerProvider + module: Legacy - mountPoint: application/internal/drawer-state importName: QuickstartDrawerStateExposer + module: Legacy - mountPoint: application/internal/drawer-content importName: QuickstartDrawerContent + module: Legacy config: id: quickstart - mountPoint: global.header/help importName: QuickstartButton + module: Legacy config: priority: 100 diff --git a/workspaces/quickstart/plugins/quickstart/package.json b/workspaces/quickstart/plugins/quickstart/package.json index c073688575a..cd661acb106 100644 --- a/workspaces/quickstart/plugins/quickstart/package.json +++ b/workspaces/quickstart/plugins/quickstart/package.json @@ -110,7 +110,7 @@ "name": "red-hat-developer-hub.backstage-plugin-quickstart", "exposedModules": { "PluginRoot": "./src/index.tsx", - "QuickstartPlugin": "./src/index.tsx", + "Legacy": "./src/legacyExports.ts", "Alpha": "./src/alpha.ts" } }, diff --git a/workspaces/quickstart/plugins/quickstart/report.api.md b/workspaces/quickstart/plugins/quickstart/report.api.md index 08259cb4b9e..113d5accf19 100644 --- a/workspaces/quickstart/plugins/quickstart/report.api.md +++ b/workspaces/quickstart/plugins/quickstart/report.api.md @@ -4,16 +4,12 @@ ```ts import { AppDrawerContent } from '@red-hat-developer-hub/backstage-plugin-app-react'; -import { BackstagePlugin } from '@backstage/core-plugin-api'; -import { CSSProperties } from 'react'; import { ExtensionDataRef } from '@backstage/frontend-plugin-api'; import { FrontendModule } from '@backstage/frontend-plugin-api'; import { GlobalHeaderMenuItemData } from '@red-hat-developer-hub/backstage-plugin-global-header/alpha'; -import { JSX as JSX_2 } from 'react/jsx-runtime'; import { MenuItemParams } from '@red-hat-developer-hub/backstage-plugin-global-header/alpha'; import { OverridableExtensionDefinition } from '@backstage/frontend-plugin-api'; import { OverridableFrontendPlugin } from '@backstage/frontend-plugin-api'; -import { PropsWithChildren } from 'react'; import { TranslationRef } from '@backstage/frontend-plugin-api'; import { TranslationResource } from '@backstage/frontend-plugin-api'; @@ -80,87 +76,9 @@ const _default: OverridableFrontendPlugin< >; export default _default; -// @public -export type DrawerPartialState = { - id: string; - isDrawerOpen: boolean; - drawerWidth: number; - setDrawerWidth: (width: number) => void; - closeDrawer: () => void; -}; - -// @public -export type DrawerStateExposerProps = { - onStateChange: (state: DrawerPartialState) => void; -}; - -// @public -export const filterQuickstartItemsByRole: ( - items: QuickstartItemData[], - userRole: string, -) => QuickstartItemData[]; - -// @public -export const QuickstartButton: ( - input: QuickstartButtonProps, -) => JSX_2.Element | null; - -// @public -export interface QuickstartButtonProps { - onClick?: () => void; - style?: CSSProperties; - title?: string; -} - -// @public -export const QuickstartDrawerContent: () => JSX_2.Element | null; - -// @public -export interface QuickstartDrawerContextType { - closeDrawer: () => void; - drawerWidth: number; - isDrawerOpen: boolean; - openDrawer: () => void; - roleLoading: boolean; - setDrawerWidth: React.Dispatch>; - toggleDrawer: () => void; - userRole: UserRole | null; -} - -// @public -export const QuickstartDrawerProvider: ( - input: PropsWithChildren, -) => JSX_2.Element; - -// @public -export const QuickstartDrawerStateExposer: ( - input: DrawerStateExposerProps, -) => null; - // @public export const quickstartInitModule: FrontendModule; -// @public -export interface QuickstartItemCtaData { - link: string; - text: string; - textKey?: string; -} - -// @public -export interface QuickstartItemData { - cta?: QuickstartItemCtaData; - description: string; - descriptionKey?: string; - icon?: string; - roles?: string[]; - title: string; - titleKey?: string; -} - -// @public -export const quickstartPlugin: BackstagePlugin<{}, {}, {}>; - // @public export const quickstartTranslationRef: TranslationRef< 'plugin.quickstart', @@ -232,11 +150,5 @@ export const quickstartTranslations: TranslationResource<'plugin.quickstart'>; // @public export const quickstartTranslationsModule: FrontendModule; -// @public -export const useQuickstartDrawerContext: () => QuickstartDrawerContextType; - -// @public -export type UserRole = 'admin' | 'developer'; - // (No @packageDocumentation comment for this package) ``` diff --git a/workspaces/quickstart/plugins/quickstart/src/index.tsx b/workspaces/quickstart/plugins/quickstart/src/index.tsx index e335ce66cdd..e81c949e7b8 100644 --- a/workspaces/quickstart/plugins/quickstart/src/index.tsx +++ b/workspaces/quickstart/plugins/quickstart/src/index.tsx @@ -97,5 +97,3 @@ export { quickstartTranslationRef, quickstartTranslations, } from './translations'; - -export * from './legacyExports';