root-directory

0.0.3 • Public • Published

root-directory

get the root directory by find the package.json

Install

$ npm install --save root-directory

Usage

└── workspace
    └── nodeWork
        ├── package.json
        └── index.js
        └── src
            ├── a.html
            └── b.js
// b.js
const getRootDir = require('root-directory');
 
(async () => {
    const rootDir = await getRootDir();
    console.log(rootDir);
})();

API

getRootDir([cwd])

Type: string
Default: process.cwd()

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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.3
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.3
    1
  • 0.0.2
    0
  • 0.0.1
    0

Package Sidebar

Install

npm i root-directory

Weekly Downloads

1

Version

0.0.3

License

MIT

Unpacked Size

5.1 kB

Total Files

6

Last publish

Collaborators

  • jw397