DEPRECATED: please use package.root
Enables to find the first package in the path hierarchy.
It checks recursively for a package.json
beginning in the first directory of its path.
Bower information are completed with the directory
property normaly stored in the .bowerrc
file.
Take a look to the TODO if you want to help towards the next steps.
Execute following line
npm install package.root.finder@0.1.x --save
var root = require('package.root.finder');
Returns an Object with following properties:
name
: the name of the parent moduledirectory
: the directory of the parent modulepackage
: the parent module's package.json contentbower
: the parent module's bower.json content or false if no bower is used. Also holds thedirectory
property.path
: absolut path to the parent module directory
Access the values with the point notation:
var root = require('package.root.finder');
// get parent module's name
root.name
// or
root.package.name
// get root path
root.path
// get bower directory
root.bower.directory
Methods:
require
: the same as node's native require method, but loads the wanted package from the root package dependencies. Awaits a String as argument: 'mypackage' or '../root/folder/somefile', '../package.json'