Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

current-pkg

egoist2MIT0.1.0

Load package.json from current work directory.

package.json, package

readme

current-pkg NPM version NPM downloads Build Status

Load package.json from current work directory.

Install

$ npm install --save current-pkg

Usage

const currentPkg = require('current-pkg')

currentPkg()
/*
{
    pkg: {name: 'packageName', version...}
}
*/

currentPkg(path.join(__dirname, '../another-package'))
/*
{
    pkg: {name: 'otherPackageName', version...}
}
*/

// not found
currentPkg()
/*
{
    error: new Error('Cannot find module ...')
}
*/

License

MIT © EGOIST