mirror of
https://github.com/renovatebot/renovate.git
synced 2026-10-27 07:50:47 +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
28 lines
1008 B
TypeScript
28 lines
1008 B
TypeScript
import { getPlatformList } from '../../lib/modules/platform';
|
|
import { readFile, updateFile } from '../utils';
|
|
import { replaceContent } from './utils';
|
|
|
|
function getModuleLink(module: string, title: string): string {
|
|
return `[${title ?? module}](${module}/)`;
|
|
}
|
|
|
|
export async function generatePlatforms(dist: string): Promise<void> {
|
|
let platformContent = 'Supported values for `platform` are: ';
|
|
const platforms = getPlatformList();
|
|
for (const platform of platforms) {
|
|
const readme = await readFile(`lib/modules/platform/${platform}/index.md`);
|
|
await updateFile(`${dist}/modules/platform/${platform}/index.md`, readme);
|
|
}
|
|
|
|
platformContent += platforms
|
|
.map((v) => getModuleLink(v, `\`${v}\``))
|
|
.join(', ');
|
|
|
|
platformContent += '.\n';
|
|
|
|
const indexFileName = `docs/usage/modules/platform.md`;
|
|
let indexContent = await readFile(indexFileName);
|
|
indexContent = replaceContent(indexContent, platformContent);
|
|
await updateFile(`${dist}/modules/platform.md`, indexContent);
|
|
}
|