grdp
v1.0.0
Published
Retrieve the root directory path of the project, regardless of monorepo.
Downloads
8
Readme
grdp (Get Root Dir Path)
Retrieve the root directory path of the project, regardless of monorepo.
Installation
npm install grdp
Usage
Default
import getRootDirPath from 'grdp'
const rootDirPath = getRootDirPath(); // => '/Users/username/Projects/project-name'
Monorepo
// repo1/some/path/file.js
import rootDirPath from 'grdp'
const monorepoRootDirPath = getRootDirPath(); // => '/Users/username/Projects/monorepo/repo1'
// repo2/some/path/file.js
import rootDirPath from 'grdp'
const monorepoRootDirPath = getRootDirPath(); // => '/Users/username/Projects/monorepo/repo2'