index.js 297 B

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