Skip to content

ambiere/project-root

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Zero dependencies utility, that helps you find the root of your project.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published