From 86917163467cce0b624e57e096802e7bbd1a82fc Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Wed, 15 Jan 2020 12:52:53 -0500 Subject: [PATCH] bugfix(@embark/embarkjs): tolerate a embarkjs plugin missing --- packages/stack/embarkjs/src/embarkjs-artifact.js.ejs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/stack/embarkjs/src/embarkjs-artifact.js.ejs b/packages/stack/embarkjs/src/embarkjs-artifact.js.ejs index e9c1e8708..3ff7bdab5 100644 --- a/packages/stack/embarkjs/src/embarkjs-artifact.js.ejs +++ b/packages/stack/embarkjs/src/embarkjs-artifact.js.ejs @@ -1,23 +1,35 @@ import EmbarkJS from 'embarkjs'; <% for (let pluginName in (plugins['messages'] || [])) { %> +try { const __embark<%- pluginName %> = require('<%- plugins['messages'][pluginName] %>'); EmbarkJS.Messages.registerProvider('<%- pluginName %>', __embark<%- pluginName %>.default || __embark<%- pluginName %>); +} catch (e) { +} <% } %> <% for (let pluginName in (plugins['storage'] || [])) { %> +try { const __embark<%- pluginName %> = require('<%- plugins['storage'][pluginName] %>'); EmbarkJS.Storage.registerProvider('<%- pluginName %>', __embark<%- pluginName %>.default || __embark<%- pluginName %>); +} catch (e) { +} <% } %> <% for (let pluginName in (plugins['blockchain'] || [])) { %> +try { const __embark<%- pluginName %> = require('<%- plugins['blockchain'][pluginName] %>'); EmbarkJS.Blockchain.registerProvider('<%- pluginName %>', __embark<%- pluginName %>.default || __embark<%- pluginName %>); +} catch (e) { +} <% } %> <% for (let pluginName in (plugins['names'] || [])) { %> +try { const __embark<%- pluginName %> = require('<%- plugins['names'][pluginName] %>'); EmbarkJS.Names.registerProvider('<%- pluginName %>', __embark<%- pluginName %>.default || __embark<%- pluginName %>); +} catch (e) { +} <% } %> <% if (plugins['messages'] && Object.values(plugins['messages']).length > 0) { %>