Rename module to getModule

This commit is contained in:
Chi Vinh Le
2017-04-03 14:56:53 +07:00
parent 37230ce7fa
commit 96dcd5f74a
2 changed files with 9 additions and 9 deletions
+6 -6
View File
@@ -8,7 +8,7 @@ import plugins from 'pluginsConfig';
* Returns the config object of given plugin.
*/
function getConfig(plugin) {
return plugins.configs.filter(o => o.plugin === plugin)[0].module();
return plugins.configs.filter(o => o.plugin === plugin)[0].getModule();
}
/**
@@ -17,7 +17,7 @@ function getConfig(plugin) {
export function getSlotElements(slot, props = {}) {
return plugins.components
.map((o, i) => ({
component: o.module(),
component: o.getModule(),
props: {...getConfig(o.plugin), ...props, key: i},
}))
.filter(o => o.props.slot === slot)
@@ -26,20 +26,20 @@ export function getSlotElements(slot, props = {}) {
// Returns a map of redux actions.
export function getPluginActions() {
return merge(...plugins.actions.map(o => ({...o.module()})));
return merge(...plugins.actions.map(o => ({...o.getModule()})));
}
// Returns a map of redux reducers.
export function getPluginReducers() {
merge(...plugins.reducers.map(o => ({...o.module()})));
merge(...plugins.reducers.map(o => ({...o.getModule()})));
}
// Returns an array of graphQL queries and mutators.
export function getPluginQueriesAndMutators() {
return flatten(
merge(
plugins.queries.map(o => values(o.module())),
plugins.mutators.map(o => values(o.module())),
plugins.queries.map(o => values(o.getModule())),
plugins.mutators.map(o => values(o.getModule())),
)
);
}
@@ -4,8 +4,8 @@
*
* Outputs a module that looks like the following:
*
* module.exports.actions = [{plugin: string, module: callback}, ...]
* module.exports.reducer = [{plugin: string, module: callback}, ...]
* module.exports.actions = [{plugin: string, getModule: callback}, ...]
* module.exports.reducer = [{plugin: string, getModule: callback}, ...]
* [...]
*
*/
@@ -30,7 +30,7 @@ function moduleExists(loc) {
function addIfExists(list, plugin, resource) {
if (moduleExists(`../../../plugins/${plugin}/client/${resource}`)) {
list.push(`{module: () => require('plugins/${plugin}/client/${resource}'), plugin: '${plugin}'}`);
list.push(`{getModule: () => require('plugins/${plugin}/client/${resource}'), plugin: '${plugin}'}`);
}
}