@ambiere/project-root
TypeScript icon, indicating that this package has built-in type declarations

0.1.3 • Public • Published

project-root

Tiny and zero dependencies utility, that finds the root of npm project.

Release

Install

npm install @ambiere/project-root

Usage

Example npm project structure:

/
└── root 
   ├── .git
   ├── package.json
   └── src
       ├── types
       └── index.js

Find the root of the project in index.js file:

import projectRootDir from "@ambiere/project-root"

const projectRoot = projectRootDir()
console.log(projectRoot) // → /root

API

projectRootDir(dir?)

Return the root directory of the npm project or undefined if none could be found.

dir:

Type: string

Default: process.cwd

The directory to start the search.

License

MIT license

Package Sidebar

Install

npm i @ambiere/project-root

Weekly Downloads

1

Version

0.1.3

License

MIT

Unpacked Size

4.04 kB

Total Files

5

Last publish

Collaborators

  • ambiere