mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-13 15:36:25 +00:00
dca3418bbd
Moves datasource, manager, platform and versioning code from lib/ into new lib/modules/ BREAKING CHANGE: External tools must update paths to datasource, manager, platform and versioning
36 lines
1.3 KiB
TypeScript
36 lines
1.3 KiB
TypeScript
import { getDatasources } from '../../lib/modules/datasource';
|
|
import { readFile, updateFile } from '../utils';
|
|
import {
|
|
formatDescription,
|
|
formatUrls,
|
|
getDisplayName,
|
|
replaceContent,
|
|
} from './utils';
|
|
|
|
export async function generateDatasources(dist: string): Promise<void> {
|
|
const dsList = getDatasources();
|
|
let datasourceContent =
|
|
'\nSupported values for `datasource` are: ' +
|
|
[...dsList.keys()].map((v) => `\`${v}\``).join(', ') +
|
|
'.\n\n';
|
|
for (const [datasource, definition] of dsList) {
|
|
const { id, urls, defaultConfig } = definition;
|
|
const displayName = getDisplayName(datasource, definition);
|
|
datasourceContent += `\n### ${displayName} Datasource\n\n`;
|
|
datasourceContent += `**Identifier**: \`${id}\`\n\n`;
|
|
datasourceContent += formatUrls(urls);
|
|
datasourceContent += await formatDescription('datasource', datasource);
|
|
|
|
if (defaultConfig) {
|
|
datasourceContent +=
|
|
'**Default configuration**:\n\n```json\n' +
|
|
JSON.stringify(defaultConfig, undefined, 2) +
|
|
'\n```\n';
|
|
}
|
|
|
|
datasourceContent += `\n----\n\n`;
|
|
}
|
|
let indexContent = await readFile(`docs/usage/modules/datasource.md`);
|
|
indexContent = replaceContent(indexContent, datasourceContent);
|
|
await updateFile(`${dist}/modules/datasource.md`, indexContent);
|
|
}
|