MCPcopy Index your code
hub / github.com/lingodotdev/lingo.dev / getRepoRoot

Function getRepoRoot

scripts/docs/src/utils.ts:8–21  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

6import * as prettier from "prettier";
7
8export function getRepoRoot(): string {
9 const __filename = fileURLToPath(import.meta.url);
10 const __dirname = path.dirname(__filename);
11 let currentDir = __dirname;
12
13 while (currentDir !== path.parse(currentDir).root) {
14 if (existsSync(path.join(currentDir, ".git"))) {
15 return currentDir;
16 }
17 currentDir = path.dirname(currentDir);
18 }
19
20 throw new Error("Could not find project root");
21}
22
23export function getGitHubToken() {
24 const token = process.env.GITHUB_TOKEN;

Callers 3

utils.test.tsFile · 0.90
mainFunction · 0.90
formatMarkdownFunction · 0.85

Calls 1

parseMethod · 0.80

Tested by

no test coverage detected