Deprecate packages

Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
blam
2024-04-18 20:50:07 +02:00
parent 7cd92e1c34
commit a3f2522771
3 changed files with 11 additions and 96 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-shortcuts': patch
---
These packages have been migrated to the [backstage/community-plugins](https://github.com/backstage/community-plugins) repository.
+2 -94
View File
@@ -1,95 +1,3 @@
# shortcuts
# Deprecated
The shortcuts plugin allows a user to have easy access to pages within a Backstage app by storing them as "shortcuts" in the Sidebar.
## Usage
### Install the package:
```bash
# From your Backstage root directory
yarn --cwd packages/app add @backstage/plugin-shortcuts
```
### 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';
```
If you don't have a `plugins.ts` file see: [troubleshooting](#troubleshooting)
### Add the `<Shortcuts />` component within your `<Sidebar>`:
Edit file `packages/app/src/components/Root/Root.tsx`
```tsx
import {
Sidebar,
SidebarDivider,
SidebarSpace,
} from '@backstage/core-components';
import { Shortcuts } from '@backstage/plugin-shortcuts';
export const SidebarComponent = () => (
<Sidebar>
{/* ... */}
<SidebarDivider />
<Shortcuts />
<SidebarSpace />
</Sidebar>
);
```
To allow external links to be added as shortcut, you can add `allowExternalLinks` property to the `<Shortcuts />` component.
The plugin exports a `shortcutApiRef` but the plugin includes a default implementation of the `ShortcutApi` that uses `localStorage` to store each user's shortcuts.
To overwrite the default implementation add it to the App's `apis.ts`:
```ts
import { shortcutsApiRef } from '@backstage/plugin-shortcuts';
import { CustomShortcutsImpl } from '...';
export const apis = [
// ...
createApiFactory({
api: shortcutsApiRef,
deps: {},
factory: () => new CustomShortcutsImpl(),
}),
];
```
# Troubleshooting
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';
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 }) {
/* ... */
},
});
```
This package has been moved to the [backstage-community/plugins](https://github.com/backstage/community-plugins) repository. Migrate to using `@backstage-community/plugin-shortcuts` instead.
+4 -2
View File
@@ -3,7 +3,8 @@
"version": "0.3.23",
"description": "A Backstage plugin that provides a shortcuts feature to the sidebar",
"backstage": {
"role": "frontend-plugin"
"role": "frontend-plugin",
"moved": "@backstage-community/plugin-shortcuts"
},
"publishConfig": {
"access": "public",
@@ -58,5 +59,6 @@
"react": "^16.13.1 || ^17.0.0 || ^18.0.0",
"react-dom": "^16.13.1 || ^17.0.0 || ^18.0.0",
"react-router-dom": "6.0.0-beta.0 || ^6.3.0"
}
},
"deprecated": "This package has been moved to the backstage/community-plugins repository. You should migrate to using @backstage-community/plugin-shortcuts instead."
}