From ed7d7c0fcf786ef4a900116dda7428ca500b5784 Mon Sep 17 00:00:00 2001 From: blam Date: Thu, 18 Apr 2024 20:49:38 +0200 Subject: [PATCH] Deprecate packages Signed-off-by: blam --- .changeset/migrate-1713466176492.md | 7 + plugins/playlist-backend/README.md | 105 +------------- plugins/playlist-backend/package.json | 6 +- plugins/playlist-common/README.md | 4 +- plugins/playlist-common/package.json | 6 +- plugins/playlist/README.md | 193 +------------------------- plugins/playlist/package.json | 6 +- 7 files changed, 25 insertions(+), 302 deletions(-) create mode 100644 .changeset/migrate-1713466176492.md diff --git a/.changeset/migrate-1713466176492.md b/.changeset/migrate-1713466176492.md new file mode 100644 index 0000000000..bf9103a530 --- /dev/null +++ b/.changeset/migrate-1713466176492.md @@ -0,0 +1,7 @@ +--- +'@backstage/plugin-playlist': patch +'@backstage/plugin-playlist-backend': patch +'@backstage/plugin-playlist-common': patch +--- + +These packages have been migrated to the [backstage/community-plugins](https://github.com/backstage/community-plugins) repository. diff --git a/plugins/playlist-backend/README.md b/plugins/playlist-backend/README.md index d4474e2331..f8c66335a4 100644 --- a/plugins/playlist-backend/README.md +++ b/plugins/playlist-backend/README.md @@ -1,104 +1,3 @@ -# Playlist Backend +# Deprecated -Welcome to the playlist backend plugin! - -## Installation - -### Install the package - -```bash -# From your Backstage root directory -yarn --cwd packages/backend add @backstage/plugin-playlist-backend -``` - -### Adding the plugin to your `packages/backend` - -You'll need to add the plugin to the router in your `backend` package. You can do this by creating a file called `packages/backend/src/plugins/playlist.ts` - -```tsx -import { createRouter } from '@backstage/plugin-playlist-backend'; -import { Router } from 'express'; -import { PluginEnvironment } from '../types'; - -export default async function createPlugin( - env: PluginEnvironment, -): Promise { - return await createRouter({ - database: env.database, - discovery: env.discovery, - identity: env.identity, - logger: env.logger, - permissions: env.permissions, - }); -} -``` - -With the `playlist.ts` router setup in place, add the router to `packages/backend/src/index.ts`: - -```diff -+import playlist from './plugins/playlist'; - -async function main() { - ... - const createEnv = makeCreateEnv(config); - - const catalogEnv = useHotMemoize(module, () => createEnv('catalog')); -+ const playlistEnv = useHotMemoize(module, () => createEnv('playlist')); - - const apiRouter = Router(); -+ apiRouter.use('/playlist', await playlist(playlistEnv)); - ... - apiRouter.use(notFoundHandler()); - -``` - -## Setting up plugin permissions - -You configure permissions for specific playlist actions by importing the supported set of permissions from the [playlist-common](../playlist-common/README.md) package along with the custom rules/conditions provided here to incorporate into your [permission policy](https://backstage.io/docs/permissions/writing-a-policy). - -This package also exports a `DefaultPlaylistPermissionPolicy` which contains a recommended default permissions policy you can apply as a "sub-policy" in your app: - -```diff -# packages/backend/src/plugins/permission.ts - -+import { DefaultPlaylistPermissionPolicy, isPlaylistPermission } from '@backstage/plugin-playlist-backend'; -... -class BackstagePermissionPolicy implements PermissionPolicy { -+ private playlistPermissionPolicy = new DefaultPlaylistPermissionPolicy(); - - async handle( - request: PolicyQuery, - user?: BackstageIdentityResponse, - ): Promise { -+ if (isPlaylistPermission(request.permission)) { -+ return this.playlistPermissionPolicy.handle(request, user); -+ } - ... - } -} - -export default async function createPlugin(env: PluginEnvironment): Promise { - return await createRouter({ - config: env.config, - logger: env.logger, - discovery: env.discovery, - policy: new BackstagePermissionPolicy(), - ... -``` - -### New Backend System - -The Playlist backend plugin has support for the [new backend system](https://backstage.io/docs/backend-system/), here's how you can set that up: - -In your `packages/backend/src/index.ts` make the following changes: - -```diff -import { createBackend } from '@backstage/backend-defaults'; - -const backend = createBackend(); - -backend.add(import('@backstage/plugin-playlist-backend')); -// ... other feature additions - -backend.start(); -``` +This package has been moved to the [backstage-community/plugins](https://github.com/backstage/community-plugins) repository. Migrate to using `@backstage-community/plugin-playlist-backend` instead. diff --git a/plugins/playlist-backend/package.json b/plugins/playlist-backend/package.json index aaf8e0a2c8..06be21964e 100644 --- a/plugins/playlist-backend/package.json +++ b/plugins/playlist-backend/package.json @@ -2,7 +2,8 @@ "name": "@backstage/plugin-playlist-backend", "version": "0.3.21", "backstage": { - "role": "backend-plugin" + "role": "backend-plugin", + "moved": "@backstage-community/plugin-playlist-backend" }, "publishConfig": { "access": "public", @@ -56,5 +57,6 @@ "@backstage/cli": "workspace:^", "@types/supertest": "^2.0.8", "supertest": "^6.1.3" - } + }, + "deprecated": "This package has been moved to the backstage/community-plugins repository. You should migrate to using @backstage-community/plugin-playlist-backend instead." } diff --git a/plugins/playlist-common/README.md b/plugins/playlist-common/README.md index 72f502386c..8bbf2d49da 100644 --- a/plugins/playlist-common/README.md +++ b/plugins/playlist-common/README.md @@ -1,3 +1,3 @@ -# Playlist Common +# Deprecated -Common functionalities, types, and permissions for the playlist plugin. +This package has been moved to the [backstage-community/plugins](https://github.com/backstage/community-plugins) repository. Migrate to using `@backstage-community/plugin-playlist-common` instead. diff --git a/plugins/playlist-common/package.json b/plugins/playlist-common/package.json index 093586da31..08c9440eb7 100644 --- a/plugins/playlist-common/package.json +++ b/plugins/playlist-common/package.json @@ -3,7 +3,8 @@ "version": "0.1.15", "description": "Common functionalities for the playlist plugin", "backstage": { - "role": "common-library" + "role": "common-library", + "moved": "@backstage-community/plugin-playlist-common" }, "publishConfig": { "access": "public", @@ -37,5 +38,6 @@ }, "devDependencies": { "@backstage/cli": "workspace:^" - } + }, + "deprecated": "This package has been moved to the backstage/community-plugins repository. You should migrate to using @backstage-community/plugin-playlist-common instead." } diff --git a/plugins/playlist/README.md b/plugins/playlist/README.md index d326bcdedb..f745919785 100644 --- a/plugins/playlist/README.md +++ b/plugins/playlist/README.md @@ -1,192 +1,3 @@ -# Playlist Plugin +# Deprecated -Welcome to the playlist plugin! - -This plugin allows you to create, share, and follow custom collections of entities available in the Backstage catalog. - -## Setup - -The following sections will help you get the Playlist plugin setup and running - -### Backend - -You need to setup the [Playlist backend plugin](https://github.com/backstage/backstage/tree/master/plugins/playlist-backend) before you move forward with any of these steps if you haven't already - -### Installation - -Install this plugin: - -```bash -# From your Backstage root directory -yarn --cwd packages/app add @backstage/plugin-playlist -``` - -### Add the plugin to your `packages/app` - -Add the pages that the playlist plugin provides to your app. You can -choose any base path for the route, but we recommend the following: - -```diff -// packages/app/src/App.tsx -+import { PlaylistIndexPage, PlaylistPage } from '@backstage/plugin-playlist'; - - - - } /> - }> - {entityPage} - -+ } /> -+ } /> - ... - -``` - -You may also want to add a link to the playlist page to your application sidebar: - -```diff -// packages/app/src/components/Root/Root.tsx -+import PlaylistPlayIcon from '@material-ui/icons/PlaylistPlay'; - -export const Root = ({ children }: PropsWithChildren<{}>) => ( - - -+ - ... - -``` - -### Entity Pages - -You can also make the following changes to add the playlist context menu to your `EntityPage.tsx` -to be able to add entities to playlists directly from your entity pages: - -First we need to add the following imports: - -```ts -import { EntityPlaylistDialog } from '@backstage/plugin-playlist'; -import PlaylistAddIcon from '@material-ui/icons/PlaylistAdd'; -``` - -Next we'll update the React import that looks like this: - -```ts -import React from 'react'; -``` - -To look like this: - -```ts -import React, { ReactNode, useMemo, useState } from 'react'; -``` - -Then we have to add this chunk of code after all the imports but before any of the other code: - -```ts -const EntityLayoutWrapper = (props: { children?: ReactNode }) => { - const [playlistDialogOpen, setPlaylistDialogOpen] = useState(false); - - const extraMenuItems = useMemo(() => { - return [ - { - title: 'Add to playlist', - Icon: PlaylistAddIcon, - onClick: () => setPlaylistDialogOpen(true), - }, - ]; - }, []); - - return ( - <> - - {props.children} - - setPlaylistDialogOpen(false)} - /> - - ); -}; -``` - -The last step is to wrap all the entity pages in the `EntityLayoutWrapper` like this: - -```diff -const defaultEntityPage = ( -+ - - {overviewContent} - - - - - - - - - -+ -); -``` - -Note: the above only shows an example for the `defaultEntityPage` for a full example of this you can look at [this EntityPage](../../packages/app/src/components/catalog/EntityPage.tsx) - -## Custom Title - -You can define a custom title to be shown in all the components of this plugin to replace the default term "playlist" in the UI. To do this you just need to add some config in your **app-config.yaml**, here's an example: - -```yaml -playlist: - title: Collection -``` - -## Custom Index Page - -You can customize your playlist index page by composing your own implementation. See the [`DefaultPlaylistIndexPage`](./src/components/PlaylistIndexPage/DefaultPlaylistIndexPage.tsx) for a reference of what components are available from the default setup. - -```ts -- } /> -+ }> -+ -+ - } /> -``` - -## Features - -### View All Playlists - -![View all playlists example](./docs/playlist-view-all.png) - -### View Playlist - -![View Playlist example](./docs/playlist-view-single.png) - -### Create New Playlist - -![Create New Playlist example](./docs/playlist-create-new.png) - -### Duplicate Playlist Error - -![Duplicate Playlist Error example](./docs/playlist-duplicate-error.png) - -### Edit Existing Playlist - -![Edit Existing Playlist example](./docs/playlist-edit-existing.png) - -### Add Entities to Playlist - -![Add Entities to Playlist example](./docs/playlist-add-entities.png) - -### Add to Playlist from Entity - -![Add to Playlist from Entity example](./docs/playlist-add-from-entity.png) - -### Delete Playlist - -![Delete Playlist example](./docs/playlist-delete.png) - -## Links - -- [playlist-backend](../playlist-backend) provides the backend API for this frontend. +This package has been moved to the [backstage-community/plugins](https://github.com/backstage/community-plugins) repository. Migrate to using `@backstage-community/plugin-playlist` instead. diff --git a/plugins/playlist/package.json b/plugins/playlist/package.json index 8fa8682f17..aca822f63e 100644 --- a/plugins/playlist/package.json +++ b/plugins/playlist/package.json @@ -2,7 +2,8 @@ "name": "@backstage/plugin-playlist", "version": "0.2.8", "backstage": { - "role": "frontend-plugin" + "role": "frontend-plugin", + "moved": "@backstage-community/plugin-playlist" }, "publishConfig": { "access": "public", @@ -70,5 +71,6 @@ "react-dom": "^16.13.1 || ^17.0.0 || ^18.0.0", "react-router-dom": "6.0.0-beta.0 || ^6.3.0" }, - "configSchema": "config.d.ts" + "configSchema": "config.d.ts", + "deprecated": "This package has been moved to the backstage/community-plugins repository. You should migrate to using @backstage-community/plugin-playlist instead." }