UNPKG

@reliverse/rse

Version:

@reliverse/rse is your all-in-one companion for bootstrapping and improving any kind of projects (especially web apps built with frameworks like Next.js) — whether you're kicking off something new or upgrading an existing app. It is also a little AI-power

15 lines (14 loc) 506 B
import path from "@reliverse/pathkit"; import fs from "@reliverse/relifso"; export async function findTsconfigUp(fromPath) { let currentDir = fromPath; const rootPath = path.parse(currentDir).root; while (true) { const candidate = path.join(currentDir, "tsconfig.json"); if (await fs.pathExists(candidate)) return candidate; const parentDir = path.dirname(currentDir); if (parentDir === currentDir || currentDir === rootPath) break; currentDir = parentDir; } return void 0; }