Files
renovate/tools/docs/templates.ts
T
Michael Kriese e4c938b7a5 docs: release as asset (#11429)
* docs: prepare release as asset

* chore: cleanup

* fix: wrong extension

* fix: wrong logger

* fix: wrong path

* chore: clean and create tmp

* chore: fix types

* fix: update generation

* Update .github/workflows/build.yml

Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com>

* Update lib/datasource/types.ts

Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com>

Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com>
2021-12-09 21:12:49 +01:00

27 lines
1.0 KiB
TypeScript

import { allowedFields, exposedConfigOptions } from '../../lib/util/template';
import { readFile, updateFile } from '../utils';
import { replaceContent } from './utils';
export async function generateTemplates(dist: string): Promise<void> {
let exposedConfigOptionsText =
'The following configuration options are passed through for templating: ';
exposedConfigOptionsText +=
exposedConfigOptions
.map(
(field) => `[${field}](/configuration-options/#${field.toLowerCase()})`
)
.join(', ') + '.';
let runtimeText =
'The following runtime values are passed through for templating: \n\n';
for (const [field, description] of Object.entries(allowedFields)) {
runtimeText += ` - \`${field}\`: ${description}\n`;
}
runtimeText += '\n\n';
let templateContent = await readFile('docs/usage/templates.md');
templateContent = replaceContent(templateContent, exposedConfigOptionsText);
templateContent = replaceContent(templateContent, runtimeText);
await updateFile(`${dist}/templates.md`, templateContent);
}