mirror of https://github.com/embarklabs/embark.git
refactor(@embark/embark-whisper): move whisper module to its own package
refactor(@embark/embark-whisper): move whisper module to its own package add eslint to dependencies register whisper module
This commit is contained in:
parent
9b493ae7e3
commit
a46ea71dbd
|
@ -11,6 +11,7 @@
|
|||
"babel-plugin-dynamic-import-node": "2.2.0",
|
||||
"babel-plugin-macros": "2.4.5",
|
||||
"chalk": "2.4.2",
|
||||
"eslint-plugin-react": "7.12.4",
|
||||
"lerna": "3.13.1",
|
||||
"lodash.clonedeep": "4.5.0",
|
||||
"minimist": "1.2.0",
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
# `embark-whisper`
|
||||
|
||||
Module to add Whisper support to Embark
|
||||
|
||||
Visit [embark.status.im](https://embark.status.im/) to get started with
|
||||
[Embark](https://github.com/embark-framework/embark).
|
|
@ -0,0 +1,69 @@
|
|||
{
|
||||
"name": "embark-whisper",
|
||||
"version": "4.0.0",
|
||||
"author": "Iuri Matias <iuri.matias@gmail.com>",
|
||||
"contributors": [],
|
||||
"description": "Module to add Whisper support to Embark",
|
||||
"homepage": "https://github.com/embark-framework/embark/tree/master/packages/embark-whisper#readme",
|
||||
"bugs": "https://github.com/embark-framework/embark/issues",
|
||||
"keywords": [
|
||||
"blockchain",
|
||||
"dapps",
|
||||
"ethereum",
|
||||
"ipfs",
|
||||
"serverless",
|
||||
"solc",
|
||||
"solidity"
|
||||
],
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"directory": "packages/embark-whisper",
|
||||
"type": "git",
|
||||
"url": "https://github.com/embark-framework/embark.git"
|
||||
},
|
||||
"main": "./dist/index.js",
|
||||
"scripts": {
|
||||
"build": "cross-env BABEL_ENV=node babel src --extensions \".js,.ts\" --out-dir dist --root-mode upward --source-maps",
|
||||
"ci": "npm run qa",
|
||||
"clean": "npm run reset",
|
||||
"lint": "npm-run-all lint:*",
|
||||
"lint:js": "eslint src/",
|
||||
"// lint:ts": "tslint -c tslint.json \"src/**/*.ts\"",
|
||||
"package": "npm pack",
|
||||
"// qa": "npm-run-all lint typecheck build package",
|
||||
"qa": "npm-run-all lint build package",
|
||||
"reset": "npx rimraf dist embark-*.tgz package",
|
||||
"start": "npm run watch",
|
||||
"// typecheck": "tsc",
|
||||
"watch": "run-p watch:*",
|
||||
"watch:build": "npm run build -- --verbose --watch",
|
||||
"// watch:typecheck": "npm run typecheck -- --preserveWatchOutput --watch"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": "../../.eslintrc.json"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime-corejs2": "7.3.1",
|
||||
"async": "2.6.1",
|
||||
"embark-utils": "^4.0.0",
|
||||
"rxjs": "6.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "7.2.3",
|
||||
"@babel/core": "7.2.2",
|
||||
"cross-env": "5.2.0",
|
||||
"eslint": "5.7.0",
|
||||
"npm-run-all": "4.1.5",
|
||||
"rimraf": "2.6.3",
|
||||
"tslint": "5.11.0",
|
||||
"typescript": "3.3.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8.12.0",
|
||||
"npm": ">=6.4.1",
|
||||
"yarn": ">=1.12.3"
|
||||
}
|
||||
}
|
|
@ -4,10 +4,11 @@ import {joinPath, canonicalHost, defaultHost} from 'embark-utils';
|
|||
let Web3 = require('web3');
|
||||
const {parallel} = require('async');
|
||||
const {sendMessage, listenTo} = require('./js/communicationFunctions');
|
||||
const constants = require('../../constants');
|
||||
const {fromEvent} = require('rxjs');
|
||||
const {map, takeUntil} = require('rxjs/operators');
|
||||
|
||||
const EMBARK_RESOURCE_ORIGIN = "http://embark";
|
||||
|
||||
class Whisper {
|
||||
constructor(embark, options) {
|
||||
this.logger = embark.logger;
|
||||
|
@ -60,7 +61,7 @@ class Whisper {
|
|||
// Moreover, Parity reject origins that are not urls so if you try to connect with Origin: "embark" it gives the followin error:
|
||||
// << Blocked connection to WebSockets server from untrusted origin: Some("embark") >>
|
||||
// The best choice is to use void origin, BUT Geth rejects void origin, so to keep both clients happy we can use http://embark
|
||||
this.web3.setProvider(new Web3.providers.WebsocketProvider(web3Endpoint, {headers: {Origin: constants.embarkResourceOrigin}}));
|
||||
this.web3.setProvider(new Web3.providers.WebsocketProvider(web3Endpoint, {headers: {Origin: EMBARK_RESOURCE_ORIGIN}}));
|
||||
}
|
||||
|
||||
waitForWeb3Ready(cb) {
|
||||
|
@ -148,7 +149,7 @@ class Whisper {
|
|||
const code = `\nEmbarkJS.Messages.setProvider('whisper', ${JSON.stringify(config)});`;
|
||||
this.embark.addProviderInit('communication', code, shouldInit);
|
||||
|
||||
const consoleConfig = Object.assign({}, config, {providerOptions: {headers: {Origin: constants.embarkResourceOrigin}}});
|
||||
const consoleConfig = Object.assign({}, config, {providerOptions: {headers: {Origin: EMBARK_RESOURCE_ORIGIN}}});
|
||||
const consoleCode = `\nEmbarkJS.Messages.setProvider('whisper', ${JSON.stringify(consoleConfig)});`;
|
||||
this.embark.addConsoleProviderInit('communication', consoleCode, shouldInit);
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"include": ["src/**/*"]
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"extends": "../../tslint.json"
|
||||
}
|
|
@ -87,6 +87,7 @@
|
|||
"deep-equal": "1.0.1",
|
||||
"ejs": "2.6.1",
|
||||
"embark-compiler": "^4.0.0",
|
||||
"embark-whisper": "^4.0.0",
|
||||
"embark-reset": "^4.0.0",
|
||||
"embark-ui": "^4.0.0",
|
||||
"embark-vyper": "^4.0.0",
|
||||
|
@ -143,7 +144,6 @@
|
|||
"remix-debug-debugtest": "0.2.16",
|
||||
"remix-tests": "0.1.1",
|
||||
"request": "2.88.0",
|
||||
"rxjs": "6.4.0",
|
||||
"sass-loader": "7.1.0",
|
||||
"semver": "5.6.0",
|
||||
"serve-static": "1.13.2",
|
||||
|
|
|
@ -312,7 +312,7 @@ class Engine {
|
|||
wait: options.wait
|
||||
});
|
||||
|
||||
this.registerModule('whisper', options);
|
||||
this.registerModulePackage('embark-whisper');
|
||||
}
|
||||
|
||||
libraryManagerService(_options) {
|
||||
|
|
25
yarn.lock
25
yarn.lock
|
@ -7817,6 +7817,19 @@ eslint-plugin-react@7.11.1:
|
|||
jsx-ast-utils "^2.0.1"
|
||||
prop-types "^15.6.2"
|
||||
|
||||
eslint-plugin-react@7.12.4:
|
||||
version "7.12.4"
|
||||
resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.12.4.tgz#b1ecf26479d61aee650da612e425c53a99f48c8c"
|
||||
integrity sha512-1puHJkXJY+oS1t467MjbqjvX53uQ05HXwjqDgdbGBqf5j9eeydI54G3KwiJmWciQ0HTBacIKw2jgwSBSH3yfgQ==
|
||||
dependencies:
|
||||
array-includes "^3.0.3"
|
||||
doctrine "^2.1.0"
|
||||
has "^1.0.3"
|
||||
jsx-ast-utils "^2.0.1"
|
||||
object.fromentries "^2.0.0"
|
||||
prop-types "^15.6.2"
|
||||
resolve "^1.9.0"
|
||||
|
||||
eslint-scope@3.7.1:
|
||||
version "3.7.1"
|
||||
resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-3.7.1.tgz#3d63c3edfda02e06e01a452ad88caacc7cdcb6e8"
|
||||
|
@ -13934,6 +13947,16 @@ object.fromentries@^1.0.0:
|
|||
function-bind "^1.1.1"
|
||||
has "^1.0.1"
|
||||
|
||||
object.fromentries@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/object.fromentries/-/object.fromentries-2.0.0.tgz#49a543d92151f8277b3ac9600f1e930b189d30ab"
|
||||
integrity sha512-9iLiI6H083uiqUuvzyY6qrlmc/Gz8hLQFOcb/Ri/0xXFkSNS3ctV+CbE6yM2+AnkYfOB3dGjdzC0wrMLIhQICA==
|
||||
dependencies:
|
||||
define-properties "^1.1.2"
|
||||
es-abstract "^1.11.0"
|
||||
function-bind "^1.1.1"
|
||||
has "^1.0.1"
|
||||
|
||||
object.getownpropertydescriptors@^2.0.3:
|
||||
version "2.0.3"
|
||||
resolved "https://registry.yarnpkg.com/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz#8758c846f5b407adab0f236e0986f14b051caa16"
|
||||
|
@ -16885,7 +16908,7 @@ resolve@1.8.1, resolve@^1.3.2, resolve@^1.4.0, resolve@^1.8.1:
|
|||
dependencies:
|
||||
path-parse "^1.0.5"
|
||||
|
||||
resolve@^1.1.6, resolve@^1.5.0, resolve@^1.6.0:
|
||||
resolve@^1.1.6, resolve@^1.5.0, resolve@^1.6.0, resolve@^1.9.0:
|
||||
version "1.10.0"
|
||||
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.10.0.tgz#3bdaaeaf45cc07f375656dfd2e54ed0810b101ba"
|
||||
integrity sha512-3sUr9aq5OfSg2S9pNtPA9hL1FVEAjvfOC4leW0SNf/mpnaakz2a9femSd6LqAww2RaFctwyf1lCqnTHuF1rxDg==
|
||||
|
|
Loading…
Reference in New Issue