From 6a3127526de149024c566f699f9072ffdd9c8b8e Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Fri, 10 May 2024 10:21:40 +0200 Subject: [PATCH] catalog,scaffolder: fix backend installation instructions Signed-off-by: Patrik Oldsberg --- plugins/catalog-backend/README.md | 16 ++++++++++++---- plugins/scaffolder-backend/README.md | 16 ++++++++++++---- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/plugins/catalog-backend/README.md b/plugins/catalog-backend/README.md index c2fbe713b9..b0bd0328ab 100644 --- a/plugins/catalog-backend/README.md +++ b/plugins/catalog-backend/README.md @@ -28,11 +28,19 @@ restoring the plugin, if you previously removed it. yarn --cwd packages/backend add @backstage/plugin-catalog-backend ``` -### Adding the plugin to your `packages/backend` +Then add the plugin to your backend, typically in `packages/backend/src/index.ts`: -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/catalog.ts` with -contents matching [catalog.ts in the create-app template](https://github.com/backstage/backstage/blob/master/packages/create-app/templates/default-app/packages/backend/src/plugins/catalog.ts). +```ts +const backend = createBackend(); +// ... +backend.add(import('@backstage/plugin-catalog-backend/alpha')); +``` + +#### Old backend system + +In the old backend system there's a bit more wiring required. You'll need to +create a file called `packages/backend/src/plugins/catalog.ts` with contents +matching [catalog.ts in the create-app template](https://github.com/backstage/backstage/blob/ad9314d3a7e0405719ba93badf96e97adde8ef83/packages/create-app/templates/default-app/packages/backend/src/plugins/catalog.ts). With the `catalog.ts` router setup in place, add the router to `packages/backend/src/index.ts`: diff --git a/plugins/scaffolder-backend/README.md b/plugins/scaffolder-backend/README.md index c0629f24f0..d760b0fc2d 100644 --- a/plugins/scaffolder-backend/README.md +++ b/plugins/scaffolder-backend/README.md @@ -22,11 +22,19 @@ restoring the plugin, if you previously removed it. yarn --cwd packages/backend add @backstage/plugin-scaffolder-backend ``` -### Adding the plugin to your `packages/backend` +Then add the plugin to your backend, typically in `packages/backend/src/index.ts`: -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/scaffolder.ts` -with contents matching [scaffolder.ts in the create-app template](https://github.com/backstage/backstage/blob/master/packages/create-app/templates/default-app/packages/backend/src/plugins/scaffolder.ts). +```ts +const backend = createBackend(); +// ... +backend.add(import('@backstage/plugin-scaffolder-backend/alpha')); +``` + +#### Old backend system + +In the old backend system there's a bit more wiring required. You'll need to +create a file called `packages/backend/src/plugins/scaffolder.ts` +with contents matching [scaffolder.ts in the create-app template](https://github.com/backstage/backstage/blob/ad9314d3a7e0405719ba93badf96e97adde8ef83/packages/create-app/templates/default-app/packages/backend/src/plugins/scaffolder.ts). With the `scaffolder.ts` router setup in place, add the router to `packages/backend/src/index.ts`: