Skip to content

Commit

Permalink
dedupe overridden jspm properties
Browse files Browse the repository at this point in the history
  • Loading branch information
guybedford committed Nov 18, 2014
1 parent 650400a commit 7ee062f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/config/package.js
Expand Up @@ -131,8 +131,6 @@ PackageJSON.prototype.read = function() {

PackageJSON.prototype.write = function() {
var pjson = this.jspmPrefix ? {} : this.originalPjson;
if (this.jspmPrefix)
this.originalPjson.jspm = pjson;

var defaults = this.defaults;

Expand Down Expand Up @@ -196,6 +194,15 @@ PackageJSON.prototype.write = function() {
if (!hasProperties(pjson.buildConfig))
delete pjson.buildConfig;

// dedupe jspm properties against base properties
if (this.jspmPrefix) {
for (var p in pjson) {
if (this.originalPjson[p] === pjson[p])
delete pjson[p];
}
this.originalPjson.jspm = pjson;
}

// NB check that the file hasn't changed since we opened it and if so, prompt
return asp(fs.writeFile)(this.fileName, JSON.stringify(this.originalPjson, null, 2) + '\n');
}
Expand Down

0 comments on commit 7ee062f

Please sign in to comment.