address changes in code review

This commit is contained in:
Iuri Matias 2020-01-28 12:54:04 -05:00
parent 68fbb50816
commit 81f6204ae4
15 changed files with 44 additions and 24 deletions

View File

@ -18,6 +18,13 @@
"solc": "0.4.26"
},
"plugins": {
"embark-ipfs": {},
"embark-swarm": {},
"embark-whisper-geth": {},
"embark-geth": {},
"embark-parity": {},
"embark-profiler": {},
"embark-graph": {},
"embark-dapp-test-service": {}
},
"options": {

View File

@ -13,6 +13,13 @@
"embarkjs-swarm": "^5.1.0",
"embarkjs-web3": "^5.1.0",
"embarkjs-whisper": "^5.1.0",
"embark-ipfs": "^5.1.0",
"embark-swarm": "^5.1.0",
"embark-whisper-geth": "^5.1.0",
"embark-geth": "^5.1.0",
"embark-parity": "^5.1.0",
"embark-profiler": "^5.1.0",
"embark-graph": "^5.1.0",
"fs-extra": "8.1.0",
"haml": "0.4.3",
"jquery": "3.4.0",

View File

@ -15,5 +15,12 @@
"solc": "0.4.26"
},
"plugins": {
"embark-ipfs": {},
"embark-swarm": {},
"embark-whisper-geth": {},
"embark-geth": {},
"embark-parity": {},
"embark-profiler": {},
"embark-graph": {}
}
}

View File

@ -9,6 +9,13 @@
"embarkjs-swarm": "^5.1.0",
"embarkjs-web3": "^5.1.0",
"embarkjs-whisper": "^5.1.0",
"embark-ipfs": "^5.1.0",
"embark-swarm": "^5.1.0",
"embark-whisper-geth": "^5.1.0",
"embark-geth": "^5.1.0",
"embark-parity": "^5.1.0",
"embark-profiler": "^5.1.0",
"embark-graph": "^5.1.0",
"rimraf": "3.0.0"
},
"license": "MIT",

View File

@ -187,8 +187,7 @@ export class Config {
context: this.context,
env: this.env,
version: this.version,
client: this.client,
locale: this.locale
client: this.client
});
this.loadEmbarkConfigFile();

View File

@ -34,8 +34,6 @@ export class Plugins {
client: string;
locale: string;
static deprecated = {
'embarkjs-connector-web3': '4.1.0'
};
@ -52,7 +50,6 @@ export class Plugins {
this.env = options.env;
this.version = options.version;
this.client = options.client;
this.locale = options.locale;
}
loadPlugins() {
@ -93,8 +90,7 @@ export class Plugins {
fs: this.fs,
isInternal: true,
context: this.context,
client: this.client,
locale: this.locale
client: this.client
});
this.plugins.push(pluginWrapper);
return pluginWrapper;
@ -129,8 +125,7 @@ export class Plugins {
isInternal: true,
context: this.context,
env: this.env,
client: this.client,
locale: this.locale
client: this.client
});
const pluginInstance = pluginWrapper.loadInternalPlugin();
this.plugins.push(pluginWrapper);
@ -161,8 +156,7 @@ export class Plugins {
isInternal: false,
context: this.context,
version: this.version,
client: this.client,
locale: this.locale
client: this.client
});
pluginWrapper.loadPlugin();
this.plugins.push(pluginWrapper);

View File

@ -97,7 +97,6 @@ export class Engine {
locale: this.locale,
client: this.client,
// plugins: this.plugins,
ipc: this.ipc
});
this.config.loadConfigFiles({embarkConfig: this.embarkConfig, interceptLogs: this.interceptLogs});

View File

