@reliverse/rse-sdk
Version:
@reliverse/rse-sdk allows you to create new plugins for @reliverse/rse CLI, interact with reliverse.org, and even extend your own CLI functionality (you may also try @reliverse/dler-sdk for this case).
15 lines (14 loc) • 506 B
JavaScript
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;
}