@naandalist/patch-package
Version:
Fix broken node modules with no fuss
16 lines (14 loc) • 390 B
text/typescript
import { join, resolve } from "./path"
import process from "process"
import { existsSync } from "fs-extra"
export const getAppRootPath = (): string => {
let cwd = process.cwd()
while (!existsSync(join(cwd, "package.json"))) {
const up = resolve(cwd, "../")
if (up === cwd) {
throw new Error("no package.json found for this project")
}
cwd = up
}
return cwd
}