diff --git a/dapps/templates/simple/embark.json b/dapps/templates/simple/embark.json index 9c3ff7a287..b5bb76a6c9 100644 --- a/dapps/templates/simple/embark.json +++ b/dapps/templates/simple/embark.json @@ -13,10 +13,7 @@ "solc": "0.6.1" }, "plugins": { - "embark-geth": {}, - "embark-parity": {}, - "embark-profiler": {}, - "embark-graph": {} + "embark-geth": {} }, "options": { "solc": { diff --git a/dapps/templates/simple/package.json b/dapps/templates/simple/package.json index 1ecc2c87e5..2daf36ab29 100644 --- a/dapps/templates/simple/package.json +++ b/dapps/templates/simple/package.json @@ -29,14 +29,11 @@ }, "devDependencies": { "embark": "^5.3.0-nightly.0", - "embark-geth": "^5.3.0-nightly.0", - "embark-graph": "^5.3.0-nightly.0", - "embark-parity": "^5.3.0-nightly.0", - "embark-profiler": "^5.3.0-nightly.0", "embark-reset": "^5.2.3", "embarkjs": "^5.2.3", "embarkjs-ens": "^5.2.3", "embarkjs-web3": "^5.2.3", + "embark-geth": "^5.3.0-nightly.0", "rimraf": "3.0.0" } } diff --git a/packages/core/console/src/index.ts b/packages/core/console/src/index.ts index abd4aab34d..8519abbedf 100644 --- a/packages/core/console/src/index.ts +++ b/packages/core/console/src/index.ts @@ -2,7 +2,7 @@ import chalk from "chalk"; import { Embark, EmbarkEvents } from "embark-core"; import constants from "embark-core/constants.json"; import { __ } from "embark-i18n"; -import { dappPath, escapeHtml, exit, jsonFunctionReplacer } from "embark-utils"; +import { dappPath, escapeHtml, exit, jsonFunctionReplacer, warnIfPackageNotDefinedLocally } from "embark-utils"; import stringify from "json-stringify-safe"; import { dirname } from "path"; import util from "util"; @@ -169,6 +169,9 @@ export default class Console { return this.ipc.request("console:executeCmd", cmd, callback); } + if (cmd.indexOf("profile") === 0 && warnIfPackageNotDefinedLocally("embark-profiler", this.embark.logger.warn) !== true) { + return callback(null, "please install embark-profiler plugin"); + } if (!(cmd.split(" ")[0] === "history" || cmd === __("history"))) { this.saveHistory(cmd); } diff --git a/packages/core/engine/package.json b/packages/core/engine/package.json index 84dddbb136..2a030f132d 100644 --- a/packages/core/engine/package.json +++ b/packages/core/engine/package.json @@ -66,16 +66,13 @@ "embark-ethereum-blockchain-client": "^5.3.0-nightly.0", "embark-ganache": "^5.3.0-nightly.0", "embark-geth": "^5.3.0-nightly.0", - "embark-ipfs": "^5.3.0-nightly.0", "embark-library-manager": "^5.3.0-nightly.0", "embark-logger": "^5.3.0-nightly.0", "embark-mocha-tests": "^5.3.0-nightly.0", "embark-namesystem": "^5.3.0-nightly.0", - "embark-parity": "^5.3.0-nightly.0", "embark-pipeline": "^5.3.0-nightly.0", "embark-plugin-cmd": "^5.3.0-nightly.0", "embark-process-logs-api-manager": "^5.3.0-nightly.0", - "embark-profiler": "^5.3.0-nightly.0", "embark-proxy": "^5.3.0-nightly.0", "embark-rpc-manager": "^5.3.0-nightly.0", "embark-scaffolding": "^5.3.0-nightly.0", @@ -83,7 +80,6 @@ "embark-solidity-tests": "^5.3.0-nightly.0", "embark-specialconfigs": "^5.3.0-nightly.0", "embark-storage": "^5.3.0-nightly.0", - "embark-swarm": "^5.3.0-nightly.0", "embark-test-runner": "^5.3.0-nightly.0", "embark-transaction-logger": "^5.3.0-nightly.0", "embark-transaction-tracker": "^5.2.3", @@ -91,9 +87,7 @@ "embark-vyper": "^5.2.3", "embark-watcher": "^5.3.0-nightly.0", "embark-web3": "^5.3.0-nightly.0", - "embark-webserver": "^5.3.0-nightly.0", - "embark-whisper-geth": "^5.3.0-nightly.0", - "embark-whisper-parity": "^5.3.0-nightly.0" + "embark-webserver": "^5.3.0-nightly.0" }, "devDependencies": { "embark-solo": "^5.2.3", diff --git a/packages/core/engine/src/index.ts b/packages/core/engine/src/index.ts index a6aff29480..7b587af51f 100644 --- a/packages/core/engine/src/index.ts +++ b/packages/core/engine/src/index.ts @@ -152,7 +152,6 @@ export class Engine { const options = _options || {}; const groups = { - blockchain: this.blockchainComponents, coreComponents: this.coreComponents, stackComponents: this.stackComponents, serviceMonitor: this.serviceMonitor, @@ -162,8 +161,6 @@ export class Engine { contracts: this.contractsComponents, pipeline: this.pipelineService, webserver: this.webserverService, - storage: this.storageComponent, - communication: this.communicationComponents, namesystem: this.namesystemComponents, filewatcher: this.filewatcherService, tests: this.testComponents, @@ -263,13 +260,6 @@ export class Engine { this.registerModulePackage('embark-embarkjs', { plugins: this.plugins }); } - blockchainComponents() { - // plugins - this.registerModulePackage('embark-ganache'); - this.registerModulePackage('embark-geth'); - this.registerModulePackage('embark-parity'); - } - testComponents(options) { this.registerModulePackage('embark-test-runner', { plugins: this.plugins, ipc: this.ipc }); this.registerModulePackage('embark-coverage', { plugins: this.plugins, coverage: options.coverage }); @@ -291,17 +281,6 @@ export class Engine { this.registerModulePackage('embark-specialconfigs', { plugins: this.plugins }); this.registerModulePackage('embark-transaction-logger'); this.registerModulePackage('embark-transaction-tracker'); - this.registerModulePackage('embark-profiler'); - } - - storageComponent() { - this.registerModulePackage('embark-ipfs'); - this.registerModulePackage('embark-swarm'); - } - - communicationComponents() { - this.registerModulePackage('embark-whisper-geth'); - this.registerModulePackage('embark-whisper-parity'); } namesystemComponents() { diff --git a/packages/core/engine/tsconfig.json b/packages/core/engine/tsconfig.json index 1abf02dc45..c98b6c439c 100644 --- a/packages/core/engine/tsconfig.json +++ b/packages/core/engine/tsconfig.json @@ -34,21 +34,12 @@ { "path": "../../plugins/geth" }, - { - "path": "../../plugins/ipfs" - }, { "path": "../../plugins/mocha-tests" }, - { - "path": "../../plugins/parity" - }, { "path": "../../plugins/plugin-cmd" }, - { - "path": "../../plugins/profiler" - }, { "path": "../../plugins/rpc-manager" }, @@ -64,9 +55,6 @@ { "path": "../../plugins/specialconfigs" }, - { - "path": "../../plugins/swarm" - }, { "path": "../../plugins/transaction-logger" }, @@ -79,12 +67,6 @@ { "path": "../../plugins/web3" }, - { - "path": "../../plugins/whisper-geth" - }, - { - "path": "../../plugins/whisper-parity" - }, { "path": "../../stack/api" }, diff --git a/packages/embark/package.json b/packages/embark/package.json index 2381df1730..842960df8d 100644 --- a/packages/embark/package.json +++ b/packages/embark/package.json @@ -78,7 +78,6 @@ "embark-core": "^5.3.0-nightly.0", "embark-deploy-tracker": "^5.3.0-nightly.0", "embark-engine": "^5.3.0-nightly.0", - "embark-graph": "^5.3.0-nightly.0", "embark-i18n": "^5.2.3", "embark-logger": "^5.3.0-nightly.0", "embark-reset": "^5.2.3", diff --git a/packages/embark/src/cmd/cmd_controller.js b/packages/embark/src/cmd/cmd_controller.js index f315def325..cf5e19a54f 100644 --- a/packages/embark/src/cmd/cmd_controller.js +++ b/packages/embark/src/cmd/cmd_controller.js @@ -1,7 +1,7 @@ import { Config, Events, fs, TemplateGenerator } from 'embark-core'; import { Engine } from 'embark-engine'; import { __ } from 'embark-i18n'; -import { dappPath, joinPath, setUpEnv } from 'embark-utils'; +import { dappPath, joinPath, setUpEnv, warnIfPackageNotDefinedLocally } from 'embark-utils'; import { Logger, LogLevels } from 'embark-logger'; let async = require('async'); const constants = require('embark-core/constants'); @@ -63,7 +63,6 @@ class EmbarkController { engine.registerModuleGroup("coreComponents"); engine.registerModuleGroup("serviceMonitor"); engine.registerModuleGroup("blockchainStackComponents"); - engine.registerModuleGroup("blockchain"); // load custom plugins engine.loadDappPlugins(); @@ -167,14 +166,11 @@ class EmbarkController { // TODO: replace with individual plugins engine.registerModuleGroup("namesystem"); - engine.registerModuleGroup("communication"); - engine.registerModuleGroup("blockchain"); engine.registerModuleGroup("compiler"); engine.registerModuleGroup("contracts"); engine.registerModuleGroup("pipeline"); engine.registerModuleGroup("webserver"); engine.registerModuleGroup("filewatcher"); - engine.registerModuleGroup("storage"); engine.registerModuleGroup("cockpit"); engine.registerModulePackage('embark-deploy-tracker', { plugins: engine.plugins }); engine.registerModulePackage("embark-debugger"); @@ -293,11 +289,11 @@ class EmbarkController { engine.registerModuleGroup("contracts"); if (!options.onlyCompile) { - engine.registerModuleGroup("blockchain"); - engine.registerModuleGroup("namesystem"); - engine.registerModuleGroup("storage"); - engine.registerModuleGroup("communication"); + // engine.registerModuleGroup("blockchain"); + // engine.registerModuleGroup("storage"); + // engine.registerModuleGroup("communication"); engine.registerModuleGroup("pipeline"); + engine.registerModuleGroup("namesystem"); engine.registerModulePackage('embark-deploy-tracker', { plugins: engine.plugins }); } @@ -423,14 +419,11 @@ class EmbarkController { // TODO: replace with individual plugins engine.registerModuleGroup("namesystem"); - engine.registerModuleGroup("communication"); - engine.registerModuleGroup("blockchain"); engine.registerModuleGroup("compiler"); engine.registerModuleGroup("contracts"); engine.registerModuleGroup("pipeline"); engine.registerModuleGroup("webserver"); engine.registerModuleGroup("filewatcher"); - engine.registerModuleGroup("storage"); if (!isSecondaryProcess(engine)) { engine.registerModuleGroup("cockpit"); } @@ -528,7 +521,6 @@ class EmbarkController { engine.registerModuleGroup("compiler"); engine.registerModuleGroup("contracts"); - engine.registerModulePackage("embark-graph"); // load custom plugins engine.loadDappPlugins(); @@ -537,6 +529,10 @@ class EmbarkController { engine.logger.info(__("loaded plugins") + ": " + pluginList.join(", ")); } + if (warnIfPackageNotDefinedLocally("embark-graph", engine.logger.error) !== true) { + process.exit(1); + } + engine.startEngine(async () => { let contractsFiles = await engine.events.request2("config:contractsFiles"); let compiledContracts = await engine.events.request2("compiler:contracts:compile", contractsFiles); @@ -744,14 +740,11 @@ class EmbarkController { engine.registerModuleGroup("stackComponents"); engine.registerModuleGroup("namesystem"); - engine.registerModuleGroup("communication"); - engine.registerModuleGroup("blockchain"); engine.registerModuleGroup("compiler"); engine.registerModuleGroup("contracts"); engine.registerModuleGroup("pipeline"); engine.registerModuleGroup("webserver"); engine.registerModuleGroup("filewatcher"); - engine.registerModuleGroup("storage"); engine.registerModulePackage('embark-deploy-tracker', { plugins: engine.plugins }); // load custom plugins @@ -828,7 +821,6 @@ class EmbarkController { engine.registerModuleGroup("coreComponents"); engine.registerModuleGroup("stackComponents"); - engine.registerModuleGroup("blockchain"); engine.registerModuleGroup("compiler"); engine.registerModulePackage('embark-ganache'); engine.registerModulePackage('embark-ethereum-blockchain-client'); @@ -840,8 +832,6 @@ class EmbarkController { engine.registerModuleGroup("tests", options); engine.registerModulePackage('embark-deploy-tracker', { plugins: engine.plugins, trackContracts: false }); engine.registerModuleGroup("namesystem"); - engine.registerModuleGroup("storage"); - engine.registerModuleGroup("communication"); next(); }, function loadDappPlugins(next) { diff --git a/packages/embark/tsconfig.json b/packages/embark/tsconfig.json index 5cf9a0288d..1a462be991 100644 --- a/packages/embark/tsconfig.json +++ b/packages/embark/tsconfig.json @@ -36,9 +36,6 @@ { "path": "../plugins/deploy-tracker" }, - { - "path": "../plugins/graph" - }, { "path": "../plugins/solidity" }, diff --git a/packages/plugins/graph/package.json b/packages/plugins/graph/package.json index fce7309be7..304ec3aef4 100644 --- a/packages/plugins/graph/package.json +++ b/packages/plugins/graph/package.json @@ -47,6 +47,7 @@ "dependencies": { "@babel/runtime-corejs3": "7.7.4", "async": "2.6.1", + "embark-utils": "^5.1.0-nightly.1", "core-js": "3.4.3", "embark-utils": "^5.3.0-nightly.0", "viz.js": "1.8.2" diff --git a/packages/plugins/profiler/src/index.js b/packages/plugins/profiler/src/index.js index c04eabcee2..3946b54dcf 100644 --- a/packages/plugins/profiler/src/index.js +++ b/packages/plugins/profiler/src/index.js @@ -1,5 +1,3 @@ -import { warnIfPackageNotDefinedLocally } from 'embark-utils'; - const asciiTable = require('ascii-table'); import { GasEstimator, GAS_ERROR, EVENT_NO_GAS } from './gasEstimator'; @@ -12,7 +10,6 @@ class Profiler { this.registerConsoleCommand(); this.registerApi(); - warnIfPackageNotDefinedLocally("embark-profiler", this.embark.logger.warn.bind(this.embark.logger)); } profileJSON(contractName, returnCb) { diff --git a/site/source/docs/contracts_configuration.md b/site/source/docs/contracts_configuration.md index c5ad16eeeb..d16bf0abfa 100644 --- a/site/source/docs/contracts_configuration.md +++ b/site/source/docs/contracts_configuration.md @@ -490,8 +490,8 @@ We can specify a condition that decides whether a contract should be deployed by ... deploy: { ERC20: { - deployIf: async ({contracts, web3, logger}) => { - return await contracts.Manager.methods.isUpdateApproved().call(); + deployIf: async (dependencies) => { + return await dependencies.contracts.Manager.methods.isUpdateApproved().call(); }, deps: ['Manager'] }, @@ -534,8 +534,8 @@ We can specify the `onDeploy` hook to execute code, right after a contract has b deploy: { SimpleStorage: { args: [100], - onDeploy: async ({contracts, web3, logger}) => { - await contracts.SimpleStorage.methods.set(150).send({from: web3.eth.defaultAccount}); + onDeploy: async (dependencies) => { + await dependencies.contracts.SimpleStorage.methods.set(150).send({from: dependencies.web3.eth.defaultAccount}); } } } @@ -550,8 +550,8 @@ Also, as mentioned above, every deployment hook works with plain promises as wel ... SimpleStorage: { args: [100], - onDeploy: ({contracts, web3, logger}) => { - return contracts.SimpleStorage.methods.set(150).send(); + onDeploy: (dependencies) => { + return dependencies.contracts.SimpleStorage.methods.set(150).send(); } } ... @@ -568,8 +568,8 @@ deploy: { args: [100] }, }, -afterDeploy: ({contracts, web3, logger}) => { - contracts.SimpleStorage.methods.set(150).send({from: web3.eth.defaultAccount}); +afterDeploy: (dependencies) => { + dependencies.contracts.SimpleStorage.methods.set(150).send({from: dependencies.web3.eth.defaultAccount}); } ... ``` @@ -579,9 +579,9 @@ afterDeploy: ({contracts, web3, logger}) => { Since we use functions for these deployment hooks, we have to manage errors ourselves. We skipped that step in the above examples to save space, but here is an easy example on how you can do it: ``` -onDeploy: async ({contracts, web3, logger}) => { +onDeploy: async (dependencies) => { try { - await contracts.SimpleStorage.methods.set(85).send({from: web3.eth.defaultAccount}); + await dependencies.contracts.SimpleStorage.methods.set(85).send({from: dependencies.web3.eth.defaultAccount}); } catch (e) { console.error('Error during onDeploy', e); } @@ -616,8 +616,8 @@ The `logger` is injected as part of the `dependencies` object, so we can use it ``` deploy: { SimpleStorage: { - onDeploy: async ({contracts, web3, logger}) => { - logger.info('Hello from onDeploy!'); + onDeploy: async (dependencies) => { + dependencies.logger.info('Hello from onDeploy!'); } } }