UNPKG

@naandalist/patch-package

Version:
16 lines (14 loc) 390 B
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 }