@ -308,18 +308,18 @@ export function isEs6Module(module) {
export function warnIfPackageNotDefinedLocally(packageName, warnFunc) {
const packageIsResolvable = findUp.sync("node_modules/" + packageName, {cwd: dappPath()});
if (!packageIsResolvable) {
return warnFunc("== WARNING: it seems " + packageName + " is not defined in your dapp package.json; In future versions of embark this package should be a local dependency and configured as a plugin");
return warnFunc("== WARNING: " + packageName + " could not be resolved. ensure that is defined in your dapp's package.json and npm or yarn install was done; In future versions of embark this package should be a local dependency and configured as a plugin");
}
const dappPackage = fs.readJSONSync(dappPath("package.json"));
const { dependencies, devDependencies } = dappPackage;
if (!((dependencies && dependencies[packageName]) || (devDependencies && devDependencies[packageName]))) {
return warnFunc("== WARNING: it seems " + packageName + " is not defined in your dapp package.json dependencies; In future versions of embark this package should be a local dependency and configured as a plugin");
return warnFunc("== WARNING: it seems " + packageName + " is not defined in your dapp's package.json dependencies; In future versions of embark this package should be a local dependency and configured as a plugin");
}
const embarkConfig = fs.readJSONSync(dappPath("embark.json"));
if (!embarkConfig.plugins[packageName]) {
return warnFunc("== WARNING: it seems " + packageName + " is not defined in your dapp embark.json plugins; In future versions of embark this package should be a local dependency and configured as a plugin");
return warnFunc("== WARNING: it seems " + packageName + " is not defined in your dapp's embark.json plugins; In future versions of embark this package should be a local dependency and configured as a plugin");
}
return true;

View File

@ -13,7 +13,7 @@ class Geth {
this.blockchainConfig = embark.config.blockchainConfig;
this.communicationConfig = embark.config.communicationConfig;
// TODO get options from config instead of options
this.locale = embark.locale;
this.locale = embark.config.locale;
this.logger = embark.logger;
this.client = embark.client;
this.events = embark.events;

View File

@ -9,7 +9,7 @@ class GraphGenerator {
this.events = embark.events;
this.events.setCommandHandler("graph:create", this.generate.bind(this));
warnIfPackageNotDefinedLocally("embark-graph", this.embark.logger.info.bind(this.embark.logger));
warnIfPackageNotDefinedLocally("embark-graph", this.embark.logger.warn.bind(this.embark.logger));
}
/*eslint complexity: ["error", 21]*/

View File

@ -12,7 +12,7 @@ class Parity {
this.embarkConfig = embark.config.embarkConfig;
this.blockchainConfig = embark.config.blockchainConfig;
// TODO get options from config instead of options
this.locale = embark.locale;
this.locale = embark.config.locale;
this.logger = embark.logger;
this.client = embark.client;
this.events = embark.events;

View File

@ -12,7 +12,7 @@ class Profiler {
this.registerConsoleCommand();
this.registerApi();
warnIfPackageNotDefinedLocally("embark-profiler", this.embark.logger.info.bind(this.embark.logger));
warnIfPackageNotDefinedLocally("embark-profiler", this.embark.logger.warn.bind(this.embark.logger));
}
profileJSON(contractName, returnCb) {

View File

@ -112,10 +112,10 @@ export default class Blockchain {
this.blockchainApi.registerRequests("ethereum");
if (this.blockchainConfig.enabled && this.blockchainConfig.client === "geth") {
warnIfPackageNotDefinedLocally("embark-geth", this.embark.logger.info.bind(this.embark.logger));
warnIfPackageNotDefinedLocally("embark-geth", this.embark.logger.warn.bind(this.embark.logger));
}
if (this.blockchainConfig.enabled && this.blockchainConfig.client === "parity") {
warnIfPackageNotDefinedLocally("embark-parity", this.embark.logger.info.bind(this.embark.logger));
warnIfPackageNotDefinedLocally("embark-parity", this.embark.logger.warn.bind(this.embark.logger));
}
}

View File

@ -32,7 +32,7 @@ class Communication {
});
if (this.communicationConfig.enabled && this.communicationConfig.available_providers.includes("whisper")) {
warnIfPackageNotDefinedLocally("embark-whisper-geth", this.embark.logger.info.bind(this.embark.logger));
warnIfPackageNotDefinedLocally("embark-whisper-geth", this.embark.logger.warn.bind(this.embark.logger));
}
}

View File

@ -44,10 +44,10 @@ class Storage {
});
if (this.storageConfig.enabled && this.storageConfig.available_providers.includes("ipfs")) {
warnIfPackageNotDefinedLocally("embark-ipfs", this.embark.logger.info.bind(this.embark.logger));
warnIfPackageNotDefinedLocally("embark-ipfs", this.embark.logger.warn.bind(this.embark.logger));
}
if (this.storageConfig.enabled && this.storageConfig.available_providers.includes("swarm")) {
warnIfPackageNotDefinedLocally("embark-swarm", this.embark.logger.info.bind(this.embark.logger));
warnIfPackageNotDefinedLocally("embark-swarm", this.embark.logger.warn.bind(this.embark.logger));
}
}