mirror of https://github.com/renovatebot/renovate
17 lines
543 B
TypeScript
17 lines
543 B
TypeScript
import { readLocalFile } from '../../../../util/fs';
|
|
import type { Http } from '../../../../util/http';
|
|
import type { CustomDatasourceFetcher } from './types';
|
|
|
|
export class JSONFetcher implements CustomDatasourceFetcher {
|
|
async fetch(http: Http, registryURL: string): Promise<unknown> {
|
|
const response = await http.getJson(registryURL);
|
|
return response.body;
|
|
}
|
|
|
|
async readFile(registryURL: string): Promise<unknown> {
|
|
const fileContent = await readLocalFile(registryURL, 'utf8');
|
|
|
|
return JSON.parse(fileContent!);
|
|
}
|
|
}
|