Spaces:
Runtime error
Runtime error
Download src/lib/server/findRepoRoot.ts from evijit/pluralchat: direct link, hf CLI and curl.
- Browser
- Download file 392 Bytes
-
https://huggingface.co/spaces/evijit/pluralchat/resolve/refs%2Fpr%2F1/src/lib/server/findRepoRoot.ts
- Command line
-
hf download hf://spaces/evijit/pluralchat@refs/pr/1/src/lib/server/findRepoRoot.ts
-
curl -L -o findRepoRoot.ts https://huggingface.co/spaces/evijit/pluralchat/resolve/refs%2Fpr%2F1/src/lib/server/findRepoRoot.ts
392 Bytes
| import { existsSync } from "fs"; | |
| import { join, dirname } from "path"; | |
| export function findRepoRoot(startPath: string): string { | |
| let currentPath = startPath; | |
| while (currentPath !== "/") { | |
| if (existsSync(join(currentPath, "package.json"))) { | |
| return currentPath; | |
| } | |
| currentPath = dirname(currentPath); | |
| } | |
| throw new Error("Could not find repository root (no package.json found)"); | |
| } | |