UNPKG

bob-the-bundler

Version:
14 lines (13 loc) 464 B
import fse from 'fs-extra'; import { globby } from 'globby'; export async function getRootPackageJSON(cwd = process.cwd()) { const [rootPackageJSONPath] = await globby('package.json', { cwd, absolute: true, }); if (rootPackageJSONPath === undefined) { throw new Error('Must be executed within a (monorepo-)package root.'); } const rootPackageJSON = await fse.readJSON(rootPackageJSONPath); return rootPackageJSON; }