From 58f90dc757345d2fd0db16a1c60643f4a9a98e8f Mon Sep 17 00:00:00 2001 From: Juan Pablo Garcia Ripa Date: Thu, 19 Aug 2021 18:50:45 +0200 Subject: [PATCH 1/2] add troubleshot instructions when plugin.ts is missing Signed-off-by: Juan Pablo Garcia Ripa --- plugins/shortcuts/README.md | 40 ++++++++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/plugins/shortcuts/README.md b/plugins/shortcuts/README.md index 162afe009b..5d77149e34 100644 --- a/plugins/shortcuts/README.md +++ b/plugins/shortcuts/README.md @@ -4,20 +4,24 @@ The shortcuts plugin allows a user to have easy access to pages within a Backsta ## Usage -Install the package: +### Install the package: ```bash yarn add @backstage/plugin-shortcuts ``` -Add it to your App's `plugins.ts` file: +### Register plugin: + +This plugin requires explicit registration, so you will need to add it to your App's `plugins.ts` file: ```ts // ... export { shortcutsPlugin } from '@backstage/plugin-shortcuts'; ``` -Add the `` component within your ``: +If you don't have a `plugins.ts` see: [troubleshoot](#troubleshoot) + +### Add the `` component within your ``: ```tsx import { Sidebar, SidebarDivider, SidebarSpace } from '@backstage/core'; @@ -50,3 +54,33 @@ export const apis = [ }), ]; ``` + +# Troubleshoot + +If you don't have a `plugins.ts` you can create a new one on `packages/app/src/plugins.ts` and then add this lines to your `App.tsx` if there is other plugins that requires explicit registration: + +```diff ++ import * as plugins from './plugins'; + +const app = createApp({ + apis, ++ plugins: Object.values(plugins), + bindRoutes({ bind }) { + /* ... */ + }, +}); +``` + +Or simply edit `App.tsx` with: + +```diff ++ import { shortcutsPlugin } from '@backstage/plugin-shortcuts + +const app = createApp({ + apis, ++ plugins: [shortcutsPlugin], + bindRoutes({ bind }) { + /* ... */ + }, +}); +``` From 283b350cb338052ba45f2cb7d1d653c232d1e099 Mon Sep 17 00:00:00 2001 From: Juan Pablo Garcia Ripa Date: Fri, 20 Aug 2021 08:54:39 +0200 Subject: [PATCH 2/2] apply suggested language improvements Signed-off-by: Juan Pablo Garcia Ripa --- plugins/shortcuts/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/shortcuts/README.md b/plugins/shortcuts/README.md index 5d77149e34..a3da6bc4ee 100644 --- a/plugins/shortcuts/README.md +++ b/plugins/shortcuts/README.md @@ -19,7 +19,7 @@ This plugin requires explicit registration, so you will need to add it to your A export { shortcutsPlugin } from '@backstage/plugin-shortcuts'; ``` -If you don't have a `plugins.ts` see: [troubleshoot](#troubleshoot) +If you don't have a `plugins.ts` file see: [troubleshooting](#troubleshooting) ### Add the `` component within your ``: @@ -55,9 +55,9 @@ export const apis = [ ]; ``` -# Troubleshoot +# Troubleshooting -If you don't have a `plugins.ts` you can create a new one on `packages/app/src/plugins.ts` and then add this lines to your `App.tsx` if there is other plugins that requires explicit registration: +If you don't have a `plugins.ts` file, you can create it with the path `packages/app/src/plugins.ts` and then import it into your `App.tsx`: ```diff + import * as plugins from './plugins';