diff --git a/packages/backend/src/lib/path.ts b/packages/backend/src/lib/path.ts new file mode 100644 index 0000000..5a48333 --- /dev/null +++ b/packages/backend/src/lib/path.ts @@ -0,0 +1,25 @@ +import { existsSync } from "node:fs"; +import { dirname, join } from "node:path"; + +export function findDir( + targetPath: string, + cwd: string, +): string { + let current = cwd; + + while (true) { + const candidate = join(current, targetPath); + + if (existsSync(candidate)) { + return candidate; + } + + const parent = dirname(current); + + if (parent === current) { + throw new Error(`Not found: ${targetPath}`); + } + + current = parent; + } +} \ No newline at end of file diff --git a/packages/frontend/index.html b/packages/frontend/index.html index c30424b..9e5738c 100755 --- a/packages/frontend/index.html +++ b/packages/frontend/index.html @@ -4,7 +4,7 @@ LynqChat - +