Merge pull request #24585 from ch007m/devapp-plugin-scaffolder

Register the catalogPlugin to the DevApp fixing the issue to launch locally the scaffolder plugin
This commit is contained in:
Ben Lambert
2024-05-27 14:45:49 +02:00
committed by GitHub
2 changed files with 15 additions and 12 deletions
+9
View File
@@ -120,6 +120,15 @@ export const apis: AnyApiFactory[] = [
This replaces the default implementation of the `scaffolderApiRef`.
### Local development
When you develop a new template, action or new `<ScaffolderFieldExtensions/>`, 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)
+6 -12
View File
@@ -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';
@@ -31,18 +29,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: <CatalogEntityPage />,
})
.registerApi({
api: catalogApiRef,
deps: { discoveryApi: discoveryApiRef },
factory: ({ discoveryApi }) => new CatalogClient({ discoveryApi }),
})
.registerPlugin(catalogPlugin)
.registerApi({
api: starredEntitiesApiRef,
deps: {},
@@ -64,6 +54,10 @@ createDevApp()
identityApi,
}),
})
.addPage({
path: '/catalog/:kind/:namespace/:name',
element: <CatalogEntityPage />,
})
.addPage({
path: '/create',
title: 'Create',