create-app: Update techdocs-backend, add changesets
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
---
|
||||
'@backstage/create-app': patch
|
||||
---
|
||||
|
||||
techdocs-backend: Simplified file, removing individual preparers and generators.
|
||||
techdocs-backend: UrlReader is now available to use in preparers.
|
||||
@@ -0,0 +1,36 @@
|
||||
---
|
||||
'@backstage/techdocs-common': minor
|
||||
'@backstage/plugin-techdocs-backend': minor
|
||||
---
|
||||
|
||||
In your Backstage app, `packages/backend/plugins/techdocs.ts` file has now been simplified,
|
||||
to remove registering individual preparers and generators.
|
||||
|
||||
Please update the file when upgrading the version of `@backstage/plugin-techdocs-backend` package.
|
||||
|
||||
```typescript
|
||||
const preparers = await Preparers.fromConfig(config, {
|
||||
logger,
|
||||
reader,
|
||||
});
|
||||
|
||||
const generators = await Generators.fromConfig(config, {
|
||||
logger,
|
||||
});
|
||||
|
||||
const publisher = await Publisher.fromConfig(config, {
|
||||
logger,
|
||||
discovery,
|
||||
});
|
||||
```
|
||||
|
||||
You should be able to remove unnecessary imports, and just do
|
||||
|
||||
```typescript
|
||||
import {
|
||||
createRouter,
|
||||
Preparers,
|
||||
Generators,
|
||||
Publisher,
|
||||
} from '@backstage/plugin-techdocs-backend';
|
||||
```
|
||||
+18
-15
@@ -1,10 +1,7 @@
|
||||
import {
|
||||
createRouter,
|
||||
DirectoryPreparer,
|
||||
Preparers,
|
||||
Generators,
|
||||
TechdocsGenerator,
|
||||
CommonGitPreparer,
|
||||
Publisher,
|
||||
} from '@backstage/plugin-techdocs-backend';
|
||||
import { PluginEnvironment } from '../types';
|
||||
@@ -14,22 +11,28 @@ export default async function createPlugin({
|
||||
logger,
|
||||
config,
|
||||
discovery,
|
||||
reader,
|
||||
}: PluginEnvironment) {
|
||||
const generators = new Generators();
|
||||
const techdocsGenerator = new TechdocsGenerator(logger, config);
|
||||
// Preparers are responsible for fetching source files for documentation.
|
||||
const preparers = await Preparers.fromConfig(config, {
|
||||
logger,
|
||||
reader,
|
||||
});
|
||||
|
||||
generators.register('techdocs', techdocsGenerator);
|
||||
// Generators are used for generating documentation sites.
|
||||
const generators = await Generators.fromConfig(config, {
|
||||
logger,
|
||||
});
|
||||
|
||||
const preparers = new Preparers();
|
||||
const directoryPreparer = new DirectoryPreparer(logger);
|
||||
const commonGitPreparer = new CommonGitPreparer(logger);
|
||||
|
||||
preparers.register('dir', directoryPreparer);
|
||||
preparers.register('github', commonGitPreparer);
|
||||
preparers.register('gitlab', commonGitPreparer);
|
||||
|
||||
const publisher = Publisher.fromConfig(config, logger, discovery);
|
||||
// Publisher is used for
|
||||
// 1. Publishing generated files to storage
|
||||
// 2. Fetching files from storage and passing them to TechDocs frontend.
|
||||
const publisher = await Publisher.fromConfig(config, {
|
||||
logger,
|
||||
discovery,
|
||||
});
|
||||
|
||||
// Docker client (conditionally) used by the generators, based on techdocs.generators config.
|
||||
const dockerClient = new Docker();
|
||||
|
||||
return await createRouter({
|
||||
|
||||
Reference in New Issue
Block a user