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.
31 lines
620 B
31 lines
620 B
2 years ago
|
'use strict';
|
||
|
|
||
|
var copyProps = require('copy-props');
|
||
|
var path = require('path');
|
||
|
|
||
|
function loadConfigFiles(configFiles, configFileOrder) {
|
||
|
var config = {};
|
||
|
|
||
|
configFileOrder.forEach(loadFile);
|
||
|
|
||
|
function loadFile(key) {
|
||
|
var filePath = configFiles[key];
|
||
|
if (!filePath) {
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
copyProps(require(filePath), config, convert);
|
||
|
|
||
|
function convert(loadedInfo) {
|
||
|
if (loadedInfo.keyChain === 'flags.gulpfile') {
|
||
|
return path.resolve(path.dirname(filePath), loadedInfo.value);
|
||
|
}
|
||
|
return loadedInfo.value;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return config;
|
||
|
}
|
||
|
|
||
|
module.exports = loadConfigFiles;
|