Skip to content

Commit

Permalink
Merge pull request #1 from civicteam/feature/support_deep_merge
Browse files Browse the repository at this point in the history
Issue julianduque#3 Support deep merge
  • Loading branch information
dankelleher committed Oct 24, 2018
2 parents 3398620 + 12b4cc1 commit d25c6b6
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 12 deletions.
8 changes: 4 additions & 4 deletions lib/penv.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
*
*/
var async = require('utile').async,
utile = require('utile'),
eyes = require('eyes'),
path = require('path'),
fs = require('fs');
fs = require('fs'),
merge = require('lodash.merge');

//
// Penv Module + Defaults
Expand Down Expand Up @@ -48,7 +48,7 @@ penv.start = function (next) {
}

penv.config = function (opts) {
if (opts) { utile.mixin(penv, opts) }
if (opts) { merge(penv, opts) }
// add root path to file names
penv.pkgFile = path.join(penv.root, penv.pkgName);
penv.envFile = path.join(penv.root, penv.envName);
Expand Down Expand Up @@ -86,7 +86,7 @@ penv.getEnvironment = function (next) {
}

penv.writePackage = function (packages, next) {
var merged = utile.mixin({}, packages[0], packages[1]);
var merged = merge({}, packages[0], packages[1]);

// Add env variable
if (penv.env !== "base") {
Expand Down
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
}
],
"preferGlobal": true,
"repository" : {
"type" : "git",
"url" : "https://github.com/julianduque/penv"
"repository": {
"type": "git",
"url": "https://github.com/julianduque/penv"
},
"bin": "./bin/penv",
"main": "./bin/penv",
Expand All @@ -25,8 +25,9 @@
"test": "make test"
},
"dependencies": {
"utile": "~0.2.0",
"eyes": "~0.1.8"
"eyes": "~0.1.8",
"lodash.merge": "^4.6.1",
"utile": "~0.2.0"
},
"devDependencies": {
"mocha": "~1.9.0",
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/package-staging.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"node": ">=0.6"
},
"dependencies": {
"colors": "*",
"colors": "2",
"flatiron": "0.1.x",
"optimist": "0.2.x",
"union": "0.1.x",
Expand Down
10 changes: 8 additions & 2 deletions test/root/app/environments.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@
"domains": [
"myawesomedomain.com",
"www.myawesomedomain.com"
]
],
"dependencies": {
"colors": "1"
}
},
"staging": {
"subdomain": "staging-awesomeapp",
"domains": [
"staging.myawesomedomain.com",
"www.staging.myawesomedomain.com"
]
],
"dependencies": {
"colors": "2"
}
}
}

0 comments on commit d25c6b6

Please sign in to comment.