From 908064f4e1d8015c4718a5b47877e5bf09a9d983 Mon Sep 17 00:00:00 2001 From: Eric Mastro Date: Mon, 14 Oct 2019 16:28:54 +0900 Subject: [PATCH] refactor(@embark/ganache): move module into own package (#1952) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **NOTE:** Running a dapp with `client: “vm”` does not work, however I am not sure if that is intentional in v5 or not. **NOTE:** Running `embark test` in the demo DApp does work, although there is an error that I am assuming does actually pertain to this PR: ``` made request without listener: whisper:node:register Trace: at EmbarkEmitter.trace [as request] (/Users/emizzle/Code/__Github/embk-fw/embark/packages/embark/src/lib/core/events.js:142:13) at new request (/Users/emizzle/Code/__Github/embk-fw/embark/packages/embark/src/lib/modules/geth/index.js:49:17) at Plugin.loadInternalPlugin (/Users/emizzle/Code/__Github/embk-fw/embark/packages/embark/src/lib/core/plugin.js:117:10) at Plugins.loadInternalPlugin (/Users/emizzle/Code/__Github/embk-fw/embark/packages/embark/src/lib/core/plugins.js:96:40) at Engine.loadInternalPlugin [as registerModule] (/Users/emizzle/Code/__Github/embk-fw/embark/packages/embark/src/lib/core/engine.js:69:18) at Engine.registerModule [as blockchainComponents] (/Users/emizzle/Code/__Github/embk-fw/embark/packages/embark/src/lib/core/engine.js:183:10) at Engine.apply [as registerModuleGroup] (/Users/emizzle/Code/__Github/embk-fw/embark/packages/embark/src/lib/core/engine.js:104:18) at registerModuleGroup (/Users/emizzle/Code/__Github/embk-fw/embark/packages/embark/src/cmd/cmd_controller.js:740:16) at nextTask (/Users/emizzle/Code/__Github/embk-fw/embark/node_modules/async/dist/async.js:5324:14) at next (/Users/emizzle/Code/__Github/embk-fw/embark/node_modules/async/dist/async.js:5331:9) at /Users/emizzle/Code/__Github/embk-fw/embark/node_modules/async/dist/async.js:969:16 at callback (/Users/emizzle/Code/__Github/embk-fw/embark/packages/embark/src/lib/core/engine.js:47:9) at Client.done (/Users/emizzle/Code/__Github/embk-fw/embark/packages/core/core/src/ipc.js:46:11) at Client.emit (/Users/emizzle/Code/__Github/embk-fw/embark/node_modules/event-pubsub/es5.js:74:21) at Socket.connectionClosed (/Users/emizzle/Code/__Github/embk-fw/embark/node_modules/node-ipc/dao/client.js:201:20) at Socket.emit (events.js:198:13) ``` --- packages/embark/package.json | 2 +- packages/embark/src/lib/core/engine.js | 2 +- packages/plugins/ganache/.npmrc | 4 ++ packages/plugins/ganache/README.md | 6 ++ packages/plugins/ganache/package.json | 64 +++++++++++++++++++ .../ganache => plugins/ganache/src}/index.js | 0 6 files changed, 76 insertions(+), 2 deletions(-) create mode 100644 packages/plugins/ganache/.npmrc create mode 100644 packages/plugins/ganache/README.md create mode 100644 packages/plugins/ganache/package.json rename packages/{embark/src/lib/modules/ganache => plugins/ganache/src}/index.js (100%) diff --git a/packages/embark/package.json b/packages/embark/package.json index f6a83c6d2..76c060a08 100644 --- a/packages/embark/package.json +++ b/packages/embark/package.json @@ -107,6 +107,7 @@ "embark-embarkjs": "^4.1.1", "embark-ens": "^4.1.1", "embark-geth": "^4.1.1", + "embark-ganache": "^4.1.1", "embark-graph": "^4.1.1", "embark-i18n": "^4.1.1", "embark-ipfs": "^4.1.1", @@ -148,7 +149,6 @@ "find-up": "2.1.0", "flatted": "0.2.3", "fs-extra": "8.1.0", - "ganache-cli": "6.4.3", "glob": "7.1.4", "globule": "1.2.1", "hard-source-webpack-plugin": "0.13.1", diff --git a/packages/embark/src/lib/core/engine.js b/packages/embark/src/lib/core/engine.js index 21430f58a..79c051ea5 100644 --- a/packages/embark/src/lib/core/engine.js +++ b/packages/embark/src/lib/core/engine.js @@ -215,7 +215,7 @@ class Engine { contractsComponents(_options) { this.registerModule('ethereum-blockchain-client'); - this.registerModule('ganache'); + this.registerModulePackage('embark-ganache'); this.registerModulePackage('embark-web3'); this.registerModulePackage('embark-accounts-manager'); this.registerModulePackage('embark-specialconfigs', {plugins: this.plugins}); diff --git a/packages/plugins/ganache/.npmrc b/packages/plugins/ganache/.npmrc new file mode 100644 index 000000000..e031d3432 --- /dev/null +++ b/packages/plugins/ganache/.npmrc @@ -0,0 +1,4 @@ +engine-strict = true +package-lock = false +save-exact = true +scripts-prepend-node-path = true diff --git a/packages/plugins/ganache/README.md b/packages/plugins/ganache/README.md new file mode 100644 index 000000000..70956fa88 --- /dev/null +++ b/packages/plugins/ganache/README.md @@ -0,0 +1,6 @@ +# `embark-ganache` + +> Implementation of the Ganache simulator for Embark + +Visit [embark.status.im](https://embark.status.im/) to get started with +[Embark](https://github.com/embark-framework/embark). diff --git a/packages/plugins/ganache/package.json b/packages/plugins/ganache/package.json new file mode 100644 index 000000000..ddb30b591 --- /dev/null +++ b/packages/plugins/ganache/package.json @@ -0,0 +1,64 @@ +{ + "name": "embark-ganache", + "version": "4.1.1", + "author": "Iuri Matias ", + "contributors": [], + "description": "Implementation of the Ganache simulator for Embark", + "homepage": "https://github.com/embark-framework/embark/tree/master/packages/plugins/ganache#readme", + "bugs": "https://github.com/embark-framework/embark/issues", + "keywords": [ + "blockchain", + "dapps", + "ethereum", + "ipfs", + "serverless", + "solc", + "solidity" + ], + "files": [ + "dist" + ], + "license": "MIT", + "repository": { + "directory": "packages/plugins/ganache", + "type": "git", + "url": "https://github.com/embark-framework/embark.git" + }, + "main": "./dist/index.js", + "embark-collective": { + "build:node": true + }, + "scripts": { + "_build": "npm run solo -- build", + "ci": "npm run qa", + "clean": "npm run reset", + "lint": "npm-run-all lint:*", + "lint:ts": "tslint -c tslint.json \"src/**/*.ts\"", + "qa": "npm-run-all lint typecheck _build", + "reset": "npx rimraf dist embark-*.tgz package", + "solo": "embark-solo", + "typecheck": "tsc", + "watch": "run-p watch:*", + "watch:typecheck": "npm run typecheck -- --preserveWatchOutput --watch" + }, + "eslintConfig": { + "extends": "../../../.eslintrc.json" + }, + "dependencies": { + "@babel/runtime-corejs2": "7.6.2", + "ganache-cli": "6.4.3" + }, + "devDependencies": { + "embark-solo": "^4.1.1", + "eslint": "5.7.0", + "npm-run-all": "4.1.5", + "rimraf": "3.0.0", + "tslint": "5.16.0", + "typescript": "3.6.3" + }, + "engines": { + "node": ">=8.12.0 <12.0.0", + "npm": ">=6.4.1", + "yarn": ">=1.12.3" + } +} diff --git a/packages/embark/src/lib/modules/ganache/index.js b/packages/plugins/ganache/src/index.js similarity index 100% rename from packages/embark/src/lib/modules/ganache/index.js rename to packages/plugins/ganache/src/index.js