mirror of https://github.com/embarklabs/embark.git
feat: remove optional plugins from coming as default
feat(@embark/utils): add method to verify if a plugin is installed & configured
feature(@embark/utils): add method to verify if a plugin is installed & configured
feature: warn about packages that will be independent plugins and are not configured
chore: update templates to specify plugins
refactor: add to plugin api params so that blockchain plugins no longer need to be passed options
address changes in code review
remove unneded space
Update packages/core/utils/src/index.ts
Co-Authored-By: Jonathan Rainville <rainville.jonathan@gmail.com>
Update packages/core/utils/src/index.ts
Co-Authored-By: Michael Bradley <michaelsbradleyjr@gmail.com>
fix linting issue
add missing import
remove optional plugins from coming as default
Revert "chore: update hooks examples to destructure dependencies object"
This reverts commit 448eab724b
.
remove trailing comma
fix linting issue
include tsconfig
This commit is contained in:
parent
1675019f44
commit
db10064dd6
|
@ -13,10 +13,7 @@
|
|||
"solc": "0.6.1"
|
||||
},
|
||||
"plugins": {
|
||||
"embark-geth": {},
|
||||
"embark-parity": {},
|
||||
"embark-profiler": {},
|
||||
"embark-graph": {}
|
||||
"embark-geth": {}
|
||||
},
|
||||
"options": {
|
||||
"solc": {
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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"
|
||||
},
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -36,9 +36,6 @@
|
|||
{
|
||||
"path": "../plugins/deploy-tracker"
|
||||
},
|
||||
{
|
||||
"path": "../plugins/graph"
|
||||
},
|
||||
{
|
||||
"path": "../plugins/solidity"
|
||||
},
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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!');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue