1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Merge project package changes to avoid overwritten changes

This commit is contained in:
Nick O'Leary 2018-10-07 11:37:50 +01:00
parent 629536b562
commit 98c1bc276d
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -358,7 +358,15 @@ Project.prototype.update = function (user, data) {
promises.push(util.writeFile(this.paths['README.md'], this.description)); promises.push(util.writeFile(this.paths['README.md'], this.description));
} }
if (savePackage) { if (savePackage) {
promises.push(util.writeFile(this.paths['package.json'], JSON.stringify(this.package,"",4))); promises.push(fs.readFile(project.paths['package.json'],"utf8").then(content => {
var currentPackage = {};
try {
currentPackage = util.parseJSON(content);
} catch(err) {
}
this.package = Object.assign(currentPackage,this.package);
return util.writeFile(this.paths['package.json'], JSON.stringify(this.package,"",4));
}));
} }
return when.settle(promises).then(function(res) { return when.settle(promises).then(function(res) {
return { return {