Add techdocs-core plugin to techdocs builder automatically

Currently users need to modify their mkdocs files to container techdocs-core plugin manually when they want to expose techdocs in Backstage. To have a standardized set of extensions without the need to modify existing files (and possibly pollute alternative/additional mkdocs pipelines) this should be added automatically.

This PR adds a helper function to modify the mkdocs file to contain this plugin if it doesn't exist in the config file.

Co-authored-by: @emmaindal

Signed-off-by: Jussi Hallila <jussi@hallila.com>
This commit is contained in:
Jussi Hallila
2022-02-15 17:01:46 +01:00
parent 5dcf41492f
commit ff0a16fb1a
14 changed files with 286 additions and 98 deletions
+2
View File
@@ -130,6 +130,8 @@ Options:
if not found.
--etag <ETAG> A unique identifier for the prepared tree e.g. commit SHA. If provided it will be stored
in techdocs_metadata.json.
--omitTechdocsCoreMkdocsPlugin An option to disable automatic addition of techdocs-core plugin to the mkdocs.yaml files.
Defaults to false, which means that the techdocs-core plugin is always added to the mkdocs file.
-v --verbose Enable verbose output. (default: false)
-h, --help display help for command
```
+5
View File
@@ -37,6 +37,11 @@ techdocs:
pullImage: true
mkdocs:
# (Optional) techdocs.generator.omitTechdocsCoreMkdocsPlugin can be used to disable automatic addition of techdocs-core plugin to the mkdocs.yaml files.
# Defaults to false, which means that the techdocs-core plugin is always added to the mkdocs file.
omitTechdocsCorePlugin: false
# techdocs.builder can be either 'local' or 'external.
# If builder is set to 'local' and you open a TechDocs page, techdocs-backend will try to generate the docs, publish to storage
# and show the generated docs afterwords. This is the "Basic" setup of the TechDocs Architecture.
@@ -79,6 +79,9 @@ plugins:
- techdocs-core
```
> Note - The plugins section above is optional. Backstage automatically adds the `techdocs-core` plugin to the
> mkdocs file if it is missing. This functionality can be turned off with a [configuration option](./configuration.md) in Backstage.
Update your component's entity description by adding the following lines to its
`catalog-info.yaml` in the root of its repository: