From 22de964c623bce9a7a1656c3e7b7e4213d6025dd Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Thu, 31 Jul 2025 13:02:32 +0200 Subject: [PATCH 1/4] frontend-defaults: move createPublicSignInApp to alpha Signed-off-by: Patrik Oldsberg --- .changeset/chatty-coats-sin.md | 5 +++++ .../src/index-public-experimental.tsx | 2 +- packages/frontend-defaults/package.json | 19 ++++++++++++++++--- .../frontend-defaults/report-alpha.api.md | 15 +++++++++++++++ packages/frontend-defaults/report.api.md | 5 ----- .../createPublicSignInApp.test.tsx | 0 .../src/{ => alpha}/createPublicSignInApp.tsx | 5 +++-- packages/frontend-defaults/src/alpha/index.ts | 17 +++++++++++++++++ packages/frontend-defaults/src/index.ts | 1 - 9 files changed, 57 insertions(+), 12 deletions(-) create mode 100644 .changeset/chatty-coats-sin.md create mode 100644 packages/frontend-defaults/report-alpha.api.md rename packages/frontend-defaults/src/{ => alpha}/createPublicSignInApp.test.tsx (100%) rename packages/frontend-defaults/src/{ => alpha}/createPublicSignInApp.tsx (96%) create mode 100644 packages/frontend-defaults/src/alpha/index.ts diff --git a/.changeset/chatty-coats-sin.md b/.changeset/chatty-coats-sin.md new file mode 100644 index 0000000000..3842074f4c --- /dev/null +++ b/.changeset/chatty-coats-sin.md @@ -0,0 +1,5 @@ +--- +'@backstage/frontend-defaults': minor +--- + +**BREAKING**: Moved `createPublicSignInApp` to the `/alpha` sub-path export. diff --git a/packages/app-next/src/index-public-experimental.tsx b/packages/app-next/src/index-public-experimental.tsx index 34198f9553..4c01c428df 100644 --- a/packages/app-next/src/index-public-experimental.tsx +++ b/packages/app-next/src/index-public-experimental.tsx @@ -15,7 +15,7 @@ */ import ReactDOM from 'react-dom/client'; -import { createPublicSignInApp } from '@backstage/frontend-defaults'; +import { createPublicSignInApp } from '@backstage/frontend-defaults/alpha'; import '@backstage/ui/css/styles.css'; const app = createPublicSignInApp(); diff --git a/packages/frontend-defaults/package.json b/packages/frontend-defaults/package.json index 5a2cfb6eb3..4bbbf8986d 100644 --- a/packages/frontend-defaults/package.json +++ b/packages/frontend-defaults/package.json @@ -5,9 +5,7 @@ "role": "web-library" }, "publishConfig": { - "access": "public", - "main": "dist/index.esm.js", - "types": "dist/index.d.ts" + "access": "public" }, "repository": { "type": "git", @@ -16,8 +14,23 @@ }, "license": "Apache-2.0", "sideEffects": false, + "exports": { + ".": "./src/index.ts", + "./alpha": "./src/alpha/index.ts", + "./package.json": "./package.json" + }, "main": "src/index.ts", "types": "src/index.ts", + "typesVersions": { + "*": { + "alpha": [ + "src/alpha/index.ts" + ], + "package.json": [ + "package.json" + ] + } + }, "files": [ "dist" ], diff --git a/packages/frontend-defaults/report-alpha.api.md b/packages/frontend-defaults/report-alpha.api.md new file mode 100644 index 0000000000..1bd66e6521 --- /dev/null +++ b/packages/frontend-defaults/report-alpha.api.md @@ -0,0 +1,15 @@ +## API Report File for "@backstage/frontend-defaults" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts +import { CreateAppOptions } from '@backstage/frontend-defaults'; +import { JSX as JSX_2 } from 'react'; + +// @alpha +export function createPublicSignInApp(options?: CreateAppOptions): { + createRoot(): JSX_2.Element; +}; + +// (No @packageDocumentation comment for this package) +``` diff --git a/packages/frontend-defaults/report.api.md b/packages/frontend-defaults/report.api.md index 37c770074e..ef7ae6a944 100644 --- a/packages/frontend-defaults/report.api.md +++ b/packages/frontend-defaults/report.api.md @@ -41,11 +41,6 @@ export interface CreateAppOptions { pluginInfoResolver?: FrontendPluginInfoResolver; } -// @public -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/alpha/createPublicSignInApp.test.tsx similarity index 100% rename from packages/frontend-defaults/src/createPublicSignInApp.test.tsx rename to packages/frontend-defaults/src/alpha/createPublicSignInApp.test.tsx diff --git a/packages/frontend-defaults/src/createPublicSignInApp.tsx b/packages/frontend-defaults/src/alpha/createPublicSignInApp.tsx similarity index 96% rename from packages/frontend-defaults/src/createPublicSignInApp.tsx rename to packages/frontend-defaults/src/alpha/createPublicSignInApp.tsx index af7107681b..90c6e5e178 100644 --- a/packages/frontend-defaults/src/createPublicSignInApp.tsx +++ b/packages/frontend-defaults/src/alpha/createPublicSignInApp.tsx @@ -21,7 +21,8 @@ import { useApi, } from '@backstage/frontend-plugin-api'; import { useAsync, useMountEffect } from '@react-hookz/web'; -import { CreateAppOptions, createApp } from './createApp'; +import { createApp } from '../createApp'; +import { CreateAppOptions } from '@backstage/frontend-defaults'; import appPlugin from '@backstage/plugin-app'; // This is a copy of the CookieAuthRedirect component from the auth-react @@ -84,7 +85,7 @@ export function InternalCookieAuthRedirect() { * }); * ``` * - * @public + * @alpha */ export function createPublicSignInApp(options?: CreateAppOptions) { return createApp({ diff --git a/packages/frontend-defaults/src/alpha/index.ts b/packages/frontend-defaults/src/alpha/index.ts new file mode 100644 index 0000000000..f9e45bdeec --- /dev/null +++ b/packages/frontend-defaults/src/alpha/index.ts @@ -0,0 +1,17 @@ +/* + * 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. + */ + +export { createPublicSignInApp } from './createPublicSignInApp'; diff --git a/packages/frontend-defaults/src/index.ts b/packages/frontend-defaults/src/index.ts index 68d4c72568..0897d9f38e 100644 --- a/packages/frontend-defaults/src/index.ts +++ b/packages/frontend-defaults/src/index.ts @@ -21,6 +21,5 @@ */ export { createApp, type CreateAppOptions } from './createApp'; -export { createPublicSignInApp } from './createPublicSignInApp'; export { discoverAvailableFeatures } from './discovery'; export { resolveAsyncFeatures } from './resolution'; From e8828e82b27bbf32b3e924b0bb19f30fa05df09e Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Fri, 1 Aug 2025 10:15:21 +0200 Subject: [PATCH 2/4] frontend-defaults: move public sign-in app to alpha app module Signed-off-by: Patrik Oldsberg --- .../src/index-public-experimental.tsx | 8 +- packages/frontend-defaults/package.json | 19 +---- .../frontend-defaults/report-alpha.api.md | 15 ---- plugins/app/package.json | 22 ++++- plugins/app/report-alpha.api.md | 12 +++ .../src/alpha/appModulePublicSignIn.test.tsx | 11 ++- .../app/src/alpha/appModulePublicSignIn.tsx | 84 +++++++++++-------- .../app}/src/alpha/index.ts | 2 +- yarn.lock | 3 + 9 files changed, 102 insertions(+), 74 deletions(-) delete mode 100644 packages/frontend-defaults/report-alpha.api.md create mode 100644 plugins/app/report-alpha.api.md rename packages/frontend-defaults/src/alpha/createPublicSignInApp.test.tsx => plugins/app/src/alpha/appModulePublicSignIn.test.tsx (91%) rename packages/frontend-defaults/src/alpha/createPublicSignInApp.tsx => plugins/app/src/alpha/appModulePublicSignIn.tsx (59%) rename {packages/frontend-defaults => plugins/app}/src/alpha/index.ts (90%) diff --git a/packages/app-next/src/index-public-experimental.tsx b/packages/app-next/src/index-public-experimental.tsx index 4c01c428df..ce558ed4f0 100644 --- a/packages/app-next/src/index-public-experimental.tsx +++ b/packages/app-next/src/index-public-experimental.tsx @@ -15,9 +15,13 @@ */ import ReactDOM from 'react-dom/client'; -import { createPublicSignInApp } from '@backstage/frontend-defaults/alpha'; +import { createApp } from '@backstage/frontend-defaults'; +import { appModulePublicSignIn } from '@backstage/plugin-app/alpha'; + import '@backstage/ui/css/styles.css'; -const app = createPublicSignInApp(); +const app = createApp({ + features: [appModulePublicSignIn], +}); ReactDOM.createRoot(document.getElementById('root')!).render(app.createRoot()); diff --git a/packages/frontend-defaults/package.json b/packages/frontend-defaults/package.json index 4bbbf8986d..5a2cfb6eb3 100644 --- a/packages/frontend-defaults/package.json +++ b/packages/frontend-defaults/package.json @@ -5,7 +5,9 @@ "role": "web-library" }, "publishConfig": { - "access": "public" + "access": "public", + "main": "dist/index.esm.js", + "types": "dist/index.d.ts" }, "repository": { "type": "git", @@ -14,23 +16,8 @@ }, "license": "Apache-2.0", "sideEffects": false, - "exports": { - ".": "./src/index.ts", - "./alpha": "./src/alpha/index.ts", - "./package.json": "./package.json" - }, "main": "src/index.ts", "types": "src/index.ts", - "typesVersions": { - "*": { - "alpha": [ - "src/alpha/index.ts" - ], - "package.json": [ - "package.json" - ] - } - }, "files": [ "dist" ], diff --git a/packages/frontend-defaults/report-alpha.api.md b/packages/frontend-defaults/report-alpha.api.md deleted file mode 100644 index 1bd66e6521..0000000000 --- a/packages/frontend-defaults/report-alpha.api.md +++ /dev/null @@ -1,15 +0,0 @@ -## API Report File for "@backstage/frontend-defaults" - -> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). - -```ts -import { CreateAppOptions } from '@backstage/frontend-defaults'; -import { JSX as JSX_2 } from 'react'; - -// @alpha -export function createPublicSignInApp(options?: CreateAppOptions): { - createRoot(): JSX_2.Element; -}; - -// (No @packageDocumentation comment for this package) -``` diff --git a/plugins/app/package.json b/plugins/app/package.json index 199054f141..9cefaa8609 100644 --- a/plugins/app/package.json +++ b/plugins/app/package.json @@ -11,9 +11,7 @@ ] }, "publishConfig": { - "access": "public", - "main": "dist/index.esm.js", - "types": "dist/index.d.ts" + "access": "public" }, "repository": { "type": "git", @@ -22,6 +20,21 @@ }, "license": "Apache-2.0", "sideEffects": false, + "exports": { + ".": "./src/index.ts", + "./alpha": "./src/alpha/index.ts", + "./package.json": "./package.json" + }, + "typesVersions": { + "*": { + "alpha": [ + "src/alpha/index.ts" + ], + "package.json": [ + "package.json" + ] + } + }, "main": "src/index.ts", "types": "src/index.ts", "files": [ @@ -47,12 +60,15 @@ "@material-ui/core": "^4.9.13", "@material-ui/icons": "^4.9.1", "@material-ui/lab": "^4.0.0-alpha.61", + "@react-hookz/web": "^24.0.0", "react-use": "^17.2.4" }, "devDependencies": { "@backstage/cli": "workspace:^", "@backstage/dev-utils": "workspace:^", + "@backstage/frontend-defaults": "workspace:^", "@backstage/frontend-test-utils": "workspace:^", + "@backstage/test-utils": "workspace:^", "@testing-library/jest-dom": "^6.0.0", "@testing-library/react": "^16.0.0", "@testing-library/user-event": "^14.0.0", diff --git a/plugins/app/report-alpha.api.md b/plugins/app/report-alpha.api.md new file mode 100644 index 0000000000..9496430e7b --- /dev/null +++ b/plugins/app/report-alpha.api.md @@ -0,0 +1,12 @@ +## API Report File for "@backstage/plugin-app" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts +import { FrontendModule } from '@backstage/frontend-plugin-api'; + +// @alpha +export const appModulePublicSignIn: FrontendModule; + +// (No @packageDocumentation comment for this package) +``` diff --git a/packages/frontend-defaults/src/alpha/createPublicSignInApp.test.tsx b/plugins/app/src/alpha/appModulePublicSignIn.test.tsx similarity index 91% rename from packages/frontend-defaults/src/alpha/createPublicSignInApp.test.tsx rename to plugins/app/src/alpha/appModulePublicSignIn.test.tsx index 58a264e81d..14dba9416b 100644 --- a/packages/frontend-defaults/src/alpha/createPublicSignInApp.test.tsx +++ b/plugins/app/src/alpha/appModulePublicSignIn.test.tsx @@ -20,18 +20,20 @@ import { } from '@backstage/frontend-plugin-api'; import { render, screen, waitFor } from '@testing-library/react'; import { useEffect } from 'react'; -import { createPublicSignInApp } from './createPublicSignInApp'; +import { appModulePublicSignIn } from './appModulePublicSignIn'; import { mockApis } from '@backstage/test-utils'; +import { createApp } from '@backstage/frontend-defaults'; -describe('createPublicSignInApp', () => { +describe('appModulePublicSignIn', () => { beforeEach(() => { jest.resetAllMocks(); }); it('should render a sign-in page', async () => { - const app = createPublicSignInApp({ + const app = createApp({ configLoader: async () => ({ config: mockApis.config() }), features: [ + appModulePublicSignIn, createFrontendModule({ pluginId: 'app', extensions: [ @@ -57,9 +59,10 @@ describe('createPublicSignInApp', () => { .spyOn(HTMLFormElement.prototype, 'submit') .mockReturnValue(); - const app = createPublicSignInApp({ + const app = createApp({ configLoader: async () => ({ config: mockApis.config() }), features: [ + appModulePublicSignIn, createFrontendModule({ pluginId: 'app', extensions: [ diff --git a/packages/frontend-defaults/src/alpha/createPublicSignInApp.tsx b/plugins/app/src/alpha/appModulePublicSignIn.tsx similarity index 59% rename from packages/frontend-defaults/src/alpha/createPublicSignInApp.tsx rename to plugins/app/src/alpha/appModulePublicSignIn.tsx index 90c6e5e178..4a188d1d5f 100644 --- a/packages/frontend-defaults/src/alpha/createPublicSignInApp.tsx +++ b/plugins/app/src/alpha/appModulePublicSignIn.tsx @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Backstage Authors + * 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. @@ -14,16 +14,14 @@ * limitations under the License. */ +import appPlugin from '@backstage/plugin-app'; +import { useAsync, useMountEffect } from '@react-hookz/web'; import { coreExtensionData, createFrontendModule, identityApiRef, useApi, } from '@backstage/frontend-plugin-api'; -import { useAsync, useMountEffect } from '@react-hookz/web'; -import { createApp } from '../createApp'; -import { CreateAppOptions } from '@backstage/frontend-defaults'; -import appPlugin from '@backstage/plugin-app'; // This is a copy of the CookieAuthRedirect component from the auth-react // plugin, to avoid a dependency on that package. Long-term we want this to be @@ -68,41 +66,61 @@ export function InternalCookieAuthRedirect() { } /** - * Creates an app that is suitable for the public sign-in page, for use in the `index-public-experimental.tsx` file. + * This module is intended for use in public sign-in page apps, in the + * `index-public-experimental.tsx` file. * * @remarks * - * This app has an override for the `app/layout` extension, which means that - * most extension typically installed in an app will be ignored. However, you - * can still for example install API and root element extensions. + * This module is used to enable the public sign-in flow where the build output + * is split into one small publicly accessible app, and the full app protected + * by auth. + * + * This module overrides the `app/layout` extension, which means that most + * extension typically installed in an app will be ignored. However, you can + * still for example install API and root element extensions. * * A typical setup of this app will only install a custom sign-in page. * * @example - * ```ts - * const app = createPublicSignInApp({ - * features: [signInPageModule], - * }); - * ``` + * + *#### In `index-public-experimental.tsx` + * + *```ts + *import { createApp } from '@backstage/frontend-defaults + *import { appModulePublicSignIn } from '@backstage/plugin-app/alpha'; + *import { appModuleSignInPage } from './appModuleSignInPage'; + * + *const app = createApp({ + * features: [appModuleSignInPage, appModulePublicSignIn], + *}); + *``` + * + *#### In `appModuleSignInPage.tsx` + * + *```tsx + *import { createFrontendModule, SignInPageBlueprint } from '@backstage/frontend-plugin-api'; + * + *export const appModuleSignInPage = createFrontendModule({ + * pluginId: 'app', + * extensions: [ + * SignInPageBlueprint.make({ + * params: { + * ... + * } + * }), + * ], + *}) + *``` * * @alpha */ -export function createPublicSignInApp(options?: CreateAppOptions) { - return createApp({ - ...options, - features: [ - ...(options?.features ?? []), - // This is a rather than app plugin override in order for it to take precedence over any supplied app plugin override - createFrontendModule({ - pluginId: 'app', - extensions: [ - appPlugin.getExtension('app/layout').override({ - factory: () => [ - coreExtensionData.reactElement(), - ], - }), - ], - }), - ], - }); -} +export const appModulePublicSignIn = createFrontendModule({ + pluginId: 'app', + extensions: [ + appPlugin.getExtension('app/layout').override({ + factory: () => [ + coreExtensionData.reactElement(), + ], + }), + ], +}); diff --git a/packages/frontend-defaults/src/alpha/index.ts b/plugins/app/src/alpha/index.ts similarity index 90% rename from packages/frontend-defaults/src/alpha/index.ts rename to plugins/app/src/alpha/index.ts index f9e45bdeec..8ffa92e8aa 100644 --- a/packages/frontend-defaults/src/alpha/index.ts +++ b/plugins/app/src/alpha/index.ts @@ -14,4 +14,4 @@ * limitations under the License. */ -export { createPublicSignInApp } from './createPublicSignInApp'; +export { appModulePublicSignIn } from './appModulePublicSignIn'; diff --git a/yarn.lock b/yarn.lock index 9b0a90acec..a336f69e8d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4743,15 +4743,18 @@ __metadata: "@backstage/core-components": "workspace:^" "@backstage/core-plugin-api": "workspace:^" "@backstage/dev-utils": "workspace:^" + "@backstage/frontend-defaults": "workspace:^" "@backstage/frontend-plugin-api": "workspace:^" "@backstage/frontend-test-utils": "workspace:^" "@backstage/integration-react": "workspace:^" "@backstage/plugin-permission-react": "workspace:^" + "@backstage/test-utils": "workspace:^" "@backstage/theme": "workspace:^" "@backstage/types": "workspace:^" "@material-ui/core": "npm:^4.9.13" "@material-ui/icons": "npm:^4.9.1" "@material-ui/lab": "npm:^4.0.0-alpha.61" + "@react-hookz/web": "npm:^24.0.0" "@testing-library/jest-dom": "npm:^6.0.0" "@testing-library/react": "npm:^16.0.0" "@testing-library/user-event": "npm:^14.0.0" From 3ee992dcb94c4d12a179e47b5db4434d6240e283 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Fri, 1 Aug 2025 10:18:16 +0200 Subject: [PATCH 3/4] frontend-defaults: add back deprecated createPublicSignInApp Signed-off-by: Patrik Oldsberg --- packages/frontend-defaults/report.api.md | 5 + .../src/createPublicSignInApp.test.tsx | 121 ++++++++++++++++++ .../src/createPublicSignInApp.tsx | 29 +++++ packages/frontend-defaults/src/index.ts | 1 + 4 files changed, 156 insertions(+) create mode 100644 packages/frontend-defaults/src/createPublicSignInApp.test.tsx create mode 100644 packages/frontend-defaults/src/createPublicSignInApp.tsx diff --git a/packages/frontend-defaults/report.api.md b/packages/frontend-defaults/report.api.md index ef7ae6a944..171cb40fbe 100644 --- a/packages/frontend-defaults/report.api.md +++ b/packages/frontend-defaults/report.api.md @@ -41,6 +41,11 @@ export interface CreateAppOptions { pluginInfoResolver?: FrontendPluginInfoResolver; } +// @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 new file mode 100644 index 0000000000..58a264e81d --- /dev/null +++ b/packages/frontend-defaults/src/createPublicSignInApp.test.tsx @@ -0,0 +1,121 @@ +/* + * 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 { + SignInPageBlueprint, + createFrontendModule, +} from '@backstage/frontend-plugin-api'; +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({ + 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({ + 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 new file mode 100644 index 0000000000..0015d9403f --- /dev/null +++ b/packages/frontend-defaults/src/createPublicSignInApp.tsx @@ -0,0 +1,29 @@ +/* + * 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 0897d9f38e..68d4c72568 100644 --- a/packages/frontend-defaults/src/index.ts +++ b/packages/frontend-defaults/src/index.ts @@ -21,5 +21,6 @@ */ export { createApp, type CreateAppOptions } from './createApp'; +export { createPublicSignInApp } from './createPublicSignInApp'; export { discoverAvailableFeatures } from './discovery'; export { resolveAsyncFeatures } from './resolution'; From a08f95fe6fca894fae6755d6efde05bd37300072 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Fri, 1 Aug 2025 10:20:38 +0200 Subject: [PATCH 4/4] changesets: add and update changesets for appModulePublicSignIn Signed-off-by: Patrik Oldsberg --- .changeset/chatty-coats-sin.md | 4 ++-- .changeset/four-spiders-jump.md | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .changeset/four-spiders-jump.md diff --git a/.changeset/chatty-coats-sin.md b/.changeset/chatty-coats-sin.md index 3842074f4c..97f74bee80 100644 --- a/.changeset/chatty-coats-sin.md +++ b/.changeset/chatty-coats-sin.md @@ -1,5 +1,5 @@ --- -'@backstage/frontend-defaults': minor +'@backstage/frontend-defaults': patch --- -**BREAKING**: Moved `createPublicSignInApp` to the `/alpha` sub-path export. +Deprecated `createPublicSignInApp`, which has been replaced by the new `appModulePublicSignIn` from `@backstage/plugin-app/alpha` instead. diff --git a/.changeset/four-spiders-jump.md b/.changeset/four-spiders-jump.md new file mode 100644 index 0000000000..d5a92b8745 --- /dev/null +++ b/.changeset/four-spiders-jump.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-app': patch +--- + +Added a new module for implementing public sign-in apps, exported as `appModulePublicSignIn` via the `/alpha` sub-path export. This replaces the `createPublicSignInApp` export from `@backstage/frontend-defaults`, which is now deprecated.