in GatewayPluginExample/Ux/gulps/gulp-merge-json-in-folders/json-merge.js [33:59]
JsonMerge.prototype.mergeJsonInFolders = function (targetFolderPathRoot, sourceFoldersPathRoot) {
var _this = this;
var outputFiles = [];
var targetFilesContentMap = {};
var targetFiles = this.getFilePaths(targetFolderPathRoot);
targetFiles.forEach(function (targetFile) {
var relativePath = targetFile.substring(targetFolderPathRoot.length + 1, targetFile.length);
targetFilesContentMap[relativePath] = _this.readJSON(targetFile);
});
sourceFoldersPathRoot.forEach(function (sourceFolderPathRoot) {
var sourceFiles = _this.getFilePaths(sourceFolderPathRoot);
sourceFiles.forEach(function (sourceFile) {
var relativePath = sourceFile.substring(sourceFolderPathRoot.length + 1, sourceFile.length);
var sourceJson = _this.readJSON(sourceFile);
_this.mergeJsons(relativePath, sourceJson, targetFilesContentMap);
});
});
Object.keys(targetFilesContentMap).forEach(function (path) {
var jsonFile = new Vinyl({
cwd: './',
path: path,
contents: new Buffer(JSON.stringify(targetFilesContentMap[path]))
});
outputFiles.push(jsonFile);
});
return outputFiles;
};