From ad8c6cc140ec960be6319ce4f6e9f34c1373bd98 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Thu, 6 Apr 2017 18:26:24 -0300 Subject: [PATCH] Refator plugin loaders --- client/coral-framework/loaders/plugins-loader.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/client/coral-framework/loaders/plugins-loader.js b/client/coral-framework/loaders/plugins-loader.js index 83bdae33b..b3aa0b2b9 100644 --- a/client/coral-framework/loaders/plugins-loader.js +++ b/client/coral-framework/loaders/plugins-loader.js @@ -7,10 +7,10 @@ * module.exports = [{plugin: string, module: object}, ...] * */ -const {stripIndent} = require('common-tags'); +const { stripIndent } = require("common-tags"); function getPluginList(config) { - return config.client.map(x => typeof x === 'string' ? x : Object.keys(x)[0]); + return config.client.map(x => typeof x === "string" ? x : Object.keys(x)[0]); } module.exports = function(source) { @@ -18,14 +18,15 @@ module.exports = function(source) { const config = this.exec(source, this.resourcePath); const plugins = getPluginList(config); - const list = []; - plugins.forEach(plugin => { - list.push(`{module: require('plugins/${plugin}/client/index.js'), plugin: '${plugin}'}`); + plugins.map(plugin => { + list.push( + `{module: require('plugins/${plugin}/client/index.js'), plugin: '${plugin}'}` + ); }); return stripIndent` module.exports = [ - ${list.join(',')} + ${plugins.join(",")} ]; `; };