From 9eb82dbaac1edd901fd5ab2fe0e4d05aadb90cb1 Mon Sep 17 00:00:00 2001 From: Camila Belo Date: Fri, 29 Sep 2023 10:13:05 +0200 Subject: [PATCH 1/4] chore(explore): configure alpha subpath Signed-off-by: Camila Belo --- plugins/explore/package.json | 19 ++++++++++++++++--- plugins/explore/src/alpha.tsx | 15 +++++++++++++++ 2 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 plugins/explore/src/alpha.tsx diff --git a/plugins/explore/package.json b/plugins/explore/package.json index e1b210fb37..63e59dd9a8 100644 --- a/plugins/explore/package.json +++ b/plugins/explore/package.json @@ -6,9 +6,22 @@ "types": "src/index.ts", "license": "Apache-2.0", "publishConfig": { - "access": "public", - "main": "dist/index.esm.js", - "types": "dist/index.d.ts" + "access": "public" + }, + "exports": { + ".": "./src/index.ts", + "./alpha": "./src/alpha.tsx", + "./package.json": "./package.json" + }, + "typesVersions": { + "*": { + "alpha": [ + "src/alpha.tsx" + ], + "package.json": [ + "package.json" + ] + } }, "backstage": { "role": "frontend-plugin" diff --git a/plugins/explore/src/alpha.tsx b/plugins/explore/src/alpha.tsx new file mode 100644 index 0000000000..eb2f165350 --- /dev/null +++ b/plugins/explore/src/alpha.tsx @@ -0,0 +1,15 @@ +/* + * Copyright 2023 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. + */ From 6d5a060d1fe292b3fce06bd67d4348114887b801 Mon Sep 17 00:00:00 2001 From: Camila Belo Date: Fri, 29 Sep 2023 11:59:17 +0200 Subject: [PATCH 2/4] feat(explore): migrate search result item extension Signed-off-by: Camila Belo --- plugins/explore/package.json | 1 + plugins/explore/src/alpha.tsx | 20 ++++++++++++++++++++ yarn.lock | 1 + 3 files changed, 22 insertions(+) diff --git a/plugins/explore/package.json b/plugins/explore/package.json index 63e59dd9a8..dcf0b75577 100644 --- a/plugins/explore/package.json +++ b/plugins/explore/package.json @@ -50,6 +50,7 @@ "@backstage/core-components": "workspace:^", "@backstage/core-plugin-api": "workspace:^", "@backstage/errors": "workspace:^", + "@backstage/frontend-plugin-api": "workspace:^", "@backstage/plugin-catalog-react": "workspace:^", "@backstage/plugin-explore-common": "workspace:^", "@backstage/plugin-explore-react": "workspace:^", diff --git a/plugins/explore/src/alpha.tsx b/plugins/explore/src/alpha.tsx index eb2f165350..1825af5ddb 100644 --- a/plugins/explore/src/alpha.tsx +++ b/plugins/explore/src/alpha.tsx @@ -13,3 +13,23 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +import { createPlugin } from '@backstage/frontend-plugin-api'; +import { createSearchResultListItemExtension } from '@backstage/plugin-search-react/alpha'; + +/** @alpha */ +export const ExploreSearchResultListItemExtension = + createSearchResultListItemExtension({ + id: 'explore', + predicate: result => result.type === 'tools', + component: () => + import('./components/ToolSearchResultListItem').then( + m => m.ToolSearchResultListItem, + ), + }); + +/** @alpha */ +export default createPlugin({ + id: 'explore', + extensions: [ExploreSearchResultListItemExtension], +}); diff --git a/yarn.lock b/yarn.lock index 3dd3f6315b..c2909aaec2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6811,6 +6811,7 @@ __metadata: "@backstage/core-plugin-api": "workspace:^" "@backstage/dev-utils": "workspace:^" "@backstage/errors": "workspace:^" + "@backstage/frontend-plugin-api": "workspace:^" "@backstage/plugin-catalog": "workspace:^" "@backstage/plugin-catalog-react": "workspace:^" "@backstage/plugin-explore-common": "workspace:^" From ab98569836459dbbd11335997118b39b6c5e7433 Mon Sep 17 00:00:00 2001 From: Camila Belo Date: Fri, 29 Sep 2023 12:06:34 +0200 Subject: [PATCH 3/4] docs(explore): update api reports Signed-off-by: Camila Belo --- plugins/explore/alpha-api-report.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 plugins/explore/alpha-api-report.md diff --git a/plugins/explore/alpha-api-report.md b/plugins/explore/alpha-api-report.md new file mode 100644 index 0000000000..3d6e527629 --- /dev/null +++ b/plugins/explore/alpha-api-report.md @@ -0,0 +1,19 @@ +## API Report File for "@backstage/plugin-explore" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts +import { BackstagePlugin } from '@backstage/frontend-plugin-api'; +import { Extension } from '@backstage/frontend-plugin-api'; + +// @alpha (undocumented) +const _default: BackstagePlugin; +export default _default; + +// @alpha (undocumented) +export const ExploreSearchResultListItemExtension: Extension<{ + noTrack?: boolean | undefined; +}>; + +// (No @packageDocumentation comment for this package) +``` From 0f10c53a05199a4f7ecb416c00d7f7b25630c085 Mon Sep 17 00:00:00 2001 From: Camila Belo Date: Fri, 29 Sep 2023 12:08:49 +0200 Subject: [PATCH 4/4] chore: add changeset file Signed-off-by: Camila Belo --- .changeset/warm-drinks-argue.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/warm-drinks-argue.md diff --git a/.changeset/warm-drinks-argue.md b/.changeset/warm-drinks-argue.md new file mode 100644 index 0000000000..5bd4fa63f1 --- /dev/null +++ b/.changeset/warm-drinks-argue.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-explore': patch +--- + +Create an experimental `ExploreSearchResultItemExtension` for declarative integration with Backstage; it can be accessed via the `/alpha` import.