Skip to content

Commit eff418d

Browse files
committed
feat(tech-insights): add support for new frontend system
Added alpha exports for the new Backstage frontend system: - techInsightsPlugin: Main plugin for the new frontend system - techInsightsApi: API extension using ApiBlueprint - techInsightsScorecardPage: Page extension at /tech-insights - entityTechInsightsScorecardContent: Entity content tab - entityTechInsightsScorecardCard: Entity overview card Usage: ```tsx import techInsightsPlugin from '@backstage-community/plugin-tech-insights/alpha'; const app = createApp({ features: [techInsightsPlugin], }); ``` Signed-off-by: Tommy Le <tommy_le@outlook.com>
1 parent 8cc0b4d commit eff418d

File tree

12 files changed

+313
-6
lines changed

12 files changed

+313
-6
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@backstage-community/plugin-tech-insights': minor
3+
---
4+
5+
Added support for the new Backstage frontend system. The plugin can now be used with the new frontend system by importing from `@backstage-community/plugin-tech-insights/alpha`.

workspaces/tech-insights/plugins/tech-insights/README.md

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,38 @@ Main areas covered by this plugin currently are:
1616
yarn --cwd packages/app add @backstage-community/plugin-tech-insights
1717
```
1818

19-
### Add boolean checks overview (Scorecards) page to the EntityPage
19+
### Integrating with the New Frontend System
20+
21+
Follow this section if you are using Backstage's [new frontend system](https://backstage.io/docs/frontend-system/).
22+
23+
Import `techInsightsPlugin` in your `App.tsx` and add it to your app's `features` array:
24+
25+
```tsx
26+
import techInsightsPlugin from '@backstage-community/plugin-tech-insights/alpha';
27+
28+
// ...
29+
30+
export const app = createApp({
31+
features: [
32+
// ...
33+
techInsightsPlugin,
34+
// ...
35+
],
36+
});
37+
```
38+
39+
This will automatically register:
40+
41+
- The Tech Insights API
42+
- The Scorecards page at `/tech-insights`
43+
- Entity content for displaying scorecards on entity pages
44+
- Entity cards for displaying scorecards in entity overview
45+
46+
### Integrating with the Legacy Frontend System
47+
48+
The following sections describe how to integrate the plugin with the legacy frontend system.
49+
50+
#### Add boolean checks overview (Scorecards) page to the EntityPage
2051

2152
```tsx
2253
// packages/app/src/components/catalog/EntityPage.tsx
@@ -119,7 +150,7 @@ If you follow the [Backend Example](../tech-insights-backend#backend-example), o
119150

120151
![Boolean Scorecard Example](./docs/boolean-scorecard-example.png)
121152

122-
### Add overview (Scorecards) page
153+
#### Add overview (Scorecards) page
123154

124155
![Scorecard Overview](./docs/scorecard-overview.png)
125156

workspaces/tech-insights/plugins/tech-insights/package.json

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,22 @@
1515
]
1616
},
1717
"publishConfig": {
18-
"access": "public",
19-
"main": "dist/index.esm.js",
20-
"types": "dist/index.d.ts"
18+
"access": "public"
19+
},
20+
"exports": {
21+
".": "./src/index.ts",
22+
"./alpha": "./src/alpha.tsx",
23+
"./package.json": "./package.json"
24+
},
25+
"typesVersions": {
26+
"*": {
27+
"alpha": [
28+
"src/alpha.tsx"
29+
],
30+
"package.json": [
31+
"package.json"
32+
]
33+
}
2134
},
2235
"homepage": "https://backstage.io",
2336
"repository": {
@@ -30,7 +43,8 @@
3043
"main": "src/index.ts",
3144
"types": "src/index.ts",
3245
"files": [
33-
"dist"
46+
"dist",
47+
"alpha"
3448
],
3549
"scripts": {
3650
"build": "backstage-cli package build",
@@ -45,9 +59,11 @@
4559
"@backstage-community/plugin-tech-insights-common": "workspace:^",
4660
"@backstage-community/plugin-tech-insights-react": "workspace:^",
4761
"@backstage/catalog-model": "^1.7.6",
62+
"@backstage/core-compat-api": "^0.5.5",
4863
"@backstage/core-components": "^0.18.4",
4964
"@backstage/core-plugin-api": "^1.12.1",
5065
"@backstage/errors": "^1.2.7",
66+
"@backstage/frontend-plugin-api": "^0.13.2",
5167
"@backstage/plugin-catalog-react": "^1.21.4",
5268
"@backstage/types": "^1.2.2",
5369
"@material-table/exporters": "^1.2.19",
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
## API Report File for "@backstage-community/plugin-tech-insights"
2+
3+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4+
5+
```ts
6+
import { ExtensionDefinition } from '@backstage/frontend-plugin-api';
7+
import { FrontendPlugin } from '@backstage/frontend-plugin-api';
8+
9+
// @alpha
10+
export const entityTechInsightsScorecardCard: ExtensionDefinition;
11+
12+
// @alpha
13+
export const entityTechInsightsScorecardContent: ExtensionDefinition;
14+
15+
// @alpha (undocumented)
16+
export const techInsightsApi: ExtensionDefinition;
17+
18+
// @alpha
19+
const techInsightsPlugin: FrontendPlugin;
20+
export default techInsightsPlugin;
21+
22+
// @alpha
23+
export const techInsightsScorecardPage: ExtensionDefinition;
24+
25+
// (No @packageDocumentation comment for this package)
26+
```
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
* Copyright 2026 The Backstage Authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
export * from './alpha/index';
18+
export { default } from './alpha/index';
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* Copyright 2026 The Backstage Authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
import {
17+
ApiBlueprint,
18+
discoveryApiRef,
19+
identityApiRef,
20+
type ExtensionDefinition,
21+
} from '@backstage/frontend-plugin-api';
22+
import {
23+
techInsightsApiRef,
24+
TechInsightsClient,
25+
} from '@backstage-community/plugin-tech-insights-react';
26+
27+
/**
28+
* @alpha
29+
*/
30+
export const techInsightsApi: ExtensionDefinition = ApiBlueprint.make({
31+
name: 'tech-insights-api',
32+
params: defineParams =>
33+
defineParams({
34+
api: techInsightsApiRef,
35+
deps: {
36+
discoveryApi: discoveryApiRef,
37+
identityApi: identityApiRef,
38+
},
39+
factory: ({ discoveryApi, identityApi }) =>
40+
new TechInsightsClient({ discoveryApi, identityApi }),
41+
}),
42+
});
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Copyright 2026 The Backstage Authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
import { compatWrapper } from '@backstage/core-compat-api';
17+
import { type ExtensionDefinition } from '@backstage/frontend-plugin-api';
18+
import { EntityCardBlueprint } from '@backstage/plugin-catalog-react/alpha';
19+
20+
/**
21+
* Entity card extension that displays Tech Insights scorecards for an entity.
22+
*
23+
* @alpha
24+
*/
25+
export const entityTechInsightsScorecardCard: ExtensionDefinition =
26+
EntityCardBlueprint.make({
27+
name: 'scorecards',
28+
params: {
29+
loader: () =>
30+
import('../components/ScorecardsCard').then(m =>
31+
compatWrapper(<m.ScorecardsCard title="Scorecards" />),
32+
),
33+
},
34+
});
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Copyright 2026 The Backstage Authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
import { compatWrapper } from '@backstage/core-compat-api';
17+
import { type ExtensionDefinition } from '@backstage/frontend-plugin-api';
18+
import { EntityContentBlueprint } from '@backstage/plugin-catalog-react/alpha';
19+
20+
/**
21+
* Entity content extension that displays Tech Insights scorecards for an entity.
22+
*
23+
* @alpha
24+
*/
25+
export const entityTechInsightsScorecardContent: ExtensionDefinition =
26+
EntityContentBlueprint.make({
27+
name: 'scorecards',
28+
params: {
29+
path: '/tech-insights',
30+
title: 'Scorecards',
31+
loader: () =>
32+
import('../components/ScorecardsContent').then(m =>
33+
compatWrapper(<m.ScorecardsContent title="Scorecards" />),
34+
),
35+
},
36+
});
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
* Copyright 2026 The Backstage Authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
export { techInsightsApi } from './apis';
18+
export { entityTechInsightsScorecardContent } from './entityContent';
19+
export { entityTechInsightsScorecardCard } from './entityCards';
20+
export { techInsightsScorecardPage } from './pages';
21+
export { default } from './plugin';
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Copyright 2026 The Backstage Authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
import { compatWrapper } from '@backstage/core-compat-api';
17+
import {
18+
PageBlueprint,
19+
type ExtensionDefinition,
20+
} from '@backstage/frontend-plugin-api';
21+
22+
/**
23+
* Page extension that displays the Tech Insights scorecards overview page.
24+
*
25+
* @alpha
26+
*/
27+
export const techInsightsScorecardPage: ExtensionDefinition =
28+
PageBlueprint.make({
29+
params: {
30+
path: '/tech-insights',
31+
loader: () =>
32+
import('../components/ScorecardsPage').then(m =>
33+
compatWrapper(<m.ScorecardsPage />),
34+
),
35+
},
36+
});

0 commit comments

Comments
 (0)