find-main

2.0.3 • Public • Published

find-main Build Status Greenkeeper badge

Find the "main" path from package.json

Install

$ npm install --save find-main

Usage

var findMain = require('find-main');
 
findMain(cwd);
//=> ./path/to/main

API

findMain([cwd]) -> String / Boolean

findMain starts at cwd and looks upwards until it finds a package.json. When it finds one, it returns the "main" entry as an absolute path.

If no package is found, an exception is thrown. If a package is found but no "main" entry is available, false is returned. Otherwise, the absolute main path is returned.

cwd

Type: string
Default: process.cwd()

License

MIT © Ben Drucker

Readme

Keywords

Package Sidebar

Install

npm i find-main

Weekly Downloads

1

Version

2.0.3

License

MIT

Unpacked Size

3.34 kB

Total Files

4

Last publish

Collaborators

  • bendrucker