MCPcopy Create free account
hub / github.com/effect-app/libs / loadConfig

Function loadConfig

packages/eslint-codegen-model/src/cli.ts:14–26  ·  view source on GitHub ↗
(cwd: string, explicit?: string)

Source from the content-addressed store, hash-verified

12const CONFIG_FILENAMES = ["codegen.config.json"]
13
14function loadConfig(cwd: string, explicit?: string): CodegenDefaults | undefined {
15 const candidates = explicit ? [path.resolve(cwd, explicit)] : CONFIG_FILENAMES.map((f) => path.join(cwd, f))
16 for (const candidate of candidates) {
17 if (fs.existsSync(candidate) && fs.statSync(candidate).isFile()) {
18 const parsed = JSON.parse(fs.readFileSync(candidate, "utf8"))
19 return parsed as CodegenDefaults
20 }
21 }
22 if (explicit) {
23 throw new Error(`Config not found: ${explicit}`)
24 }
25 return undefined
26}
27
28const modelBlockRe = /\/\/ codegen:start[ \t]*\{[^}]*\bpreset:\s*model\b/
29const staticTypeModelBlockRe =

Callers 1

runFunction · 0.85

Calls 3

joinMethod · 0.80
parseMethod · 0.80
mapMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…