fork of hey-api/openapi-ts because I need some additional things
at feat/skip-token 13 lines 397 B view raw
1import fs from 'node:fs'; 2import path from 'node:path'; 3 4import yaml from 'yaml'; 5 6export const getSpecsPath = (): string => 7 path.join(__dirname, '..', '..', '..', '..', '..', 'specs'); 8 9export const specFileToJson = (file: string) => { 10 const raw = fs.readFileSync(file, 'utf8'); 11 const ext = path.extname(file).toLowerCase(); 12 return ext === '.json' ? JSON.parse(raw) : yaml.parse(raw); 13};