4 const path = require('path');
5 const readFile = require('./readFile');
6 const parseJson = require('./parseJson');
8 module.exports = function loadPackageProp(
15 const packagePath = path.join(packageDir, 'package.json');
17 function parseContent(content ) {
18 if (!content) return null;
19 const parsedContent = parseJson(content, packagePath);
20 const packagePropValue = parsedContent[options.packageProp];
21 if (!packagePropValue) return null;
24 config: packagePropValue,
25 filepath: packagePath,
30 ? readFile(packagePath).then(parseContent)
31 : parseContent(readFile.sync(packagePath));