Michael Bradley, Jr d684b9af0f refactor(@embarkjs/web3): make web3 connector an internal plugin like the other embarkjs-* packages
Effectively deprecate the `embarkjs-connector-web3` package but don't introduce
a breaking change by simply not loading the plugin if it's specified in a
DApp's `embark.json`. If the deprecated plugin is specified, display a message
indicating the plugin was ignored and suggesting it be removed from the
project's `embark.json` and `package.json`.
2019-06-27 14:10:12 -05:00

47 lines
779 B
JavaScript

/* global module require */
const cloneDeep = require('lodash.clonedeep');
module.exports = (api) => {
const env = api.env();
const base = {};
const browser = cloneDeep(base);
Object.assign(browser, {
ignore: [
'src/embarkjs.js',
'src/node/index.js'
]
});
const node = cloneDeep(base);
Object.assign(node, {
ignore: [
'src/browser.js'
]
});
const nodeAsync = cloneDeep(base);
Object.assign(nodeAsync, {
ignore: [
'src/node/index.js'
]
});
const nodeTest = cloneDeep(base);
switch (env) {
case 'browser':
return browser;
case 'node':
return node;
case 'node:async':
return nodeAsync;
case 'node:test':
return nodeTest;
default:
return base;
}
};