()
| 3 | import { existsSync } from "fs-extra" |
| 4 | |
| 5 | export const getAppRootPath = (): string => { |
| 6 | let cwd = process.cwd() |
| 7 | while (!existsSync(join(cwd, "package.json"))) { |
| 8 | const up = resolve(cwd, "../") |
| 9 | if (up === cwd) { |
| 10 | throw new Error("no package.json found for this project") |
| 11 | } |
| 12 | cwd = up |
| 13 | } |
| 14 | return cwd |
| 15 | } |