I want to merge two bower.json files. One is local to my project and the other one is shared between different projects. I need to merge these two files before running bower install.
Please check the example for my requirements:
Local bower.json
{
"name": "myLocalProject",
"version": "0.0.1",
"devDependencies": {
"angular": "1.1.0"
},
"dependencies": {
"components-font-awesome": "*"
},
"resolutions": {
"angular": "1.3.15"
}
}
and shared bower.json
{
"name": "sharedBowerFile",
"version": "0.0.3",
"devDependencies": {
"angular": "1.3.15",
"angular-resource": "1.3.15"
},
"dependencies": {
},
"resolutions": {
"angular": "1.3.15"
}
}
and the result bower.json which will replace local bower.json
{
"name": "myLocalProject", // unchanged
"version": "0.0.1", // unchanged
"devDependencies": {
"angular": "1.3.15", //version updated
"angular-resource": "1.3.15" // added to local
},
"dependencies": {
"components-font-awesome": "*" //stays the same in local
},
"resolutions": {
"angular": "1.3.15"
}
}
I will create a Grunt task for the merge, so I would need the merge in JavaScript.