Find the closest package.json file
$ npm install --save pkg-up
/
└── Users
    └── sindresorhus
        └── foo
            ├── package.json
            └── bar
                ├── baz
                └── example.js
// example.js
var pkgUp = require('pkg-up');
pkgUp().then(function (filepath) {
	console.log(filepath);
	//=> '/Users/sindresorhus/foo/package.json'
});
Returns a promise that resolves to a filepath or null.
Returns a filepath or null.
Type: string
Default: '.'
Directory to start from.
MIT © Sindre Sorhus