From 01f3b36c8142265307b3c3bf56ced5bde984a31a Mon Sep 17 00:00:00 2001 From: Guillermo Rauch Date: Thu, 7 Jul 2016 13:49:10 -0700 Subject: [PATCH] config: expose plugins --- config.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/config.js b/config.js index 9edd2d56..caf15022 100644 --- a/config.js +++ b/config.js @@ -38,10 +38,12 @@ function exec (str) { if (!module.exports) { throw new Error('Error reading configuration: `module.exports` not set'); } - const _cfg = module.exports.config; - if (!_cfg) { + const _cfg = module.exports; + if (!_cfg.config) { throw new Error('Error reading configuration: `config` key is missing'); } + _cfg.plugins = _cfg.plugins || []; + _cfg.localPlugins = _cfg.localPlugins || []; cfg = _cfg; return true; } @@ -70,6 +72,13 @@ exports.init = function () { watch(); }; -exports.get = function () { - return cfg; +exports.getConfig = function () { + return cfg.config; +}; + +exports.getPlugins = function () { + return { + plugins: cfg.plugins, + localPlugins: cfg.localPlugins + }; };