MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / repoRoot

Function repoRoot

packages/cli/src/commands/lambda/repoRoot.ts:15–33  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

13import { fileURLToPath } from "node:url";
14
15export function repoRoot(): string {
16 const override = process.env.HYPERFRAMES_REPO_ROOT;
17 if (override && existsSync(resolve(override, "packages", "aws-lambda", "package.json"))) {
18 return override;
19 }
20 let dir = dirname(fileURLToPath(import.meta.url));
21 for (let depth = 0; depth < 12; depth++) {
22 if (existsSync(resolve(dir, "packages", "aws-lambda", "package.json"))) {
23 return dir;
24 }
25 const parent = dirname(dir);
26 if (parent === dir) break;
27 dir = parent;
28 }
29 throw new Error(
30 "[hyperframes lambda] could not find the repo root (no packages/aws-lambda/ above this CLI's source). " +
31 "Run `hyperframes lambda` from within a hyperframes checkout, or set HYPERFRAMES_REPO_ROOT explicitly.",
32 );
33}

Callers 2

runDeployFunction · 0.85
runDestroyFunction · 0.85

Calls 1

resolveFunction · 0.85

Tested by

no test coverage detected