0.0.3 • Published 10 months ago

root-dir-path v0.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

root-dir-path

Retrieve the root directory path of the project, regardless of monorepo.

Installation

npm install root-dir-path

Usage

Default

import rootDirPath from 'root-dir-path'

const rootDirPath = rootDirPath(); // => '/Users/username/Projects/project-name'

Monorepo

// repo1/some/path/file.js
import rootDirPath from 'root-dir-path'

const monorepoRootDirPath = rootDirPath(); // => '/Users/username/Projects/monorepo/repo1'
// repo2/some/path/file.js
import rootDirPath from 'root-dir-path'

const monorepoRootDirPath = rootDirPath(); // => '/Users/username/Projects/monorepo/repo2'