0.1.3 • Published 1 month ago

@ambiere/project-root v0.1.3

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month ago

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

0.1.3

1 month ago

0.1.2

1 month ago

0.1.1

1 month ago

0.1.0

1 month ago