npm

Need private packages and team management tools?Check out npm Orgs. »

top-pkg-dir

0.0.3 • Public • Published

top-pkg-dir

Find top most root directory of a Node.js project or npm package.

Example

└─ Development
   └─ Projects
      └─ project-a
         ├─ package.json
         ├─ lib
         └─ node_modules
            ├─ project-b
            └─ lib
               └─ example.js

example.js

import topPkgDir from "top-pkg-dir";
 
async function() {
  const topProjectDir = await topPkgDir(); // '/Development/Projects/project-a'
}

API

topPkgDir(cwd?)

Returns a Promise for either the top most project root path or undefined if it couldn't be found.

topPkgDir.sync(cwd?)

Returns the top most project root path or undefined if it couldn't be found.

cwd

Type: string
Default: process.cwd()

Directory to start from.

install

npm i top-pkg-dir

Downloadsweekly downloads

11

version

0.0.3

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability