From ed0d3afb4ff11520e4a73d1318d1269c2e994c06 Mon Sep 17 00:00:00 2001 From: Eric Mastro Date: Wed, 16 Oct 2019 22:30:14 +0900 Subject: [PATCH] refactor(@embark/blockchain): move module into own package (#1942) --- packages/embark/package.json | 1 + packages/embark/src/lib/core/engine.js | 2 +- packages/stack/blockchain/.npmrc | 4 + packages/stack/blockchain/README.md | 6 ++ packages/stack/blockchain/package.json | 82 +++++++++++++++++++ .../blockchain/src}/api.ts | 2 - .../blockchain/src}/index.js | 0 packages/stack/blockchain/tsconfig.json | 4 + packages/stack/blockchain/tslint.json | 3 + 9 files changed, 101 insertions(+), 3 deletions(-) create mode 100644 packages/stack/blockchain/.npmrc create mode 100644 packages/stack/blockchain/README.md create mode 100644 packages/stack/blockchain/package.json rename packages/{embark/src/lib/modules/blockchain => stack/blockchain/src}/api.ts (99%) rename packages/{embark/src/lib/modules/blockchain => stack/blockchain/src}/index.js (100%) create mode 100644 packages/stack/blockchain/tsconfig.json create mode 100644 packages/stack/blockchain/tslint.json diff --git a/packages/embark/package.json b/packages/embark/package.json index 54c5988e9..48abf6b99 100644 --- a/packages/embark/package.json +++ b/packages/embark/package.json @@ -94,6 +94,7 @@ "embark-api": "^4.1.1", "embark-authenticator": "^4.1.1", "embark-basic-pipeline": "^4.1.1", + "embark-blockchain": "^4.1.1", "embark-code-runner": "^4.1.1", "embark-communication": "^4.1.1", "embark-compiler": "^4.1.1", diff --git a/packages/embark/src/lib/core/engine.js b/packages/embark/src/lib/core/engine.js index 79c051ea5..1ab2c37af 100644 --- a/packages/embark/src/lib/core/engine.js +++ b/packages/embark/src/lib/core/engine.js @@ -167,7 +167,7 @@ class Engine { stackComponents(options) { this.registerModulePackage('embark-pipeline', { plugins: this.plugins }); - this.registerModule('blockchain', { plugins: this.plugins }); + this.registerModulePackage('embark-blockchain', { plugins: this.plugins }); this.registerModulePackage('embark-proxy', {plugins: this.plugins}); // TODO: coverage param should be part of the request compilation command, not an option here // some other params in the options might not longer be relevant, in fact we probably don't need options anymore diff --git a/packages/stack/blockchain/.npmrc b/packages/stack/blockchain/.npmrc new file mode 100644 index 000000000..e031d3432 --- /dev/null +++ b/packages/stack/blockchain/.npmrc @@ -0,0 +1,4 @@ +engine-strict = true +package-lock = false +save-exact = true +scripts-prepend-node-path = true diff --git a/packages/stack/blockchain/README.md b/packages/stack/blockchain/README.md new file mode 100644 index 000000000..8ae787d15 --- /dev/null +++ b/packages/stack/blockchain/README.md @@ -0,0 +1,6 @@ +# `embark-blockchain` + +> Blockchain APIs 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/stack/blockchain/package.json b/packages/stack/blockchain/package.json new file mode 100644 index 000000000..3666be1dd --- /dev/null +++ b/packages/stack/blockchain/package.json @@ -0,0 +1,82 @@ +{ + "name": "embark-blockchain", + "version": "4.1.1", + "author": "Iuri Matias ", + "contributors": [], + "description": "Blockchain APIs for Embark", + "homepage": "https://github.com/embark-framework/embark/tree/master/packages/stack/blockchain#readme", + "bugs": "https://github.com/embark-framework/embark/issues", + "keywords": [ + "blockchain", + "dapps", + "ethereum", + "ipfs", + "serverless", + "solc", + "solidity" + ], + "files": [ + "dist" + ], + "license": "MIT", + "repository": { + "directory": "packages/stack/blockchain", + "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": "eslint src/", + "qa": "npm-run-all lint _build", + "reset": "npx rimraf dist embark-*.tgz package", + "solo": "embark-solo", + "test": "jest" + }, + "eslintConfig": { + "extends": "../../../.eslintrc.json" + }, + "dependencies": { + "@babel/runtime-corejs2": "7.6.2", + "async": "2.6.1", + "clone-deep": "4.0.0", + "embark-core": "^4.1.1", + "embark-i18n": "^4.1.1", + "embark-utils": "^4.1.1" + }, + "devDependencies": { + "@babel/core": "7.6.2", + "babel-jest": "24.9.0", + "embark-solo": "^4.1.1", + "embark-testing": "^4.1.1", + "eslint": "5.7.0", + "jest": "24.9.0", + "npm-run-all": "4.1.5", + "rimraf": "3.0.0" + }, + "engines": { + "node": ">=8.12.0 <12.0.0", + "npm": ">=6.4.1", + "yarn": ">=1.12.3" + }, + "jest": { + "collectCoverage": true, + "testEnvironment": "node", + "testMatch": [ + "**/test/**/*.js" + ], + "transform": { + "\\.js$": [ + "babel-jest", + { + "rootMode": "upward" + } + ] + } + } +} diff --git a/packages/embark/src/lib/modules/blockchain/api.ts b/packages/stack/blockchain/src/api.ts similarity index 99% rename from packages/embark/src/lib/modules/blockchain/api.ts rename to packages/stack/blockchain/src/api.ts index 85c91921e..52bc59fb9 100644 --- a/packages/embark/src/lib/modules/blockchain/api.ts +++ b/packages/stack/blockchain/src/api.ts @@ -1,6 +1,4 @@ import { Embark, Events, Logger } from "embark"; -import { Request, Response } from "express"; -import Websocket from "ws"; export default class BlockchainAPI { private embark: Embark; private logger: Logger; diff --git a/packages/embark/src/lib/modules/blockchain/index.js b/packages/stack/blockchain/src/index.js similarity index 100% rename from packages/embark/src/lib/modules/blockchain/index.js rename to packages/stack/blockchain/src/index.js diff --git a/packages/stack/blockchain/tsconfig.json b/packages/stack/blockchain/tsconfig.json new file mode 100644 index 000000000..52d43eaaa --- /dev/null +++ b/packages/stack/blockchain/tsconfig.json @@ -0,0 +1,4 @@ +{ + "extends": "../../tsconfig.json", + "include": ["src/**/*"] +} diff --git a/packages/stack/blockchain/tslint.json b/packages/stack/blockchain/tslint.json new file mode 100644 index 000000000..0946f2096 --- /dev/null +++ b/packages/stack/blockchain/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "../../tslint.json" +}