import path from 'path' import { existsSync, readJson, readJsonSync } from './fs' import { Obj } from './type' export async function loadJson(dir: string, filename: string): Promise { const filepath = path.resolve(dir, filename) if (!existsSync(filepath)) { return {} } return readJson(filepath) as Promise } export function loadJsonSync(dir: string, filename: string): Obj { const filepath = path.resolve(dir, filename) if (!existsSync(filepath)) { return {} } return readJsonSync(filepath) as Obj }