docs(scaffolder): update README for new frontend system as default
Move old frontend system wiring instructions to an "Old Frontend System" section. The default installation path now uses package discovery with no manual wiring needed. Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com> Made-with: Cursor
This commit is contained in:
@@ -15,13 +15,68 @@ To check if you already have the package, look under
|
||||
`@backstage/plugin-scaffolder`. The instructions below walk through restoring
|
||||
the plugin, if you previously removed it.
|
||||
|
||||
### Install the package
|
||||
|
||||
```bash
|
||||
# From your Backstage root directory
|
||||
yarn --cwd packages/app add @backstage/plugin-scaffolder
|
||||
```
|
||||
|
||||
Once installed, the plugin is automatically available in your app through the default package discovery. For more details and alternative installation methods, see [installing plugins](https://backstage.io/docs/frontend-system/building-apps/installing-plugins).
|
||||
|
||||
### Troubleshooting
|
||||
|
||||
If you encounter the [issue of closing EventStream](https://github.com/backstage/backstage/issues/5535)
|
||||
which auto-updates logs during task execution, you can enable long polling. To do so,
|
||||
update your `packages/app/src/apis.ts` file to register a `ScaffolderClient` with the
|
||||
`useLongPollingLogs` set to `true`. By default, it is `false`.
|
||||
|
||||
```typescript
|
||||
import {
|
||||
createApiFactory,
|
||||
discoveryApiRef,
|
||||
fetchApiRef,
|
||||
identityApiRef,
|
||||
} from '@backstage/core-plugin-api';
|
||||
import {
|
||||
scaffolderApiRef,
|
||||
ScaffolderClient,
|
||||
} from '@backstage/plugin-scaffolder';
|
||||
|
||||
export const apis: AnyApiFactory[] = [
|
||||
createApiFactory({
|
||||
api: scaffolderApiRef,
|
||||
deps: {
|
||||
discoveryApi: discoveryApiRef,
|
||||
identityApi: identityApiRef,
|
||||
scmIntegrationsApi: scmIntegrationsApiRef,
|
||||
fetchApi: fetchApiRef,
|
||||
},
|
||||
factory: ({ scmIntegrationsApi, discoveryApi, identityApi, fetchApi }) =>
|
||||
new ScaffolderClient({
|
||||
discoveryApi,
|
||||
identityApi,
|
||||
scmIntegrationsApi,
|
||||
fetchApi,
|
||||
useLongPollingLogs: true,
|
||||
}),
|
||||
}),
|
||||
// ... other factories
|
||||
```
|
||||
|
||||
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 !
|
||||
|
||||
## Old Frontend System
|
||||
|
||||
If your Backstage app uses the old frontend system, you need to manually wire the plugin into your app.
|
||||
|
||||
### Add the plugin to your `packages/app`
|
||||
|
||||
Add the root page that the scaffolder plugin provides to your app. You can
|
||||
@@ -78,57 +133,6 @@ export const Root = ({ children }: PropsWithChildren<{}>) => (
|
||||
</Sidebar>
|
||||
```
|
||||
|
||||
### Troubleshooting
|
||||
|
||||
If you encounter the [issue of closing EventStream](https://github.com/backstage/backstage/issues/5535)
|
||||
which auto-updates logs during task execution, you can enable long polling. To do so,
|
||||
update your `packages/app/src/apis.ts` file to register a `ScaffolderClient` with the
|
||||
`useLongPollingLogs` set to `true`. By default, it is `false`.
|
||||
|
||||
```typescript
|
||||
import {
|
||||
createApiFactory,
|
||||
discoveryApiRef,
|
||||
fetchApiRef,
|
||||
identityApiRef,
|
||||
} from '@backstage/core-plugin-api';
|
||||
import {
|
||||
scaffolderApiRef,
|
||||
ScaffolderClient,
|
||||
} from '@backstage/plugin-scaffolder';
|
||||
|
||||
export const apis: AnyApiFactory[] = [
|
||||
createApiFactory({
|
||||
api: scaffolderApiRef,
|
||||
deps: {
|
||||
discoveryApi: discoveryApiRef,
|
||||
identityApi: identityApiRef,
|
||||
scmIntegrationsApi: scmIntegrationsApiRef,
|
||||
fetchApi: fetchApiRef,
|
||||
},
|
||||
factory: ({ scmIntegrationsApi, discoveryApi, identityApi, fetchApi }) =>
|
||||
new ScaffolderClient({
|
||||
discoveryApi,
|
||||
identityApi,
|
||||
scmIntegrationsApi,
|
||||
fetchApi,
|
||||
useLongPollingLogs: true,
|
||||
}),
|
||||
}),
|
||||
// ... other factories
|
||||
```
|
||||
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user