196abc3a42d4d758d1267332ad604f14e2d634a3cb4044e11324cf41ed998ebf500f6ebf00ca7341a8494036f7b5175e0a6c8cddb7e29b0ad272769fa7e95e 452 B

1234567891011121314151617
  1. 'use strict';
  2. const path = require('path');
  3. const findUp = require('find-up');
  4. const pkgDir = async cwd => {
  5. const filePath = await findUp('package.json', {cwd});
  6. return filePath && path.dirname(filePath);
  7. };
  8. module.exports = pkgDir;
  9. // TODO: Remove this for the next major release
  10. module.exports.default = pkgDir;
  11. module.exports.sync = cwd => {
  12. const filePath = findUp.sync('package.json', {cwd});
  13. return filePath && path.dirname(filePath);
  14. };