From faa86f3981845b86f1b90ce24b3fcf15f0825787 Mon Sep 17 00:00:00 2001 From: cmoulliard Date: Thu, 2 May 2024 09:57:49 +0200 Subject: [PATCH 1/2] Register the to the DevApp fixing the issue to launch locally the plugin. Add a new section to the plugin scaffolder README. #23684 Signed-off-by: cmoulliard --- .changeset/few-dodos-cheer.md | 5 +++++ plugins/scaffolder/README.md | 9 +++++++++ plugins/scaffolder/dev/index.tsx | 18 ++++++------------ 3 files changed, 20 insertions(+), 12 deletions(-) create mode 100644 .changeset/few-dodos-cheer.md diff --git a/.changeset/few-dodos-cheer.md b/.changeset/few-dodos-cheer.md new file mode 100644 index 0000000000..a80147e112 --- /dev/null +++ b/.changeset/few-dodos-cheer.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-scaffolder': patch +--- + +Register the `catalogPlugin` to the DevApp fixing the issue to launch locally the plugin diff --git a/plugins/scaffolder/README.md b/plugins/scaffolder/README.md index a6af441d62..07111a33e5 100644 --- a/plugins/scaffolder/README.md +++ b/plugins/scaffolder/README.md @@ -121,6 +121,15 @@ export const apis: AnyApiFactory[] = [ This replaces the default implementation of the `scaffolderApiRef`. +### Local development + +When you develop a new template, action or new ``, then we recommend +to launch the plugin locally using the `createDevApp` of the `./dev/index.tsx` file for testing/Debugging purposes + +To play with it, open a terminal and run the command: `yarn start` within the `./plugins/scaffolder` folder + +**NOTE:** Don't forget to open a second terminal and to launch the backend or [backend-next](../../docs/backend-system/index.md) there, using `yarn start` and to specify the locations of the templates to play with ! + ## Links - [scaffolder-backend](https://github.com/backstage/backstage/tree/master/plugins/scaffolder-backend) diff --git a/plugins/scaffolder/dev/index.tsx b/plugins/scaffolder/dev/index.tsx index e4425b04bf..2980fe90fc 100644 --- a/plugins/scaffolder/dev/index.tsx +++ b/plugins/scaffolder/dev/index.tsx @@ -14,11 +14,9 @@ * limitations under the License. */ -import { CatalogClient } from '@backstage/catalog-client'; import { createDevApp } from '@backstage/dev-utils'; import { scmIntegrationsApiRef } from '@backstage/integration-react'; import { - catalogApiRef, starredEntitiesApiRef, MockStarredEntitiesApi, } from '@backstage/plugin-catalog-react'; @@ -30,18 +28,10 @@ import { fetchApiRef, identityApiRef, } from '@backstage/core-plugin-api'; -import { CatalogEntityPage } from '@backstage/plugin-catalog'; +import { CatalogEntityPage, catalogPlugin } from '@backstage/plugin-catalog'; createDevApp() - .addPage({ - path: '/catalog/:kind/:namespace/:name', - element: , - }) - .registerApi({ - api: catalogApiRef, - deps: { discoveryApi: discoveryApiRef }, - factory: ({ discoveryApi }) => new CatalogClient({ discoveryApi }), - }) + .registerPlugin(catalogPlugin) .registerApi({ api: starredEntitiesApiRef, deps: {}, @@ -63,6 +53,10 @@ createDevApp() identityApi, }), }) + .addPage({ + path: '/catalog/:kind/:namespace/:name', + element: , + }) .addPage({ path: '/create', title: 'Create', From 22785e3085acaab37c16c3320fb13e336a714892 Mon Sep 17 00:00:00 2001 From: cmoulliard Date: Tue, 21 May 2024 09:56:17 +0200 Subject: [PATCH 2/2] Deleting the changeset file as it's not being published Signed-off-by: cmoulliard --- .changeset/few-dodos-cheer.md | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 .changeset/few-dodos-cheer.md diff --git a/.changeset/few-dodos-cheer.md b/.changeset/few-dodos-cheer.md deleted file mode 100644 index a80147e112..0000000000 --- a/.changeset/few-dodos-cheer.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/plugin-scaffolder': patch ---- - -Register the `catalogPlugin` to the DevApp fixing the issue to launch locally the plugin