config: expose plugins

This commit is contained in:
Guillermo Rauch 2016-07-07 13:49:10 -07:00
parent 1993ca576f
commit 01f3b36c81

View file

@ -38,10 +38,12 @@ function exec (str) {
if (!module.exports) { if (!module.exports) {
throw new Error('Error reading configuration: `module.exports` not set'); throw new Error('Error reading configuration: `module.exports` not set');
} }
const _cfg = module.exports.config; const _cfg = module.exports;
if (!_cfg) { if (!_cfg.config) {
throw new Error('Error reading configuration: `config` key is missing'); throw new Error('Error reading configuration: `config` key is missing');
} }
_cfg.plugins = _cfg.plugins || [];
_cfg.localPlugins = _cfg.localPlugins || [];
cfg = _cfg; cfg = _cfg;
return true; return true;
} }
@ -70,6 +72,13 @@ exports.init = function () {
watch(); watch();
}; };
exports.get = function () { exports.getConfig = function () {
return cfg; return cfg.config;
};
exports.getPlugins = function () {
return {
plugins: cfg.plugins,
localPlugins: cfg.localPlugins
};
}; };