From 33de79d5ddf3a6889761ce3966fcbee042c0159f Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Thu, 5 Mar 2026 10:33:45 +0100 Subject: [PATCH] Remove deprecated `createPublicSignInApp` from `@backstage/frontend-defaults` The function was deprecated in favor of using `createApp` with the `appModulePublicSignIn` module from `@backstage/plugin-app/alpha`. This removes the function, its tests, and updates the documentation to use the recommended approach. Signed-off-by: Patrik Oldsberg --- .changeset/remove-createPublicSignInApp.md | 5 + docs/tutorials/enable-public-entry.md | 7 +- packages/frontend-defaults/report.api.md | 5 - .../src/createPublicSignInApp.test.tsx | 124 ------------------ .../src/createPublicSignInApp.tsx | 29 ---- packages/frontend-defaults/src/index.ts | 1 - 6 files changed, 9 insertions(+), 162 deletions(-) create mode 100644 .changeset/remove-createPublicSignInApp.md delete mode 100644 packages/frontend-defaults/src/createPublicSignInApp.test.tsx delete mode 100644 packages/frontend-defaults/src/createPublicSignInApp.tsx diff --git a/.changeset/remove-createPublicSignInApp.md b/.changeset/remove-createPublicSignInApp.md new file mode 100644 index 0000000000..2d80d4790b --- /dev/null +++ b/.changeset/remove-createPublicSignInApp.md @@ -0,0 +1,5 @@ +--- +'@backstage/frontend-defaults': minor +--- + +**BREAKING**: Removed the deprecated `createPublicSignInApp` function. Use `createApp` from `@backstage/frontend-defaults` with `appModulePublicSignIn` from `@backstage/plugin-app/alpha` instead. diff --git a/docs/tutorials/enable-public-entry.md b/docs/tutorials/enable-public-entry.md index e430768785..a1321dca05 100644 --- a/docs/tutorials/enable-public-entry.md +++ b/docs/tutorials/enable-public-entry.md @@ -107,10 +107,11 @@ If your app uses the new frontend system, you can still use the public entry poi ```tsx title="in packages/app/src/index-public-experimental.tsx" import ReactDOM from 'react-dom/client'; import { signInPageModule } from './overrides/SignInPage'; -import { createPublicSignInApp } from '@backstage/frontend-defaults'; +import { appModulePublicSignIn } from '@backstage/plugin-app/alpha'; +import { createApp } from '@backstage/frontend-defaults'; -const app = createPublicSignInApp({ - features: [signInPageModule], +const app = createApp({ + features: [signInPageModule, appModulePublicSignIn], }); ReactDOM.createRoot(document.getElementById('root')!).render(app.createRoot()); diff --git a/packages/frontend-defaults/report.api.md b/packages/frontend-defaults/report.api.md index 75392d2dc1..bc620c95a3 100644 --- a/packages/frontend-defaults/report.api.md +++ b/packages/frontend-defaults/report.api.md @@ -37,11 +37,6 @@ export interface CreateAppOptions { features?: (FrontendFeature | FrontendFeatureLoader)[]; } -// @public @deprecated (undocumented) -export function createPublicSignInApp(options?: CreateAppOptions): { - createRoot(): JSX_2; -}; - // @public (undocumented) export function discoverAvailableFeatures(config: Config): { features: (FrontendFeature | FrontendFeatureLoader)[]; diff --git a/packages/frontend-defaults/src/createPublicSignInApp.test.tsx b/packages/frontend-defaults/src/createPublicSignInApp.test.tsx deleted file mode 100644 index 398dbcbf4a..0000000000 --- a/packages/frontend-defaults/src/createPublicSignInApp.test.tsx +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { createFrontendModule } from '@backstage/frontend-plugin-api'; -import { SignInPageBlueprint } from '@backstage/plugin-app-react'; -import { render, screen, waitFor } from '@testing-library/react'; -import { useEffect } from 'react'; -import { createPublicSignInApp } from './createPublicSignInApp'; -import { mockApis } from '@backstage/test-utils'; - -describe('createPublicSignInApp', () => { - beforeEach(() => { - jest.resetAllMocks(); - }); - - it('should render a sign-in page', async () => { - const app = createPublicSignInApp({ - advanced: { - configLoader: async () => ({ config: mockApis.config() }), - }, - features: [ - createFrontendModule({ - pluginId: 'app', - extensions: [ - SignInPageBlueprint.make({ - params: { - loader: async () => () =>
Sign in page
, - }, - }), - ], - }), - ], - }); - - render(app.createRoot()); - - await expect( - screen.findByText('Sign in page'), - ).resolves.toBeInTheDocument(); - }); - - it('should render the form redirect on sign-in', async () => { - const submitSpy = jest - .spyOn(HTMLFormElement.prototype, 'submit') - .mockReturnValue(); - - const app = createPublicSignInApp({ - advanced: { - configLoader: async () => ({ config: mockApis.config() }), - }, - features: [ - createFrontendModule({ - pluginId: 'app', - extensions: [ - SignInPageBlueprint.make({ - params: { - loader: - async () => - ({ onSignInSuccess }) => { - useEffect(() => { - onSignInSuccess( - mockApis.identity({ token: 'mock-token' }), - ); - }, [onSignInSuccess]); - return
; - }, - }, - }), - ], - }), - ], - }); - - const { baseElement } = render(app.createRoot()); - - await waitFor(() => { - expect(submitSpy).toHaveBeenCalled(); - }); - - expect(baseElement).toMatchInlineSnapshot(` - -
-
- - - -
-
- - `); - }); -}); diff --git a/packages/frontend-defaults/src/createPublicSignInApp.tsx b/packages/frontend-defaults/src/createPublicSignInApp.tsx deleted file mode 100644 index 0015d9403f..0000000000 --- a/packages/frontend-defaults/src/createPublicSignInApp.tsx +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2025 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { appModulePublicSignIn } from '@backstage/plugin-app/alpha'; -import { CreateAppOptions, createApp } from './createApp'; - -/** - * @public - * @deprecated Use {@link @backstage/plugin-app/alpha#appModulePublicSignIn} instead. - */ -export function createPublicSignInApp(options?: CreateAppOptions) { - return createApp({ - ...options, - features: [...(options?.features ?? []), appModulePublicSignIn], - }); -} diff --git a/packages/frontend-defaults/src/index.ts b/packages/frontend-defaults/src/index.ts index 37ec62e794..c7f3e468a2 100644 --- a/packages/frontend-defaults/src/index.ts +++ b/packages/frontend-defaults/src/index.ts @@ -21,7 +21,6 @@ */ export { createApp, type CreateAppOptions } from './createApp'; -export { createPublicSignInApp } from './createPublicSignInApp'; export { discoverAvailableFeatures } from './discovery'; export { resolveAsyncFeatures } from './resolution'; export { maybeCreateErrorPage } from './maybeCreateErrorPage';