MCPcopy Create free account
hub / github.com/ProNextJS/declarative-routing / getConfig

Function getConfig

src/config.ts:23–33  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

21export type Config = z.infer<typeof ConfigSchema>;
22
23export 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
35export function hasConfig() {
36 return fs.existsSync(path.resolve(`./${CONFIG}`));

Callers 12

setupFunction · 0.90
setupFunction · 0.90
isInfoFileFunction · 0.90
isRouteFileFunction · 0.90
writeRoutesFunction · 0.90
parseInfoFileFunction · 0.90
checkRouteFileFunction · 0.90
buildFilesFunction · 0.90
updateBuildFilesFunction · 0.90
buildREADMEFunction · 0.90
build.tsFile · 0.90
setupFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected