2 const path = require('path');
3 const findUp = require('find-up');
5 module.exports = cwd => findUp('package.json', {cwd}).then(fp => fp ? path.dirname(fp) : null);
7 module.exports.sync = cwd => {
8 const fp = findUp.sync('package.json', {cwd});
9 return fp ? path.dirname(fp) : null;