You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

10 lines
297 B

4 years ago
  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. };