mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-11 13:48:55 +00:00
18 lines
619 B
TypeScript
18 lines
619 B
TypeScript
import { readLocalFile } from '../../../../util/fs';
|
|
import type { Http } from '../../../../util/http';
|
|
import { parseSingleYaml } from '../../../../util/yaml';
|
|
import type { CustomDatasourceFetcher } from './types';
|
|
|
|
export class YamlFetcher implements CustomDatasourceFetcher {
|
|
async fetch(http: Http, registryURL: string): Promise<unknown> {
|
|
const response = await http.get(registryURL);
|
|
|
|
return parseSingleYaml(response.body);
|
|
}
|
|
|
|
async readFile(registryURL: string): Promise<unknown> {
|
|
const fileContent = await readLocalFile(registryURL, 'utf8');
|
|
|
|
return parseSingleYaml(fileContent!);
|
|
}
|
|
}
|