pkg.js 252 B

12345678910
  1. const fs = require('fs')
  2. const path = require('path')
  3. const readPkg = require('read-pkg')
  4. exports.resolvePkg = function (context) {
  5. if (fs.existsSync(path.join(context, 'package.json'))) {
  6. return readPkg.sync({ cwd: context })
  7. }
  8. return {}
  9. }