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:
@@ -39,6 +39,7 @@ export default async function generate(cmd: Command) {
|
||||
|
||||
const sourceDir = resolve(cmd.sourceDir);
|
||||
const outputDir = resolve(cmd.outputDir);
|
||||
const omitTechdocsCorePlugin = cmd.omitTechdocsCoreMkdocsPlugin;
|
||||
const dockerImage = cmd.dockerImage;
|
||||
const pullImage = cmd.pull;
|
||||
|
||||
@@ -55,6 +56,9 @@ export default async function generate(cmd: Command) {
|
||||
runIn: cmd.docker ? 'docker' : 'local',
|
||||
dockerImage,
|
||||
pullImage,
|
||||
mkdocs: {
|
||||
omitTechdocsCorePlugin,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
@@ -54,6 +54,11 @@ export function registerCommands(program: CommanderStatic) {
|
||||
'A unique identifier for the prepared tree e.g. commit SHA. If provided it will be stored in techdocs_metadata.json.',
|
||||
)
|
||||
.option('-v --verbose', 'Enable verbose output.', false)
|
||||
.option(
|
||||
'--omitTechdocsCoreMkdocsPlugin',
|
||||
"Don't patch MkDocs file automatically with techdocs-core plugin.",
|
||||
false,
|
||||
)
|
||||
.alias('build')
|
||||
.action(lazy(() => import('./generate/generate').then(m => m.default)));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user