Package detail

root-pkg-dir

bconnorwhite43MIT1.0.0

Find the highest directory with a package.json, starting from from the current working directory.

root, pkg, dir, directory

readme

root-pkg-dir

NPM TypeScript


Find the highest directory with a package.json, starting from from the current working directory.


If I should maintain this repo, please ⭐️ GitHub stars

DM me on Twitter if you have questions or suggestions. Twitter


Installation

npm install root-pkg-dir
yarn add root-pkg-dir
pnpm add root-pkg-dir
bun add root-pkg-dir

Usage

import { rootPkgDir } from "root-pkg-dir";

// Returns an absolute path to the directory of the root package.json
const rootDir = await rootPkgDir(); // string | undefined

Options

type Options {
  /**
   * The directory to start searching from.
   * 
   * @default process.cwd()
   */
  readonly cwd?: URL | string;
};


Dependenciesdependencies

  • root-pkg-json: Find the highest package.json, starting from from the current working directory.


Dev Dependencies

  • autorepo: Autorepo abstracts away your dev dependencies, providing a single command to run all of your scripts.


License license

MIT

changelog

1.0.0 (2023-07-24)