選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 

18 行
452 B

  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. };