Skip to content

devjiwonchoi/grdp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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'