mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-13 04:28:41 -09:00
config: expose plugins
This commit is contained in:
parent
1993ca576f
commit
01f3b36c81
1 changed files with 13 additions and 4 deletions
17
config.js
17
config.js
|
|
@ -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
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue