refactor: init cypress-cucumber-preprocessor install.
This commit is contained in:
32
node_modules/cosmiconfig/dist/loadPackageProp.js
generated
vendored
Normal file
32
node_modules/cosmiconfig/dist/loadPackageProp.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
//
|
||||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
const readFile = require('./readFile');
|
||||
const parseJson = require('./parseJson');
|
||||
|
||||
module.exports = function loadPackageProp(
|
||||
packageDir ,
|
||||
options
|
||||
|
||||
|
||||
|
||||
) {
|
||||
const packagePath = path.join(packageDir, 'package.json');
|
||||
|
||||
function parseContent(content ) {
|
||||
if (!content) return null;
|
||||
const parsedContent = parseJson(content, packagePath);
|
||||
const packagePropValue = parsedContent[options.packageProp];
|
||||
if (!packagePropValue) return null;
|
||||
|
||||
return {
|
||||
config: packagePropValue,
|
||||
filepath: packagePath,
|
||||
};
|
||||
}
|
||||
|
||||
return !options.sync
|
||||
? readFile(packagePath).then(parseContent)
|
||||
: parseContent(readFile.sync(packagePath));
|
||||
};
|
Reference in New Issue
Block a user