From be5786ef12e85a96e45d88f041e5ca262fb72d77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Oko=C5=84ski?= Date: Wed, 6 Sep 2017 22:58:09 +0200 Subject: [PATCH] Get default config options when not specified in user config (#2126) --- app/config/init.js | 5 +++++ app/package.json | 1 + app/yarn.lock | 2 ++ yarn.lock | 16 ++++++++++++++++ 4 files changed, 24 insertions(+) diff --git a/app/config/init.js b/app/config/init.js index 155357f0..8cc446f7 100644 --- a/app/config/init.js +++ b/app/config/init.js @@ -1,4 +1,5 @@ const vm = require('vm'); +const merge = require('lodash/merge'); const notify = require('../notify'); const _extract = function (script) { @@ -35,6 +36,10 @@ const _init = function (cfg) { notify('Error reading configuration: `config` key is missing'); return _extractDefault(cfg.defaultCfg); } + + // Use options from default config when not specified in user config #1588 + _cfg.config = merge(_extractDefault(cfg.defaultCfg).config, _cfg.config); + // Ignore undefined values in plugin and localPlugins array Issue #1862 _cfg.plugins = (_cfg.plugins && _cfg.plugins.filter(Boolean)) || []; _cfg.localPlugins = (_cfg.localPlugins && _cfg.localPlugins.filter(Boolean)) || []; diff --git a/app/package.json b/app/package.json index d06dd3a2..b76a9b91 100644 --- a/app/package.json +++ b/app/package.json @@ -19,6 +19,7 @@ "electron-config": "1.0.0", "electron-is-dev": "0.3.0", "electron-squirrel-startup": "1.0.0", + "lodash": "4.17.4", "file-uri-to-path": "1.0.0", "git-describe": "4.0.2", "mkdirp": "0.5.1", diff --git a/app/yarn.lock b/app/yarn.lock index 9d5b6a22..d4d333a4 100644 --- a/app/yarn.lock +++ b/app/yarn.lock @@ -668,6 +668,7 @@ kind-of@^4.0.0: dependencies: is-buffer "^1.1.5" + locate-path@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e" @@ -676,6 +677,7 @@ locate-path@^2.0.0: path-exists "^3.0.0" lodash@^4.16.6: + version "4.17.4" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" diff --git a/yarn.lock b/yarn.lock index 8f0b40b4..6e5cf725 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1049,6 +1049,7 @@ binary-extensions@^1.0.0: version "1.10.0" resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.10.0.tgz#9aeb9a6c5e88638aad171e167f5900abe24835d0" + bl@^1.0.0: version "1.2.1" resolved "https://registry.yarnpkg.com/bl/-/bl-1.2.1.tgz#cac328f7bee45730d404b692203fcb590e172d5e" @@ -1191,6 +1192,7 @@ buffer@^4.3.0: ieee754 "^1.1.4" isarray "^1.0.0" + builder-util@1.0.1, builder-util@^1.0.0, builder-util@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/builder-util/-/builder-util-1.0.1.tgz#e47e82be0ab3ae5ebff4bb361b91b94e49e27a8b" @@ -1463,6 +1465,7 @@ combined-stream@^1.0.5, combined-stream@~1.0.5: dependencies: delayed-stream "~1.0.0" + commander@^2.11.0: version "2.11.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.11.0.tgz#157152fd1e7a6c8d98a5b715cf376df928004563" @@ -3997,6 +4000,11 @@ node-pre-gyp@^0.6.36: tar "^2.2.1" tar-pack "^3.4.0" + +node-status-codes@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/node-status-codes/-/node-status-codes-1.0.0.tgz#5ae5541d024645d32a58fcddc9ceecea7ae3ac2f" + "nopt@2 || 3": version "3.0.6" resolved "https://registry.yarnpkg.com/nopt/-/nopt-3.0.6.tgz#c6465dbf08abcd4db359317f79ac68a646b28ff9" @@ -4761,6 +4769,10 @@ repeating@^2.0.0: dependencies: is-finite "^1.0.0" +req-all@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/req-all/-/req-all-0.1.0.tgz#130051e2ace58a02eacbfc9d448577a736a9273a" + request@2, request@^2.45.0, request@^2.81.0, request@~2.81.0: version "2.81.0" resolved "https://registry.yarnpkg.com/request/-/request-2.81.0.tgz#c6928946a0e06c5f8d6f8a9333469ffda46298a0" @@ -5399,6 +5411,10 @@ tough-cookie@~2.3.0: dependencies: punycode "^1.4.1" +traverse@^0.6.6: + version "0.6.6" + resolved "https://registry.yarnpkg.com/traverse/-/traverse-0.6.6.tgz#cbdf560fd7b9af632502fed40f918c157ea97137" + trim-newlines@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-1.0.0.tgz#5887966bb582a4503a41eb524f7d35011815a613"