MCPcopy Create free account
hub / github.com/arktypeio/arktype / resolveAotCli

Function resolveAotCli

ark/type/cli.ts:397–410  ·  view source on GitHub ↗
(cwd: string)

Source from the content-addressed store, hash-verified

395}
396
397const resolveAotCli = (cwd: string): string | undefined => {
398 // Yarn PnP has no node_modules on disk; resolve through Node's module hooks
399 // (avoiding NODE_PATH leaks from pnpm bin shims in non-PnP environments)
400 const found =
401 findAotInNodeModules(cwd) ??
402 ("pnp" in process.versions ? findAotViaRequire(cwd) : undefined)
403 if (!found) return undefined
404 const { pkgDir } = found
405 const builtCli = join(pkgDir, "out", "cli.js")
406 if (existsSync(builtCli)) return builtCli
407 const srcCli = join(pkgDir, "cli.ts")
408 if (existsSync(srcCli)) return srcCli
409 return undefined
410}
411
412const aotSubcommands = new Set(["check", "emit", "declare"])
413

Callers 2

runAotFunction · 0.85
runInitFunction · 0.85

Calls 3

findAotInNodeModulesFunction · 0.85
findAotViaRequireFunction · 0.85
joinFunction · 0.85

Tested by

no test coverage detected