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.

index.js 491B

12345678910111213141516171819202122232425262728293031
  1. 'use strict';
  2. var findUp = require('find-up');
  3. var readPkg = require('read-pkg');
  4. module.exports = function (opts) {
  5. return findUp('package.json', opts).then(function (fp) {
  6. if (!fp) {
  7. return {};
  8. }
  9. return readPkg(fp, opts).then(function (pkg) {
  10. return {
  11. pkg: pkg,
  12. path: fp
  13. };
  14. });
  15. });
  16. };
  17. module.exports.sync = function (opts) {
  18. var fp = findUp.sync('package.json', opts);
  19. if (!fp) {
  20. return {};
  21. }
  22. return {
  23. pkg: readPkg.sync(fp, opts),
  24. path: fp
  25. };
  26. };