From 3e3be00fdb21b127c6f163ef4999ae532da4f680 Mon Sep 17 00:00:00 2001 From: Camila Belo Date: Wed, 28 Aug 2024 13:51:50 +0200 Subject: [PATCH] docs: apply review suggestions Co-authored-by: Andre Wanlin <67169551+awanlin@users.noreply.github.com> Signed-off-by: Camila Belo --- docs/plugins/integrating-search-into-plugins.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/docs/plugins/integrating-search-into-plugins.md b/docs/plugins/integrating-search-into-plugins.md index 1617b3da5f..f02c596716 100644 --- a/docs/plugins/integrating-search-into-plugins.md +++ b/docs/plugins/integrating-search-into-plugins.md @@ -30,9 +30,9 @@ The search platform provides an interface (`DocumentCollatorFactory` from packag #### 1. Create a collator module package -In order to add a FAQ collator to the Backstage index registry, we have to create a [plugin module](https://backstage.io/docs/backend-system/building-plugins-and-modules/index#modules) and the best way to do this is to create it in a separate package, e.g., `plugins/search-backend-module-faq-snippets-collator`, using the `backstage-cli new` command: +In order to add a FAQ collator to the Backstage index registry, we have to create a [plugin module](https://backstage.io/docs/backend-system/building-plugins-and-modules/index#modules) and the best way to do this is to create it in a separate package, e.g., `plugins/search-backend-module-faq-snippets-collator`, using the `yarn new` command: -1. Access your Backstage project root directory and run `npx @backstage/cli new`; +1. Access your Backstage project root directory and run `yarn new`; 2. When asked about what do you want to create, please select `backend-module` and hit enter; 3. Inform `search` as the plugin id and `faq-snippets-collator` as module id; 4. A `search-backend-module-faq-snippets-collator` folder should have been created in your project's "plugins" directory. @@ -46,7 +46,7 @@ We will use some libraries in the module, so let's add them to your plugin modul git checkout -b tutorials/new-faq-snippets-collator # Install the package containing the interface -yarn workspace backstage-plugin-search-backend-module-faq-snippets-collator add cross-fetch @backstage/config @backstage/plugin-search-common @backstage/plugin-search-backend-node +yarn workspace @internal/backstage-plugin-search-backend-module-faq-snippets-collator add node-fetch @backstage/config @backstage/plugin-search-common @backstage/plugin-search-backend-node ``` #### 3. Use Backstage App configuration @@ -104,7 +104,7 @@ Imagine your FAQs can be retrieved at the URL `https://backstage.example.biz/faq Below we provide an example implementation of how the FAQ collator factory could look like using our new document type, placed in the `plugins/search-backend-module-faq-snippets-collator/src/factory.ts` file: ```ts -import fetch from 'cross-fetch'; +import fetch from 'node-fetch'; import { Readable } from 'stream'; import { Config } from '@backstage/config'; @@ -213,7 +213,7 @@ export { export const searchFaqSnippetsCollatorModule as default } from './modul The newly created module should be added to the backend package dependencies as follows: ```sh -yarn --cwd backend add backstage-plugin-search-backend-module-faq-snippets-collator +yarn --cwd backend add @internal/backstage-plugin-search-backend-module-faq-snippets-collator ``` After that, install the module on your Backstage backend instance: @@ -224,9 +224,11 @@ import { createBackend } from '@backstage/backend-defaults'; const backend = createBackend(); // Installing the search backend plugin backend.add(import('@backstage/plugin-search-backend/alpha')); -// Installing the newrly created faq snippets collator module +// Installing the newly created faq snippets collator module backend.add( - import('backstage-plugin-search-backend-module-faq-snippets-collator'), + import( + '@internal/backstage-plugin-search-backend-module-faq-snippets-collator' + ), ); //... backend.start();