read-package
v1.0.2
Published
Reads package.json in the working directory
Downloads
74
Maintainers
Readme
read-package
Reads package.json in the working directory.
Install
$ yarn add read-package
Usage
.
├── foo
│ └── ...
└── bar
└── package.json
const readPackage = require('read-package')
readPackage('foo')
//=> package.json not found in the current project.
readPackage('bar')
//=> { "name": "fixture", "version": "1.0.0" }
API
readPackage([cwd])
Returns an object
or throws an error
.
cwd
Type: string
Default: process.cwd()
Current working directory.
Related
- has-package — Check if a project has package.json
License
MIT © Bu Kinoshita