()
| 21 | export type Config = z.infer<typeof ConfigSchema>; |
| 22 | |
| 23 | export function getConfig(): Config { |
| 24 | const config = JSON.parse( |
| 25 | fs.readFileSync(path.resolve(`./${CONFIG}`)).toString() |
| 26 | ); |
| 27 | const cfg = ConfigSchema.safeParse(config); |
| 28 | if (!cfg.success) { |
| 29 | console.error("Invalid config file"); |
| 30 | throw new Error(cfg.error.issues.map((i) => i.message).join("\n")); |
| 31 | } |
| 32 | return cfg.data; |
| 33 | } |
| 34 | |
| 35 | export function hasConfig() { |
| 36 | return fs.existsSync(path.resolve(`./${CONFIG}`)); |
no outgoing calls
no test coverage detected