chore: install the @backstage/plugin-app by default now

Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
blam
2024-08-27 11:23:51 +02:00
parent 99b799e65a
commit 2bb9517d4d
4 changed files with 36 additions and 2 deletions
+8
View File
@@ -0,0 +1,8 @@
---
'@backstage/frontend-plugin-api': patch
'@backstage/frontend-test-utils': patch
'@backstage/frontend-app-api': patch
'@backstage/plugin-app': minor
---
Introduce the `@backstage/plugin-app` package to hold all of the built-in extensions for easy consumption and overriding.
+1 -1
View File
@@ -38,6 +38,7 @@
"@backstage/core-plugin-api": "workspace:^",
"@backstage/errors": "workspace:^",
"@backstage/frontend-plugin-api": "workspace:^",
"@backstage/plugin-app": "workspace:^",
"@backstage/theme": "workspace:^",
"@backstage/types": "workspace:^",
"@backstage/version-bridge": "workspace:^",
@@ -48,7 +49,6 @@
},
"devDependencies": {
"@backstage/cli": "workspace:^",
"@backstage/plugin-app": "workspace:^",
"@backstage/test-utils": "workspace:^",
"@testing-library/jest-dom": "^6.0.0",
"@testing-library/react": "^15.0.0"
@@ -359,4 +359,27 @@ describe('createApp', () => {
expect(screen.queryByText('Custom loading message')).toBeNull();
});
it('should allow overriding the app plugin', async () => {
const app = createApp({
configLoader: () => new Promise(() => {}),
features: [
appPlugin.withOverrides({
extensions: [
appPlugin.getExtension('app/root').override({
factory: () => [
coreExtensionData.reactElement(
<div>Custom app root element</div>,
),
],
}),
],
}),
],
});
await renderWithEffects(app.createRoot());
expect(screen.queryByText('Custom app root element')).toBeNull();
});
});
@@ -76,6 +76,7 @@ import { ApiRegistry } from '../../../core-app-api/src/apis/system/ApiRegistry';
// eslint-disable-next-line @backstage/no-relative-monorepo-imports
import { AppIdentityProxy } from '../../../core-app-api/src/apis/implementations/IdentityApi/AppIdentityProxy';
import { BackstageRouteObject } from '../routing/types';
import appPlugin from '@backstage/plugin-app';
function deduplicateFeatures(
allFeatures: FrontendFeature[],
@@ -269,10 +270,12 @@ export function createSpecializedApp(options?: {
bindRoutes?(context: { bind: CreateAppRouteBinder }): void;
}): { createRoot(): JSX.Element } {
const {
features: duplicatedFeatures = [],
features: featuresWithoutApp = [],
config = new ConfigReader({}, 'empty-config'),
} = options ?? {};
const duplicatedFeatures = [appPlugin, ...featuresWithoutApp];
const features = deduplicateFeatures(duplicatedFeatures);
const tree = resolveAppTree(