mirror of https://github.com/embarklabs/embark.git
build: implement collective typecheck
This PR replaces #2057. Implement a collective typecheck action that can be invoked in the root of the monorepo with `yarn typecheck` or in watch-mode with `yarn watch:typecheck`. Include the watch-mode typecheck action as part of `yarn start` (a.k.a `yarn watch`). To activate collective typecheck for a package in the monorepo, its `package.json` file should specify: ``` { "embark-collective": { "typecheck": true } } ``` *-or-* ``` { "embark-collective": { "typecheck": {...} } } ``` Where `{...}` above is a `tsconfig.json` fragment that will be merged into the config generated for the package according the same rules that `tsc` applies when merging [configs][config]. When collective typecheck begins, it generates a `tsconfig.json` for the root of the monorepo and for each package that is activated for the action. If the generated JSON is different than what's on disk for the respective root/package config, or if the config is not present on disk, then it will be written. Changes to generated `tsconfig.json` files should be committed; such changes will arise when there are structural changes to the monorepo, e.g. a package is added, removed, moved and/or the directory containing it is renamed. Since the configs are only generated at the beginning of collective typecheck, when structural changes are made in the monorepo `yarn typecheck` (or `yarn start` or `yarn watch:typecheck`) should be restarted. Nearly all of the packages in the monorepo (i.e. all those for which it makes sense) have been activated for collective typecheck. Even those packages that don't contain `.ts` sources are activated because `tsc` can make better sense of the code base as a whole owing to the project references included in the generated `tsconfig.json` files. Also, owing to the fully cross-referenced `tsconfig.json` files, it's possible for `tsc` to type check the whole code base without babel (`yarn build` or `yarn watch:build`) having been run beforehand. **NOTE** that a *"cold typecheck"* of the whole monorepo is resource intensive: on this author's 2019 MacBook Pro it takes around three minutes, the fans spin up, and `tsc` uses nearly 0.5 GB of RAM. However, once a full typecheck has completed, the next full typecheck will complete in a few seconds or less; and when running in watch-mode there is likewise a *big* speedup once a full typecheck has completed, whether that full check happened before it's running in watch-mode or when watch-mode itself resulted in a full check before switching automatically to incremental check, as well a corresponding *big* reduction in resource consumption. A full check will be needed any time `yarn typecheck` (or `yarn start` or `yarn watch:typecheck`) is run in a fresh clone plus `yarn install`, or after doing `yarn reboot[:full]` or `yarn reset`. The combination of options in each generated package-level `tsconfig.json` and the root `tsconfig.base.json` result in `tsc` writing `.d.ts` files (TypeScript declaration files) into the `dist/` directory of each package. That output is intended to live side-by-side with babel's output, and therefore the `"rootDir"` option in each generated config is set to `"./src"`. In projects activated for collective typecheck, `.js` may be converted to `.ts` and/or `.ts` sources may be added without any additional changes needed in package-level `package.json`. --- Reorganize types in `packages/core/typings` (a.k.a `@types/embark`) into `packages/core/core` (`embark-core`), refactor other packages' imports accordingly, and delete `packages/core/typings` from the monorepo. This results in some similarly named but incompatible types exported from `embark-core` (e.g. `Events` and `EmbarkEvents`, the latter being the one from `packages/core/typings`); future refactoring should consolidate those types. To avoid circular dependency relationships it's also necessary to split out `Engine` from `embark-core` into its own package (`embark-engine`) and to introduce a bit of duplication, e.g. the `Maybe` type that's now defined in both `embark-i18n` and `embark-core`. In the process of the types reorg, move many dependencies spec'd in various `package.json` to the `package.json` of the package/s that actually depend on them, e.g. many are moved from `packages/embark/package.json` to `packages/core/engine/package.json`. Related to those moves, fix some Node.js `require`-logic related to bug-prone dependency resolution. Fix all type errors that appeared as a result of activating collective typecheck across the whole monorepo. Reactivate `tslint` in `packages/core/core` and fix the remaining linter errors. Tidy up and add a few items in the root `package.json` scripts. Bump lerna from `3.16.4` to `3.19.0`. Bumpt typescript from `3.6.3` to `3.7.2`. Bumpt tslint from `5.16.0` to `5.20.1`. Make various changes related to packages' `import`/`require`ing packages that weren't spec'd in their respective `package.json`. More refactoring is needed in this regard, but changes were made as the problems were observed in the process of authoring this PR. [config]: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html
This commit is contained in:
parent
a9c91c9503
commit
ee56f37713
|
@ -1,6 +1,7 @@
|
||||||
.DS_Store
|
.DS_Store
|
||||||
.idea
|
.idea
|
||||||
.nyc_output
|
.nyc_output
|
||||||
|
.tsconfig.collective.json
|
||||||
.vscode
|
.vscode
|
||||||
@embark*.tgz
|
@embark*.tgz
|
||||||
NOTES
|
NOTES
|
||||||
|
@ -14,6 +15,7 @@ npm-debug.log*
|
||||||
npm-shrinkwrap.json
|
npm-shrinkwrap.json
|
||||||
package
|
package
|
||||||
package-lock.json
|
package-lock.json
|
||||||
|
tsconfig.tsbuildinfo
|
||||||
yarn-debug.log*
|
yarn-debug.log*
|
||||||
yarn-error.log*
|
yarn-error.log*
|
||||||
yarn.lock
|
yarn.lock
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
"react": "16.12.0",
|
"react": "16.12.0",
|
||||||
"react-bootstrap": "0.32.4",
|
"react-bootstrap": "0.32.4",
|
||||||
"react-dom": "16.12.0",
|
"react-dom": "16.12.0",
|
||||||
|
"rimraf": "3.0.0",
|
||||||
"zeppelin-solidity": "1.12.0"
|
"zeppelin-solidity": "1.12.0"
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
@ -22,7 +23,7 @@
|
||||||
"ci": "npm run qa",
|
"ci": "npm run qa",
|
||||||
"clean": "npm run reset",
|
"clean": "npm run reset",
|
||||||
"qa": "npm run test",
|
"qa": "npm run test",
|
||||||
"reset": "npx embark-reset",
|
"reset": "npx embark-reset && npx rimraf embark-*.tgz package",
|
||||||
"test": "npx embark test"
|
"test": "npx embark test"
|
||||||
},
|
},
|
||||||
"version": "5.0.0-alpha.4"
|
"version": "5.0.0-alpha.4"
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
"description": "Test DApp for integration testing purposes",
|
"description": "Test DApp for integration testing purposes",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"embark": "^5.0.0-alpha.4",
|
"embark": "^5.0.0-alpha.4",
|
||||||
"embark-reset": "^5.0.0-alpha.2"
|
"embark-reset": "^5.0.0-alpha.2",
|
||||||
|
"rimraf": "3.0.0"
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"name": "embark-dapp-test-contracts",
|
"name": "embark-dapp-test-contracts",
|
||||||
|
@ -11,7 +12,7 @@
|
||||||
"ci": "npm run qa",
|
"ci": "npm run qa",
|
||||||
"clean": "npm run reset",
|
"clean": "npm run reset",
|
||||||
"qa": "npm run test",
|
"qa": "npm run test",
|
||||||
"reset": "npx embark-reset",
|
"reset": "npx embark-reset && npx rimraf embark-*.tgz package",
|
||||||
"test": "npx embark test"
|
"test": "npx embark test"
|
||||||
},
|
},
|
||||||
"version": "5.0.0-alpha.4"
|
"version": "5.0.0-alpha.4"
|
||||||
|
|
|
@ -3,9 +3,16 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"haml": "0.4.3"
|
"haml": "0.4.3"
|
||||||
},
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"rimraf": "3.0.0"
|
||||||
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"name": "embark-dapp-test-service",
|
"name": "embark-dapp-test-service",
|
||||||
"private": true,
|
"private": true,
|
||||||
|
"scripts": {
|
||||||
|
"clean": "npm run reset",
|
||||||
|
"reset": "npx rimraf embark-*.tgz package"
|
||||||
|
},
|
||||||
"version": "5.0.0-alpha.0"
|
"version": "5.0.0-alpha.0"
|
||||||
}
|
}
|
||||||
|
|
16
package.json
16
package.json
|
@ -7,7 +7,7 @@
|
||||||
"find-up": "4.1.0",
|
"find-up": "4.1.0",
|
||||||
"form-data": "2.5.1",
|
"form-data": "2.5.1",
|
||||||
"fs-extra": "8.1.0",
|
"fs-extra": "8.1.0",
|
||||||
"lerna": "3.16.4",
|
"lerna": "3.19.0",
|
||||||
"minimist": "1.2.0",
|
"minimist": "1.2.0",
|
||||||
"npm-run-all": "4.1.5",
|
"npm-run-all": "4.1.5",
|
||||||
"nyc": "13.1.0",
|
"nyc": "13.1.0",
|
||||||
|
@ -29,7 +29,7 @@
|
||||||
"ci:full": "npm-run-all cwtree \"ci -- --concurrency={1}\" ci:dapps cwtree -- 1",
|
"ci:full": "npm-run-all cwtree \"ci -- --concurrency={1}\" ci:dapps cwtree -- 1",
|
||||||
"clean": "node scripts/monorun --stream clean",
|
"clean": "node scripts/monorun --stream clean",
|
||||||
"clean:full": "npx npm-run-all clean clean:top",
|
"clean:full": "npx npm-run-all clean clean:top",
|
||||||
"clean:top": "npx rimraf node_modules",
|
"clean:top": "npm run reset:top && npx rimraf node_modules",
|
||||||
"coverage": "npm-run-all coverage:collect coverage:report",
|
"coverage": "npm-run-all coverage:collect coverage:report",
|
||||||
"coverage:collect": "node scripts/coverage-collect",
|
"coverage:collect": "node scripts/coverage-collect",
|
||||||
"coverage:coveralls": "nyc report --reporter=text-lcov | coveralls || exit 0",
|
"coverage:coveralls": "nyc report --reporter=text-lcov | coveralls || exit 0",
|
||||||
|
@ -39,12 +39,11 @@
|
||||||
"deploy:site": "node site/deploy-site",
|
"deploy:site": "node site/deploy-site",
|
||||||
"globalize": "node scripts/globalize",
|
"globalize": "node scripts/globalize",
|
||||||
"lint": "node scripts/monorun --parallel lint",
|
"lint": "node scripts/monorun --parallel lint",
|
||||||
"package": "lerna exec --stream --concurrency=1 -- npm pack",
|
"package": "lerna exec --concurrency=1 --no-private --stream -- npm pack",
|
||||||
"postclean": "npx lerna clean --yes",
|
"postclean": "npx lerna clean --yes",
|
||||||
"postreboot": "yarn install",
|
"postreboot": "yarn install",
|
||||||
"postreboot:full": "yarn install",
|
"postreboot:full": "yarn install",
|
||||||
"preci:full": "yarn install",
|
"preci:full": "yarn install",
|
||||||
"preclean": "npm run reset:top",
|
|
||||||
"preqa:full": "yarn install",
|
"preqa:full": "yarn install",
|
||||||
"qa": "node scripts/monorun --ignore embark-dapp-* --stream qa",
|
"qa": "node scripts/monorun --ignore embark-dapp-* --stream qa",
|
||||||
"qa:dapps": "lerna run --concurrency=1 --scope embark-dapp-* --stream qa",
|
"qa:dapps": "lerna run --concurrency=1 --scope embark-dapp-* --stream qa",
|
||||||
|
@ -52,14 +51,15 @@
|
||||||
"reboot": "npm run clean",
|
"reboot": "npm run clean",
|
||||||
"reboot:full": "npm run clean:full",
|
"reboot:full": "npm run clean:full",
|
||||||
"release": "node scripts/release",
|
"release": "node scripts/release",
|
||||||
"reset": "node scripts/monorun --stream reset",
|
"reset": "node scripts/monorun --stream reset && npm-run-all reset:*",
|
||||||
"reset:full": "npx npm-run-all reset reset:top",
|
"reset:top": "npx rimraf .tsconfig.collective.json .nyc_output coverage",
|
||||||
"reset:top": "npx rimraf .nyc_output coverage",
|
"reset:tsbuildinfo": "npx lerna exec --parallel -- npx rimraf node_modules/.cache/tsc",
|
||||||
"start": "node scripts/monorun --parallel start",
|
"start": "node scripts/monorun --parallel start",
|
||||||
"test": "node scripts/monorun --ignore embark-dapp-* --stream test",
|
"test": "node scripts/monorun --ignore embark-dapp-* --stream test",
|
||||||
"test:dapps": "lerna run --concurrency=1 --scope embark-dapp-* --stream test",
|
"test:dapps": "lerna run --concurrency=1 --scope embark-dapp-* --stream test",
|
||||||
"test:full": "npm-run-all test test:dapps",
|
"test:full": "npm-run-all test test:dapps",
|
||||||
"typecheck": "node scripts/monorun --parallel typecheck",
|
"typecheck": "node scripts/monorun --stream typecheck",
|
||||||
|
"typecheck:clean": "npm run typecheck -- -- -- --clean",
|
||||||
"watch": "node scripts/monorun --parallel watch",
|
"watch": "node scripts/monorun --parallel watch",
|
||||||
"watch:build": "node scripts/monorun --parallel watch:build",
|
"watch:build": "node scripts/monorun --parallel watch:build",
|
||||||
"watch:lint": "node scripts/monorun --parallel watch:lint",
|
"watch:lint": "node scripts/monorun --parallel watch:lint",
|
||||||
|
|
|
@ -22,18 +22,21 @@
|
||||||
"url": "https://github.com/embark-framework/embark.git"
|
"url": "https://github.com/embark-framework/embark.git"
|
||||||
},
|
},
|
||||||
"main": "./dist/index.js",
|
"main": "./dist/index.js",
|
||||||
|
"types": "./dist/index.d.ts",
|
||||||
"files": [
|
"files": [
|
||||||
"dist"
|
"dist"
|
||||||
],
|
],
|
||||||
"embark-collective": {
|
"embark-collective": {
|
||||||
"build:node": true
|
"build:node": true,
|
||||||
|
"typecheck": true
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"_build": "npm run solo -- build",
|
"_build": "npm run solo -- build",
|
||||||
|
"_typecheck": "npm run solo -- typecheck",
|
||||||
"ci": "npm run qa",
|
"ci": "npm run qa",
|
||||||
"clean": "npm run reset",
|
"clean": "npm run reset",
|
||||||
"lint": "eslint src/",
|
"lint": "eslint src/",
|
||||||
"qa": "npm-run-all lint _build",
|
"qa": "npm-run-all lint _typecheck _build",
|
||||||
"reset": "npx rimraf dist embark-*.tgz package",
|
"reset": "npx rimraf dist embark-*.tgz package",
|
||||||
"solo": "embark-solo"
|
"solo": "embark-solo"
|
||||||
},
|
},
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"composite": true,
|
||||||
|
"declarationDir": "./dist",
|
||||||
|
"rootDir": "./src",
|
||||||
|
"tsBuildInfoFile": "./node_modules/.cache/tsc/tsconfig.embark-api-client.tsbuildinfo"
|
||||||
|
},
|
||||||
|
"extends": "../../../tsconfig.base.json",
|
||||||
|
"include": [
|
||||||
|
"src/**/*"
|
||||||
|
]
|
||||||
|
}
|
|
@ -98,7 +98,7 @@
|
||||||
"redux-saga": "1.1.3",
|
"redux-saga": "1.1.3",
|
||||||
"rimraf": "3.0.0",
|
"rimraf": "3.0.0",
|
||||||
"simple-line-icons": "2.4.1",
|
"simple-line-icons": "2.4.1",
|
||||||
"typescript": "3.6.3",
|
"typescript": "3.7.2",
|
||||||
"uuid": "3.3.2",
|
"uuid": "3.3.2",
|
||||||
"velocity-react": "1.4.1",
|
"velocity-react": "1.4.1",
|
||||||
"web3": "1.2.1",
|
"web3": "1.2.1",
|
||||||
|
|
|
@ -25,28 +25,29 @@
|
||||||
"url": "https://github.com/embark-framework/embark.git"
|
"url": "https://github.com/embark-framework/embark.git"
|
||||||
},
|
},
|
||||||
"main": "./dist/index.js",
|
"main": "./dist/index.js",
|
||||||
|
"types": "./dist/index.d.ts",
|
||||||
"embark-collective": {
|
"embark-collective": {
|
||||||
"build:node": true
|
"build:node": true,
|
||||||
|
"typecheck": true
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"_build": "npm run solo -- build",
|
"_build": "npm run solo -- build",
|
||||||
|
"_typecheck": "npm run solo -- typecheck",
|
||||||
"ci": "npm run qa",
|
"ci": "npm run qa",
|
||||||
"clean": "npm run reset",
|
"clean": "npm run reset",
|
||||||
"lint": "npm-run-all lint:*",
|
"lint": "npm-run-all lint:*",
|
||||||
"lint:js": "eslint src/",
|
"lint:js": "eslint src/",
|
||||||
"lint:ts": "tslint -c tslint.json \"src/**/*.ts\"",
|
"lint:ts": "tslint -c tslint.json \"src/**/*.ts\"",
|
||||||
"qa": "npm-run-all lint typecheck _build",
|
"qa": "npm-run-all lint _typecheck _build",
|
||||||
"reset": "npx rimraf dist embark-*.tgz package",
|
"reset": "npx rimraf dist embark-*.tgz package",
|
||||||
"solo": "embark-solo",
|
"solo": "embark-solo"
|
||||||
"typecheck": "tsc",
|
|
||||||
"watch": "run-p watch:*",
|
|
||||||
"watch:typecheck": "npm run typecheck -- --preserveWatchOutput --watch"
|
|
||||||
},
|
},
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
"extends": "../../../.eslintrc.json"
|
"extends": "../../../.eslintrc.json"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime-corejs3": "7.7.4",
|
"@babel/runtime-corejs3": "7.7.4",
|
||||||
|
"@types/async": "3.0.3",
|
||||||
"async": "2.6.1",
|
"async": "2.6.1",
|
||||||
"colors": "1.3.2",
|
"colors": "1.3.2",
|
||||||
"core-js": "3.4.3",
|
"core-js": "3.4.3",
|
||||||
|
@ -60,13 +61,12 @@
|
||||||
"web3": "1.2.1"
|
"web3": "1.2.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/async": "3.0.3",
|
|
||||||
"embark-solo": "^5.0.0-alpha.2",
|
"embark-solo": "^5.0.0-alpha.2",
|
||||||
"eslint": "5.7.0",
|
"eslint": "5.7.0",
|
||||||
"npm-run-all": "4.1.5",
|
"npm-run-all": "4.1.5",
|
||||||
"rimraf": "3.0.0",
|
"rimraf": "3.0.0",
|
||||||
"tslint": "5.16.0",
|
"tslint": "5.20.1",
|
||||||
"typescript": "3.6.3"
|
"typescript": "3.7.2"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=10.17.0 <12.0.0",
|
"node": ">=10.17.0 <12.0.0",
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Callback, Embark, Events } /* supplied by @types/embark in packages/embark-typings */ from "embark";
|
import { Callback, Embark, EmbarkEvents } from "embark-core";
|
||||||
import { __ } from "embark-i18n";
|
import { __ } from "embark-i18n";
|
||||||
import { Logger } from 'embark-logger';
|
import { Logger } from 'embark-logger';
|
||||||
import * as fs from "./fs";
|
import * as fs from "./fs";
|
||||||
|
@ -8,7 +8,7 @@ export { fs, VM };
|
||||||
|
|
||||||
class CodeRunner {
|
class CodeRunner {
|
||||||
private logger: Logger;
|
private logger: Logger;
|
||||||
private events: Events;
|
private events: EmbarkEvents;
|
||||||
private vm: VM;
|
private vm: VM;
|
||||||
|
|
||||||
constructor(embark: Embark, _options: any) {
|
constructor(embark: Embark, _options: any) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { each } from "async";
|
import { each } from "async";
|
||||||
import { Callback } /* supplied by @types/embark in packages/embark-typings */ from "embark";
|
import { Callback } from "embark-core";
|
||||||
import { compact, dappPath, isEs6Module, recursiveMerge } from "embark-utils";
|
import { compact, dappPath, isEs6Module, recursiveMerge } from "embark-utils";
|
||||||
import { Logger } from 'embark-logger';
|
import { Logger } from 'embark-logger';
|
||||||
import * as path from "path";
|
import * as path from "path";
|
||||||
|
|
|
@ -1,4 +1,26 @@
|
||||||
{
|
{
|
||||||
"extends": "../../../tsconfig.json",
|
"compilerOptions": {
|
||||||
"include": ["src/**/*"]
|
"composite": true,
|
||||||
|
"declarationDir": "./dist",
|
||||||
|
"rootDir": "./src",
|
||||||
|
"tsBuildInfoFile": "./node_modules/.cache/tsc/tsconfig.embark-code-runner.tsbuildinfo"
|
||||||
|
},
|
||||||
|
"extends": "../../../tsconfig.base.json",
|
||||||
|
"include": [
|
||||||
|
"src/**/*"
|
||||||
|
],
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"path": "../../embarkjs/embarkjs"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../core"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../logger"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../utils"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,39 +26,40 @@
|
||||||
"url": "https://github.com/embark-framework/embark.git"
|
"url": "https://github.com/embark-framework/embark.git"
|
||||||
},
|
},
|
||||||
"main": "./dist/lib/index.js",
|
"main": "./dist/lib/index.js",
|
||||||
|
"types": "./dist/lib/index.d.ts",
|
||||||
"embark-collective": {
|
"embark-collective": {
|
||||||
"build:node": true
|
"build:node": true,
|
||||||
|
"typecheck": true
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"_build": "npm run solo -- build",
|
"_build": "npm run solo -- build",
|
||||||
|
"_typecheck": "npm run solo -- typecheck",
|
||||||
"ci": "npm run qa",
|
"ci": "npm run qa",
|
||||||
"clean": "npm run reset",
|
"clean": "npm run reset",
|
||||||
"lint": "npm-run-all lint:*",
|
"lint": "npm-run-all lint:*",
|
||||||
"lint:js": "eslint src/",
|
"lint:js": "eslint src/",
|
||||||
"lint:ts": "tslint -c tslint.json \"src/**/*.ts\"",
|
"lint:ts": "tslint -c tslint.json \"src/**/*.ts\"",
|
||||||
"qa": "npm-run-all lint typecheck _build test",
|
"qa": "npm-run-all lint _typecheck _build test",
|
||||||
"reset": "npx rimraf .nyc_output coverage dist embark-*.tgz package",
|
"reset": "npx rimraf .nyc_output coverage dist embark-*.tgz package",
|
||||||
"solo": "embark-solo",
|
"solo": "embark-solo",
|
||||||
"test": "nyc --reporter=html --reporter=json mocha \"dist/test/**/*.js\" --exit --no-timeouts --require source-map-support/register",
|
"test": "nyc --reporter=html --reporter=json mocha \"dist/test/**/*.js\" --exit --no-timeouts --require source-map-support/register"
|
||||||
"typecheck": "tsc",
|
|
||||||
"watch": "run-p watch:*",
|
|
||||||
"watch:typecheck": "npm run typecheck -- --preserveWatchOutput --watch"
|
|
||||||
},
|
},
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
"extends": "../../../.eslintrc.json"
|
"extends": "../../../.eslintrc.json"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime-corejs3": "7.7.4",
|
"@babel/runtime-corejs3": "7.7.4",
|
||||||
|
"@types/json-stringify-safe": "5.0.0",
|
||||||
"async": "2.6.1",
|
"async": "2.6.1",
|
||||||
"chalk": "2.4.2",
|
"chalk": "2.4.2",
|
||||||
"core-js": "3.4.3",
|
"core-js": "3.4.3",
|
||||||
"embark-core": "^5.0.0-alpha.4",
|
"embark-core": "^5.0.0-alpha.4",
|
||||||
"embark-i18n": "^5.0.0-alpha.2",
|
"embark-i18n": "^5.0.0-alpha.2",
|
||||||
"embark-utils": "^5.0.0-alpha.4",
|
"embark-utils": "^5.0.0-alpha.4",
|
||||||
|
"fs-extra": "8.1.0",
|
||||||
"json-stringify-safe": "5.0.1"
|
"json-stringify-safe": "5.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/json-stringify-safe": "5.0.0",
|
|
||||||
"embark-logger": "^5.0.0-alpha.4",
|
"embark-logger": "^5.0.0-alpha.4",
|
||||||
"embark-solo": "^5.0.0-alpha.2",
|
"embark-solo": "^5.0.0-alpha.2",
|
||||||
"eslint": "5.7.0",
|
"eslint": "5.7.0",
|
||||||
|
@ -67,8 +68,8 @@
|
||||||
"nyc": "13.1.0",
|
"nyc": "13.1.0",
|
||||||
"rimraf": "3.0.0",
|
"rimraf": "3.0.0",
|
||||||
"source-map-support": "0.5.13",
|
"source-map-support": "0.5.13",
|
||||||
"tslint": "5.16.0",
|
"tslint": "5.20.1",
|
||||||
"typescript": "3.6.3"
|
"typescript": "3.7.2"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=10.17.0 <12.0.0",
|
"node": ">=10.17.0 <12.0.0",
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import { waterfall } from "async";
|
|
||||||
import chalk from "chalk";
|
import chalk from "chalk";
|
||||||
import { Callback, Embark, Events } /* supplied by @types/embark in packages/embark-typings */ from "embark";
|
import { Embark, EmbarkEvents } from "embark-core";
|
||||||
import constants from "embark-core/constants.json";
|
import constants from "embark-core/constants.json";
|
||||||
import { __ } from "embark-i18n";
|
import { __ } from "embark-i18n";
|
||||||
import { dappPath, escapeHtml, exit, jsonFunctionReplacer } from "embark-utils";
|
import { dappPath, escapeHtml, exit, jsonFunctionReplacer } from "embark-utils";
|
||||||
|
@ -16,9 +15,9 @@ interface HelpDescription {
|
||||||
usage?: string;
|
usage?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
class Console {
|
export default class Console {
|
||||||
private embark: Embark;
|
private embark: Embark;
|
||||||
private events: Events;
|
private events: EmbarkEvents;
|
||||||
private plugins: any;
|
private plugins: any;
|
||||||
private version: string;
|
private version: string;
|
||||||
private logger: any;
|
private logger: any;
|
||||||
|
@ -150,7 +149,7 @@ class Console {
|
||||||
__("The web3 object and the interfaces for the deployed contracts and their methods are also available"));
|
__("The web3 object and the interfaces for the deployed contracts and their methods are also available"));
|
||||||
return helpText.join("\n");
|
return helpText.join("\n");
|
||||||
} else if (["quit", "exit", "sair", "sortir", __("quit")].indexOf(cmd) >= 0) {
|
} else if (["quit", "exit", "sair", "sortir", __("quit")].indexOf(cmd) >= 0) {
|
||||||
exit();
|
exit(0);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -285,5 +284,3 @@ class Console {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = Console;
|
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
import { Contract, Embark, Events } /* supplied by @types/embark in packages/embark-typings */ from "embark";
|
import { Contract, Embark, EmbarkEvents } from "embark-core";
|
||||||
import { fuzzySearch } from "embark-utils";
|
import { fuzzySearch } from "embark-utils";
|
||||||
import { suggestions as defaultSuggestions } from "../../suggestions.json";
|
import { readJsonSync } from "fs-extra";
|
||||||
|
import { join } from "path";
|
||||||
|
|
||||||
|
const { suggestions: defaultSuggestions } = readJsonSync(join(__dirname, "../../suggestions.json"));
|
||||||
|
|
||||||
interface ContractsManager {
|
interface ContractsManager {
|
||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
|
@ -23,7 +26,7 @@ type SuggestionsList = Suggestion[];
|
||||||
|
|
||||||
export default class Suggestions {
|
export default class Suggestions {
|
||||||
private embark: Embark;
|
private embark: Embark;
|
||||||
private events: Events;
|
private events: EmbarkEvents;
|
||||||
private contracts: ContractsManager;
|
private contracts: ContractsManager;
|
||||||
private static readonly DEFAULT_SUGGESTIONS = defaultSuggestions;
|
private static readonly DEFAULT_SUGGESTIONS = defaultSuggestions;
|
||||||
private _suggestions: SuggestionsList = [];
|
private _suggestions: SuggestionsList = [];
|
||||||
|
|
|
@ -1,4 +1,26 @@
|
||||||
{
|
{
|
||||||
"extends": "../../../tsconfig.json",
|
"compilerOptions": {
|
||||||
"include": ["src/**/*"]
|
"composite": true,
|
||||||
|
"declarationDir": "./dist",
|
||||||
|
"rootDir": "./src",
|
||||||
|
"tsBuildInfoFile": "./node_modules/.cache/tsc/tsconfig.embark-console.tsbuildinfo"
|
||||||
|
},
|
||||||
|
"extends": "../../../tsconfig.base.json",
|
||||||
|
"include": [
|
||||||
|
"src/lib/**/*"
|
||||||
|
],
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"path": "../core"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../i18n"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../logger"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../utils"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,35 +27,38 @@
|
||||||
"url": "https://github.com/embark-framework/embark.git"
|
"url": "https://github.com/embark-framework/embark.git"
|
||||||
},
|
},
|
||||||
"main": "./dist/index.js",
|
"main": "./dist/index.js",
|
||||||
|
"types": "./dist/index.d.ts",
|
||||||
"embark-collective": {
|
"embark-collective": {
|
||||||
"build:node": true
|
"build:node": true,
|
||||||
|
"typecheck": true
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"_build": "npm run solo -- build",
|
"_build": "npm run solo -- build",
|
||||||
|
"_typecheck": "npm run solo -- typecheck",
|
||||||
"ci": "npm run qa",
|
"ci": "npm run qa",
|
||||||
"clean": "npm run reset",
|
"clean": "npm run reset",
|
||||||
"lint": "npm-run-all lint:*",
|
"lint": "npm-run-all lint:*",
|
||||||
"lint:js": "eslint process.js src/",
|
"lint:js": "eslint process.js src/",
|
||||||
"// lint:ts": "tslint -c tslint.json \"src/**/*.ts\"",
|
"lint:ts": "tslint -c tslint.json \"src/**/*.ts\"",
|
||||||
"qa": "npm-run-all lint typecheck _build",
|
"qa": "npm-run-all lint _typecheck _build",
|
||||||
"reset": "npx rimraf dist embark-*.tgz package",
|
"reset": "npx rimraf dist embark-*.tgz package",
|
||||||
"solo": "embark-solo",
|
"solo": "embark-solo"
|
||||||
"typecheck": "tsc"
|
|
||||||
},
|
},
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
"extends": "../../../.eslintrc.json"
|
"extends": "../../../.eslintrc.json"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime-corejs3": "7.7.4",
|
"@babel/runtime-corejs3": "7.7.4",
|
||||||
|
"@types/deep-equal": "1.0.1",
|
||||||
|
"@types/web3": "1.0.12",
|
||||||
"colors": "1.3.2",
|
"colors": "1.3.2",
|
||||||
"core-js": "3.4.3",
|
"core-js": "3.4.3",
|
||||||
"decompress": "4.2.0",
|
"decompress": "4.2.0",
|
||||||
|
"deep-equal": "1.0.1",
|
||||||
"embark-i18n": "^5.0.0-alpha.2",
|
"embark-i18n": "^5.0.0-alpha.2",
|
||||||
"embark-logger": "^5.0.0-alpha.4",
|
"embark-logger": "^5.0.0-alpha.4",
|
||||||
"embark-rpc-manager": "^5.0.0-alpha.4",
|
|
||||||
"embark-utils": "^5.0.0-alpha.4",
|
"embark-utils": "^5.0.0-alpha.4",
|
||||||
"embark-whisper-geth": "^5.0.0-alpha.4",
|
"find-up": "4.1.0",
|
||||||
"embark-whisper-parity": "^5.0.0-alpha.4",
|
|
||||||
"flatted": "0.2.3",
|
"flatted": "0.2.3",
|
||||||
"fs-extra": "8.1.0",
|
"fs-extra": "8.1.0",
|
||||||
"globule": "1.2.1",
|
"globule": "1.2.1",
|
||||||
|
@ -67,14 +70,12 @@
|
||||||
"window-size": "1.1.1"
|
"window-size": "1.1.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "7.7.4",
|
|
||||||
"babel-jest": "24.9.0",
|
|
||||||
"embark-solo": "^5.0.0-alpha.2",
|
"embark-solo": "^5.0.0-alpha.2",
|
||||||
"eslint": "5.7.0",
|
"eslint": "5.7.0",
|
||||||
"npm-run-all": "4.1.5",
|
"npm-run-all": "4.1.5",
|
||||||
"rimraf": "3.0.0",
|
"rimraf": "3.0.0",
|
||||||
"tslint": "5.16.0",
|
"tslint": "5.20.1",
|
||||||
"typescript": "3.6.3"
|
"typescript": "3.7.2"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=10.17.0 <12.0.0",
|
"node": ">=10.17.0 <12.0.0",
|
||||||
|
|
|
@ -6,7 +6,6 @@ import { filesMatchingPattern, fileMatchesPattern } from './utils/utils';
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const deepEqual = require('deep-equal');
|
const deepEqual = require('deep-equal');
|
||||||
const web3 = require('web3');
|
const web3 = require('web3');
|
||||||
const constants = require('embark-core/constants');
|
|
||||||
import { __ } from 'embark-i18n';
|
import { __ } from 'embark-i18n';
|
||||||
import {
|
import {
|
||||||
buildUrlFromConfig,
|
buildUrlFromConfig,
|
||||||
|
@ -24,11 +23,14 @@ import {
|
||||||
getExternalContractUrl
|
getExternalContractUrl
|
||||||
} from 'embark-utils';
|
} from 'embark-utils';
|
||||||
import { Logger } from 'embark-logger';
|
import { Logger } from 'embark-logger';
|
||||||
|
import { readJsonSync } from 'fs-extra';
|
||||||
const cloneDeep = require('lodash.clonedeep');
|
const cloneDeep = require('lodash.clonedeep');
|
||||||
const { replaceZeroAddressShorthand } = AddressUtils;
|
const { replaceZeroAddressShorthand } = AddressUtils;
|
||||||
|
|
||||||
import { getBlockchainDefaults, getContractDefaults } from './configDefaults';
|
import { getBlockchainDefaults, getContractDefaults } from './configDefaults';
|
||||||
|
|
||||||
|
const constants = readJsonSync(path.join(__dirname, '../constants.json'));
|
||||||
|
|
||||||
const DEFAULT_CONFIG_PATH = 'config/';
|
const DEFAULT_CONFIG_PATH = 'config/';
|
||||||
|
|
||||||
const embark5ChangesUrl = 'https://embark.status.im/docs/migrating_from_3.x.html#Updating-to-v5';
|
const embark5ChangesUrl = 'https://embark.status.im/docs/migrating_from_3.x.html#Updating-to-v5';
|
||||||
|
@ -79,7 +81,7 @@ export class Config {
|
||||||
|
|
||||||
corsParts: string[] = [];
|
corsParts: string[] = [];
|
||||||
|
|
||||||
providerUrl = null;
|
providerUrl = '';
|
||||||
|
|
||||||
contractDirectories: string[] = [];
|
contractDirectories: string[] = [];
|
||||||
|
|
||||||
|
@ -133,8 +135,8 @@ export class Config {
|
||||||
|
|
||||||
// TODO: refactor this so reading the file can be done with a normal resolver or something that takes advantage of the plugin api
|
// TODO: refactor this so reading the file can be done with a normal resolver or something that takes advantage of the plugin api
|
||||||
this.events.setCommandHandler("config:contractsFiles:add", (filename, resolver) => {
|
this.events.setCommandHandler("config:contractsFiles:add", (filename, resolver) => {
|
||||||
resolver = resolver || function (callback) { callback(fs.readFileSync(filename).toString()); };
|
resolver = resolver || (callback => { callback(fs.readFileSync(filename).toString()); });
|
||||||
this.contractsFiles.push(new File({ path: filename, originalPath: filename, type: Types.custom, resolver }));
|
this.contractsFiles.push(new File({path: filename, originalPath: filename, type: Types.custom, resolver}));
|
||||||
});
|
});
|
||||||
|
|
||||||
this.events.setCommandHandler("config:contractsFiles:reset", (cb) => {
|
this.events.setCommandHandler("config:contractsFiles:reset", (cb) => {
|
||||||
|
@ -375,17 +377,17 @@ export class Config {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.blockchainConfig.targetGasLimit && this.blockchainConfig.targetGasLimit.toString().match(unitRegex)) {
|
if (this.blockchainConfig.targetGasLimit && this.blockchainConfig.targetGasLimit.toString().match(unitRegex)) {
|
||||||
this.blockchainConfig.targetGasLimit = getWeiBalanceFromString(this.blockchainConfig.targetGasLimit, web3);
|
this.blockchainConfig.targetGasLimit = getWeiBalanceFromString(this.blockchainConfig.targetGasLimit);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.blockchainConfig.gasPrice && this.blockchainConfig.gasPrice.toString().match(unitRegex)) {
|
if (this.blockchainConfig.gasPrice && this.blockchainConfig.gasPrice.toString().match(unitRegex)) {
|
||||||
this.blockchainConfig.gasPrice = getWeiBalanceFromString(this.blockchainConfig.gasPrice, web3);
|
this.blockchainConfig.gasPrice = getWeiBalanceFromString(this.blockchainConfig.gasPrice);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.blockchainConfig.accounts) {
|
if (this.blockchainConfig.accounts) {
|
||||||
this.blockchainConfig.accounts.forEach(acc => {
|
this.blockchainConfig.accounts.forEach(acc => {
|
||||||
if (acc.balance && acc.balance.toString().match(unitRegex)) {
|
if (acc.balance && acc.balance.toString().match(unitRegex)) {
|
||||||
acc.balance = getWeiBalanceFromString(acc.balance, web3);
|
acc.balance = getWeiBalanceFromString(acc.balance);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -460,7 +462,7 @@ export class Config {
|
||||||
let configObject = getContractDefaults(this.embarkConfig.versions);
|
let configObject = getContractDefaults(this.embarkConfig.versions);
|
||||||
|
|
||||||
const contractsConfigs = this.plugins.getPluginsProperty('contractsConfig', 'contractsConfigs');
|
const contractsConfigs = this.plugins.getPluginsProperty('contractsConfig', 'contractsConfigs');
|
||||||
contractsConfigs.forEach(function (pluginConfig) {
|
contractsConfigs.forEach(pluginConfig => {
|
||||||
configObject = recursiveMerge(configObject, pluginConfig);
|
configObject = recursiveMerge(configObject, pluginConfig);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -475,7 +477,7 @@ export class Config {
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
if (newContractsConfig.gas.match(unitRegex)) {
|
if (newContractsConfig.gas.match(unitRegex)) {
|
||||||
newContractsConfig.gas = getWeiBalanceFromString(newContractsConfig.gas, web3);
|
newContractsConfig.gas = getWeiBalanceFromString(newContractsConfig.gas);
|
||||||
}
|
}
|
||||||
|
|
||||||
newContractsConfig = prepareContractsConfig(newContractsConfig);
|
newContractsConfig = prepareContractsConfig(newContractsConfig);
|
||||||
|
@ -499,9 +501,7 @@ export class Config {
|
||||||
if (storageConfig && storageConfig.upload && storageConfig.upload.getUrl) {
|
if (storageConfig && storageConfig.upload && storageConfig.upload.getUrl) {
|
||||||
this.providerUrl = storageConfig.upload.getUrl;
|
this.providerUrl = storageConfig.upload.getUrl;
|
||||||
}
|
}
|
||||||
for (const contractName in contracts) {
|
for (const contract of Object.values(contracts) as any[]) {
|
||||||
const contract = contracts[contractName];
|
|
||||||
|
|
||||||
if (!contract.file) {
|
if (!contract.file) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -711,27 +711,28 @@ export class Config {
|
||||||
const readFiles: File[] = [];
|
const readFiles: File[] = [];
|
||||||
const storageConfig = self.storageConfig;
|
const storageConfig = self.storageConfig;
|
||||||
|
|
||||||
originalFiles.filter(function (file) {
|
originalFiles.filter(file => {
|
||||||
return (file[0] === '$' || file.indexOf('.') >= 0);
|
return (file[0] === '$' || file.indexOf('.') >= 0);
|
||||||
}).filter(function (file) {
|
}).filter(file => {
|
||||||
const basedir = findMatchingExpression(file, files);
|
const basedir = findMatchingExpression(file, files);
|
||||||
readFiles.push(new File({ path: file, originalPath: file, type: Types.dappFile, basedir, storageConfig }));
|
readFiles.push(new File({ path: file, originalPath: file, type: Types.dappFile, basedir, storageConfig }));
|
||||||
});
|
});
|
||||||
|
|
||||||
const filesFromPlugins: File[] = [];
|
type _File = File & { intendedPath?: string, file?: string };
|
||||||
|
const filesFromPlugins: _File[] = [];
|
||||||
const filePlugins = self.plugins.getPluginsFor('pipelineFiles');
|
const filePlugins = self.plugins.getPluginsFor('pipelineFiles');
|
||||||
filePlugins.forEach((plugin: Plugin) => {
|
filePlugins.forEach((plugin: Plugin) => {
|
||||||
try {
|
try {
|
||||||
const fileObjects = plugin.runFilePipeline();
|
const fileObjects = plugin.runFilePipeline();
|
||||||
for (let i = 0; i < fileObjects.length; i++) {
|
for (const fileObject of fileObjects) {
|
||||||
const fileObject = fileObjects[i];
|
|
||||||
filesFromPlugins.push(fileObject);
|
filesFromPlugins.push(fileObject);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
self.logger.error(err.message);
|
self.logger.error(err.message);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
filesFromPlugins.filter(function (file) {
|
|
||||||
|
filesFromPlugins.filter(file => {
|
||||||
if ((file.intendedPath && fileMatchesPattern(files, file.intendedPath)) || fileMatchesPattern(files, file.file)) {
|
if ((file.intendedPath && fileMatchesPattern(files, file.intendedPath)) || fileMatchesPattern(files, file.file)) {
|
||||||
readFiles.push(file);
|
readFiles.push(file);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
import {recursiveMerge} from "embark-utils";
|
import {recursiveMerge} from "embark-utils";
|
||||||
|
import { readJsonSync } from 'fs-extra';
|
||||||
|
import { join } from "path";
|
||||||
|
|
||||||
const constants = require('embark-core/constants');
|
const constants = readJsonSync(join(__dirname, '../constants.json'));
|
||||||
|
|
||||||
export function getBlockchainDefaults(env) {
|
export function getBlockchainDefaults(env) {
|
||||||
const defaults = {
|
const defaults = {
|
||||||
|
@ -45,7 +47,7 @@ export function getContractDefaults(embarkConfigVersions) {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
default: {
|
default: {
|
||||||
versions: versions,
|
versions,
|
||||||
dappConnection: [
|
dappConnection: [
|
||||||
"$WEB3",
|
"$WEB3",
|
||||||
"ws://localhost:8546",
|
"ws://localhost:8546",
|
||||||
|
|
|
@ -1,12 +1,139 @@
|
||||||
|
export type Callback<Tv> = (err?: Error | null, val?: Tv) => void;
|
||||||
|
|
||||||
|
export type Maybe<T> = false | 0 | undefined | null | T;
|
||||||
|
|
||||||
|
import { ABIDefinition } from 'web3/eth/abi';
|
||||||
|
|
||||||
|
export interface Contract {
|
||||||
|
abiDefinition: ABIDefinition[];
|
||||||
|
deployedAddress: string;
|
||||||
|
className: string;
|
||||||
|
silent?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ContractConfig {
|
||||||
|
address?: string;
|
||||||
|
args?: any[];
|
||||||
|
instanceOf?: string;
|
||||||
|
gas?: number;
|
||||||
|
gasPrice?: number;
|
||||||
|
silent?: boolean;
|
||||||
|
track?: boolean;
|
||||||
|
deploy?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Plugin {
|
||||||
|
dappGenerators: any;
|
||||||
|
name: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface EmbarkPlugins {
|
||||||
|
getPluginsFor(name: string): [Plugin];
|
||||||
|
loadInternalPlugin(name: string, options: any): void;
|
||||||
|
getPluginsProperty(pluginType: string, property: string, sub_property?: string): any[];
|
||||||
|
plugins: Plugin[];
|
||||||
|
runActionsForEvent(event: string, args: any, cb: Callback<any>): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CompilerPluginObject {
|
||||||
|
extension: string;
|
||||||
|
cb: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
type CommandCallback = (
|
||||||
|
opt1?: any,
|
||||||
|
opt2?: any,
|
||||||
|
opt3?: any,
|
||||||
|
opt4?: any,
|
||||||
|
opt5?: any,
|
||||||
|
opt6?: any,
|
||||||
|
opt7?: any,
|
||||||
|
opt8?: any,
|
||||||
|
opt9?: any,
|
||||||
|
opt10?: any,
|
||||||
|
opt11?: any,
|
||||||
|
opt12?: any,
|
||||||
|
) => any;
|
||||||
|
|
||||||
|
export interface EmbarkEvents {
|
||||||
|
on: any;
|
||||||
|
request: any;
|
||||||
|
request2: any;
|
||||||
|
emit: any;
|
||||||
|
once: any;
|
||||||
|
setCommandHandler(
|
||||||
|
name: string,
|
||||||
|
callback: CommandCallback,
|
||||||
|
): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface EmbarkConfig {
|
||||||
|
contractsFiles: any[];
|
||||||
|
embarkConfig: {
|
||||||
|
contracts: string[] | string;
|
||||||
|
config: {
|
||||||
|
contracts: string;
|
||||||
|
};
|
||||||
|
versions: {
|
||||||
|
solc: string;
|
||||||
|
};
|
||||||
|
generationDir: string;
|
||||||
|
};
|
||||||
|
blockchainConfig: {
|
||||||
|
endpoint: string;
|
||||||
|
accounts: any[];
|
||||||
|
proxy: boolean;
|
||||||
|
rpcPort: string | number;
|
||||||
|
wsPort: string | number;
|
||||||
|
rpcHost: string | number;
|
||||||
|
wsHost: string | number;
|
||||||
|
wsOrigins: string;
|
||||||
|
rpcCorsDomain: string;
|
||||||
|
wsRPC: boolean;
|
||||||
|
isDev: boolean;
|
||||||
|
client: string;
|
||||||
|
};
|
||||||
|
webServerConfig: {
|
||||||
|
certOptions: {
|
||||||
|
key: string;
|
||||||
|
cert: string;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
plugins: EmbarkPlugins;
|
||||||
|
reloadConfig(): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
type ActionCallback<T> = (params: any, cb: Callback<T>) => void;
|
||||||
|
|
||||||
|
import { Logger } from 'embark-logger';
|
||||||
|
|
||||||
|
export interface Embark {
|
||||||
|
env: string;
|
||||||
|
events: EmbarkEvents;
|
||||||
|
plugins: EmbarkPlugins;
|
||||||
|
registerAPICall(method: string, endpoint: string, cb: (...args: any[]) => void): void;
|
||||||
|
registerConsoleCommand: any;
|
||||||
|
logger: Logger;
|
||||||
|
fs: any;
|
||||||
|
config: EmbarkConfig;
|
||||||
|
currentContext: string[];
|
||||||
|
registerActionForEvent<T>(
|
||||||
|
name: string,
|
||||||
|
options?: ActionCallback<T> | { priority: number },
|
||||||
|
action?: ActionCallback<T>,
|
||||||
|
): void;
|
||||||
|
}
|
||||||
|
|
||||||
export { ProcessLauncher } from './processes/processLauncher';
|
export { ProcessLauncher } from './processes/processLauncher';
|
||||||
export { ProcessWrapper } from './processes/processWrapper';
|
export { ProcessWrapper } from './processes/processWrapper';
|
||||||
|
|
||||||
export { Config } from './config';
|
export { Config } from './config';
|
||||||
export { IPC } from './ipc';
|
export { IPC } from './ipc';
|
||||||
export { Engine } from './engine';
|
|
||||||
import { EmbarkEmitter as Events } from './events';
|
import { EmbarkEmitter as Events } from './events';
|
||||||
export { Events };
|
export { Events };
|
||||||
export { Plugins } from './plugins';
|
export { Plugins } from './plugins';
|
||||||
|
export { ProcessManager } from './processes/processManager';
|
||||||
|
export { ServicesMonitor } from './services_monitor';
|
||||||
export { TestLogger } from './utils/test_logger';
|
export { TestLogger } from './utils/test_logger';
|
||||||
export { TemplateGenerator } from './utils/template_generator';
|
export { TemplateGenerator } from './utils/template_generator';
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,12 @@ import { fileMatchesPattern } from './utils/utils';
|
||||||
import { __ } from 'embark-i18n';
|
import { __ } from 'embark-i18n';
|
||||||
import { dappPath, embarkPath, isEs6Module, joinPath } from 'embark-utils';
|
import { dappPath, embarkPath, isEs6Module, joinPath } from 'embark-utils';
|
||||||
import { Logger } from 'embark-logger';
|
import { Logger } from 'embark-logger';
|
||||||
const constants = require('embark-core/constants');
|
|
||||||
const fs = require('fs-extra');
|
|
||||||
const deepEqual = require('deep-equal');
|
const deepEqual = require('deep-equal');
|
||||||
|
import * as fs from 'fs-extra';
|
||||||
|
import { readFileSync, readJsonSync } from 'fs-extra';
|
||||||
|
import { join } from "path";
|
||||||
|
|
||||||
|
const constants = readJsonSync(join(__dirname, '../constants.json'));
|
||||||
|
|
||||||
// Default priority of actions with no specified priority. 1 => Highest
|
// Default priority of actions with no specified priority. 1 => Highest
|
||||||
const DEFAULT_ACTION_PRIORITY = 50;
|
const DEFAULT_ACTION_PRIORITY = 50;
|
||||||
|
@ -136,15 +139,7 @@ export class Plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
setUpLogger() {
|
setUpLogger() {
|
||||||
this.logger = {
|
this.logger = new Logger({});
|
||||||
log: this._log.bind(this, 'log'),
|
|
||||||
warn: this._log.bind(this, 'warn'),
|
|
||||||
error: this._log.bind(this, 'error'),
|
|
||||||
info: this._log.bind(this, 'info'),
|
|
||||||
debug: this._log.bind(this, 'debug'),
|
|
||||||
trace: this._log.bind(this, 'trace'),
|
|
||||||
dir: this._log.bind(this, 'dir')
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
isContextValid() {
|
isContextValid() {
|
||||||
|
@ -188,7 +183,7 @@ export class Plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
loadPluginFile(filename) {
|
loadPluginFile(filename) {
|
||||||
return fs.readFileSync(this.pathToFile(filename)).toString();
|
return readFileSync(this.pathToFile(filename)).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
pathToFile(filename) {
|
pathToFile(filename) {
|
||||||
|
@ -272,13 +267,13 @@ export class Plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
generateProvider(args) {
|
generateProvider(args) {
|
||||||
return this.clientWeb3Providers.map(function (cb) {
|
return this.clientWeb3Providers.map(function(cb) {
|
||||||
return cb.call(this, args);
|
return cb.call(this, args);
|
||||||
}).join("\n");
|
}).join("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
generateContracts(args) {
|
generateContracts(args) {
|
||||||
return this.contractsGenerators.map(function (cb) {
|
return this.contractsGenerators.map(function(cb) {
|
||||||
return cb.call(this, args);
|
return cb.call(this, args);
|
||||||
}).join("\n");
|
}).join("\n");
|
||||||
}
|
}
|
||||||
|
@ -351,7 +346,7 @@ export class Plugin {
|
||||||
|
|
||||||
runFilePipeline() {
|
runFilePipeline() {
|
||||||
return this.pipelineFiles.map(file => {
|
return this.pipelineFiles.map(file => {
|
||||||
let obj: any = {};
|
const obj: any = {};
|
||||||
obj.filename = file.file.replace('./', '');
|
obj.filename = file.file.replace('./', '');
|
||||||
obj.content = this.loadPluginFile(file.file).toString();
|
obj.content = this.loadPluginFile(file.file).toString();
|
||||||
obj.intendedPath = file.intendedPath;
|
obj.intendedPath = file.intendedPath;
|
||||||
|
@ -364,8 +359,8 @@ export class Plugin {
|
||||||
|
|
||||||
runPipeline(args) {
|
runPipeline(args) {
|
||||||
// TODO: should iterate the pipelines
|
// TODO: should iterate the pipelines
|
||||||
let pipeline = this.pipeline[0];
|
const pipeline = this.pipeline[0];
|
||||||
let shouldRunPipeline = fileMatchesPattern(pipeline.matcthingFiles, args.targetFile);
|
const shouldRunPipeline = fileMatchesPattern(pipeline.matcthingFiles, args.targetFile);
|
||||||
if (shouldRunPipeline) {
|
if (shouldRunPipeline) {
|
||||||
return pipeline.cb.call(this, args);
|
return pipeline.cb.call(this, args);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,8 @@ import { Config } from './config';
|
||||||
import * as async from 'async';
|
import * as async from 'async';
|
||||||
import { dappPath, embarkPath } from 'embark-utils';
|
import { dappPath, embarkPath } from 'embark-utils';
|
||||||
import { Logger } from 'embark-logger';
|
import { Logger } from 'embark-logger';
|
||||||
|
import findUp from 'find-up';
|
||||||
|
import { dirname } from 'path';
|
||||||
|
|
||||||
export class Plugins {
|
export class Plugins {
|
||||||
|
|
||||||
|
@ -90,7 +92,8 @@ export class Plugins {
|
||||||
}
|
}
|
||||||
|
|
||||||
loadInternalPlugin(pluginName, pluginConfig, isPackage?: boolean) {
|
loadInternalPlugin(pluginName, pluginConfig, isPackage?: boolean) {
|
||||||
let pluginPath, plugin;
|
let pluginPath;
|
||||||
|
let plugin;
|
||||||
if (isPackage) {
|
if (isPackage) {
|
||||||
pluginPath = pluginName;
|
pluginPath = pluginName;
|
||||||
plugin = require(pluginName);
|
plugin = require(pluginName);
|
||||||
|
@ -124,7 +127,9 @@ export class Plugins {
|
||||||
}
|
}
|
||||||
|
|
||||||
loadPlugin(pluginName, pluginConfig) {
|
loadPlugin(pluginName, pluginConfig) {
|
||||||
const pluginPath = dappPath('node_modules', pluginName);
|
const pluginPath = dirname(findUp.sync('package.json', {
|
||||||
|
cwd: dirname(require.resolve(pluginName, {paths: [dappPath()]}))
|
||||||
|
}) as string);
|
||||||
let plugin = require(pluginPath);
|
let plugin = require(pluginPath);
|
||||||
|
|
||||||
if (plugin.default) {
|
if (plugin.default) {
|
||||||
|
@ -151,13 +156,13 @@ export class Plugins {
|
||||||
}
|
}
|
||||||
|
|
||||||
getPluginsFor(pluginType) {
|
getPluginsFor(pluginType) {
|
||||||
return this.plugins.filter(function(plugin) {
|
return this.plugins.filter(plugin => {
|
||||||
return plugin.has(pluginType);
|
return plugin.has(pluginType);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getPluginsProperty(pluginType, property, sub_property?: any) {
|
getPluginsProperty(pluginType, property, sub_property?: any) {
|
||||||
const matchingPlugins = this.plugins.filter(function(plugin) {
|
const matchingPlugins = this.plugins.filter(plugin => {
|
||||||
return plugin.has(pluginType);
|
return plugin.has(pluginType);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -180,7 +185,7 @@ export class Plugins {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Remove empty properties
|
// Remove empty properties
|
||||||
matchingProperties = matchingProperties.filter((property) => property);
|
matchingProperties = matchingProperties.filter(prop => prop);
|
||||||
|
|
||||||
// return flattened list
|
// return flattened list
|
||||||
if (matchingProperties.length === 0) { return []; }
|
if (matchingProperties.length === 0) { return []; }
|
||||||
|
@ -188,7 +193,7 @@ export class Plugins {
|
||||||
}
|
}
|
||||||
|
|
||||||
getPluginsPropertyAndPluginName(pluginType, property, sub_property) {
|
getPluginsPropertyAndPluginName(pluginType, property, sub_property) {
|
||||||
const matchingPlugins = this.plugins.filter(function(plugin) {
|
const matchingPlugins = this.plugins.filter(plugin => {
|
||||||
return plugin.has(pluginType);
|
return plugin.has(pluginType);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -204,24 +209,21 @@ export class Plugins {
|
||||||
});
|
});
|
||||||
|
|
||||||
let matchingProperties: any[] = [];
|
let matchingProperties: any[] = [];
|
||||||
matchingPlugins.map((plugin) => {
|
matchingPlugins.forEach(plugin => {
|
||||||
if (sub_property) {
|
if (sub_property) {
|
||||||
const newList = [];
|
|
||||||
for (const kall of (plugin[property][sub_property] || [])) {
|
for (const kall of (plugin[property][sub_property] || [])) {
|
||||||
matchingProperties.push([kall, plugin.name]);
|
matchingProperties.push([kall, plugin.name]);
|
||||||
}
|
}
|
||||||
return newList;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const newList = [];
|
|
||||||
for (const kall of (plugin[property] || [])) {
|
for (const kall of (plugin[property] || [])) {
|
||||||
matchingProperties.push([kall, plugin.name]);
|
matchingProperties.push([kall, plugin.name]);
|
||||||
}
|
}
|
||||||
return newList;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Remove empty properties
|
// Remove empty properties
|
||||||
matchingProperties = matchingProperties.filter((property) => property[0]);
|
matchingProperties = matchingProperties.filter(prop => prop[0]);
|
||||||
|
|
||||||
// return flattened list
|
// return flattened list
|
||||||
if (matchingProperties.length === 0) { return []; }
|
if (matchingProperties.length === 0) { return []; }
|
||||||
|
@ -256,7 +258,7 @@ export class Plugins {
|
||||||
|
|
||||||
this.events.log("ACTION", eventName, "");
|
this.events.log("ACTION", eventName, "");
|
||||||
|
|
||||||
async.reduce(actionPlugins, args, function(current_args, pluginObj: any, nextEach) {
|
async.reduce(actionPlugins, args, (current_args, pluginObj: any, nextEach) => {
|
||||||
const [plugin, pluginName] = pluginObj;
|
const [plugin, pluginName] = pluginObj;
|
||||||
|
|
||||||
self.events.log("== ACTION FOR " + eventName, plugin.action.name, pluginName);
|
self.events.log("== ACTION FOR " + eventName, plugin.action.name, pluginName);
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
|
import { readJsonSync } from 'fs-extra';
|
||||||
|
import { join } from "path";
|
||||||
const uuid = require('uuid/v1');
|
const uuid = require('uuid/v1');
|
||||||
const constants = require('../../constants');
|
|
||||||
|
const constants = readJsonSync(join(__dirname, '../../constants.json'));
|
||||||
|
|
||||||
export class Events {
|
export class Events {
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
const child_process = require('child_process');
|
const child_process = require('child_process');
|
||||||
const constants = require('../../constants');
|
import { readJsonSync } from 'fs-extra';
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
|
const constants = readJsonSync(path.join(__dirname, '../../constants.json'));
|
||||||
|
|
||||||
let processCount = 1;
|
let processCount = 1;
|
||||||
export class ProcessLauncher {
|
export class ProcessLauncher {
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
|
import { readJsonSync } from 'fs-extra';
|
||||||
|
import { join } from "path";
|
||||||
import { Events } from './eventsWrapper';
|
import { Events } from './eventsWrapper';
|
||||||
const constants = require('../../constants');
|
|
||||||
|
const constants = readJsonSync(join(__dirname, '../../constants.json'));
|
||||||
|
|
||||||
export class ProcessWrapper {
|
export class ProcessWrapper {
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ export class ServicesMonitor {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.events.on('check:' + checkName, function(obj) {
|
self.events.on('check:' + checkName, obj => {
|
||||||
if (check && check.status === 'off' && obj.status === 'on') {
|
if (check && check.status === 'off' && obj.status === 'on') {
|
||||||
self.events.emit('check:backOnline:' + checkName);
|
self.events.emit('check:backOnline:' + checkName);
|
||||||
}
|
}
|
||||||
|
@ -53,14 +53,14 @@ export class ServicesMonitor {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (check.interval !== 0) {
|
if (check.interval !== 0) {
|
||||||
self.checkTimers[checkName] = setInterval(function() {
|
self.checkTimers[checkName] = setInterval(() => {
|
||||||
check.fn.call(check.fn, function(obj) {
|
check.fn.call(check.fn, obj => {
|
||||||
self.events.emit('check:' + checkName, obj);
|
self.events.emit('check:' + checkName, obj);
|
||||||
});
|
});
|
||||||
}, check.interval);
|
}, check.interval);
|
||||||
}
|
}
|
||||||
|
|
||||||
check.fn.call(check.fn, function(obj) {
|
check.fn.call(check.fn, obj => {
|
||||||
self.events.emit('check:' + checkName, obj);
|
self.events.emit('check:' + checkName, obj);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -87,7 +87,7 @@ export class ServicesMonitor {
|
||||||
this.logger.trace('startMonitor');
|
this.logger.trace('startMonitor');
|
||||||
|
|
||||||
const servicePlugins = this.plugins.getPluginsProperty('serviceChecks', 'serviceChecks');
|
const servicePlugins = this.plugins.getPluginsProperty('serviceChecks', 'serviceChecks');
|
||||||
servicePlugins.forEach(function(pluginCheck) {
|
servicePlugins.forEach(pluginCheck => {
|
||||||
self.addCheck(pluginCheck.checkName, pluginCheck.checkFn, pluginCheck.time);
|
self.addCheck(pluginCheck.checkName, pluginCheck.checkFn, pluginCheck.time);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,23 @@
|
||||||
{
|
{
|
||||||
"extends": "../../../tsconfig.json",
|
"compilerOptions": {
|
||||||
"include": ["src/**/*"]
|
"composite": true,
|
||||||
|
"declarationDir": "./dist",
|
||||||
|
"rootDir": "./src",
|
||||||
|
"tsBuildInfoFile": "./node_modules/.cache/tsc/tsconfig.embark-core.tsbuildinfo"
|
||||||
|
},
|
||||||
|
"extends": "../../../tsconfig.base.json",
|
||||||
|
"include": [
|
||||||
|
"src/**/*"
|
||||||
|
],
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"path": "../i18n"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../logger"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../utils"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
{
|
{
|
||||||
"extends": "../../../tslint.json"
|
"extends": "../../../tslint.json"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# `@types/embark`
|
# `embark-engine`
|
||||||
|
|
||||||
> TypeScript definitions for Embark
|
> Engine library for Embark
|
||||||
|
|
||||||
Visit [embark.status.im](https://embark.status.im/) to get started with
|
Visit [embark.status.im](https://embark.status.im/) to get started with
|
||||||
[Embark](https://github.com/embark-framework/embark).
|
[Embark](https://github.com/embark-framework/embark).
|
|
@ -0,0 +1,110 @@
|
||||||
|
{
|
||||||
|
"name": "embark-engine",
|
||||||
|
"version": "5.0.0-alpha.4",
|
||||||
|
"author": "Iuri Matias <iuri.matias@gmail.com>",
|
||||||
|
"contributors": [],
|
||||||
|
"description": "Engine library for Embark",
|
||||||
|
"homepage": "https://github.com/embark-framework/embark/tree/master/packages/core/engine#readme",
|
||||||
|
"bugs": "https://github.com/embark-framework/embark/issues",
|
||||||
|
"keywords": [
|
||||||
|
"blockchain",
|
||||||
|
"dapps",
|
||||||
|
"ethereum",
|
||||||
|
"ipfs",
|
||||||
|
"serverless",
|
||||||
|
"solc",
|
||||||
|
"solidity"
|
||||||
|
],
|
||||||
|
"files": [
|
||||||
|
"dist"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"repository": {
|
||||||
|
"directory": "packages/core/engine",
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/embark-framework/embark.git"
|
||||||
|
},
|
||||||
|
"main": "./dist/index.js",
|
||||||
|
"types": "./dist/index.d.ts",
|
||||||
|
"embark-collective": {
|
||||||
|
"build:node": true,
|
||||||
|
"typecheck": true
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"_build": "npm run solo -- build",
|
||||||
|
"_typecheck": "npm run solo -- typecheck",
|
||||||
|
"ci": "npm run qa",
|
||||||
|
"clean": "npm run reset",
|
||||||
|
"lint": "tslint -c tslint.json \"src/**/*.ts\"",
|
||||||
|
"qa": "npm-run-all lint _typecheck _build",
|
||||||
|
"reset": "npx rimraf dist embark-*.tgz package",
|
||||||
|
"solo": "embark-solo"
|
||||||
|
},
|
||||||
|
"eslintConfig": {
|
||||||
|
"extends": "../../../.eslintrc.json"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@babel/runtime-corejs3": "7.7.4",
|
||||||
|
"core-js": "3.4.3",
|
||||||
|
"embark-accounts-manager": "^5.0.0-alpha.4",
|
||||||
|
"embark-api": "^5.0.0-alpha.4",
|
||||||
|
"embark-authenticator": "^5.0.0-alpha.4",
|
||||||
|
"embark-basic-pipeline": "^5.0.0-alpha.4",
|
||||||
|
"embark-blockchain": "^5.0.0-alpha.4",
|
||||||
|
"embark-blockchain-client": "^5.0.0-alpha.2",
|
||||||
|
"embark-code-runner": "^5.0.0-alpha.4",
|
||||||
|
"embark-communication": "^5.0.0-alpha.4",
|
||||||
|
"embark-compiler": "^5.0.0-alpha.4",
|
||||||
|
"embark-console": "^5.0.0-alpha.4",
|
||||||
|
"embark-contracts-manager": "^5.0.0-alpha.4",
|
||||||
|
"embark-core": "^5.0.0-alpha.4",
|
||||||
|
"embark-coverage": "^5.0.0-alpha.4",
|
||||||
|
"embark-debugger": "^5.0.0-alpha.4",
|
||||||
|
"embark-deployment": "^5.0.0-alpha.4",
|
||||||
|
"embark-embarkjs": "^5.0.0-alpha.4",
|
||||||
|
"embark-ens": "^5.0.0-alpha.4",
|
||||||
|
"embark-ethereum-blockchain-client": "^5.0.0-alpha.4",
|
||||||
|
"embark-ganache": "^5.0.0-alpha.2",
|
||||||
|
"embark-geth": "^5.0.0-alpha.4",
|
||||||
|
"embark-ipfs": "^5.0.0-alpha.4",
|
||||||
|
"embark-library-manager": "^5.0.0-alpha.4",
|
||||||
|
"embark-logger": "^5.0.0-alpha.4",
|
||||||
|
"embark-mocha-tests": "^5.0.0-alpha.4",
|
||||||
|
"embark-namesystem": "^5.0.0-alpha.2",
|
||||||
|
"embark-parity": "^5.0.0-alpha.4",
|
||||||
|
"embark-pipeline": "^5.0.0-alpha.4",
|
||||||
|
"embark-plugin-cmd": "^5.0.0-alpha.4",
|
||||||
|
"embark-process-logs-api-manager": "^5.0.0-alpha.4",
|
||||||
|
"embark-profiler": "^5.0.0-alpha.2",
|
||||||
|
"embark-proxy": "^5.0.0-alpha.4",
|
||||||
|
"embark-rpc-manager": "^5.0.0-alpha.4",
|
||||||
|
"embark-scaffolding": "^5.0.0-alpha.2",
|
||||||
|
"embark-solidity": "^5.0.0-alpha.4",
|
||||||
|
"embark-solidity-tests": "^5.0.0-alpha.4",
|
||||||
|
"embark-specialconfigs": "^5.0.0-alpha.2",
|
||||||
|
"embark-storage": "^5.0.0-alpha.4",
|
||||||
|
"embark-swarm": "^5.0.0-alpha.4",
|
||||||
|
"embark-test-runner": "^5.0.0-alpha.4",
|
||||||
|
"embark-transaction-logger": "^5.0.0-alpha.4",
|
||||||
|
"embark-transaction-tracker": "^5.0.0-alpha.2",
|
||||||
|
"embark-utils": "^5.0.0-alpha.4",
|
||||||
|
"embark-vyper": "^5.0.0-alpha.2",
|
||||||
|
"embark-watcher": "^5.0.0-alpha.4",
|
||||||
|
"embark-web3": "^5.0.0-alpha.4",
|
||||||
|
"embark-webserver": "^5.0.0-alpha.4",
|
||||||
|
"embark-whisper-geth": "^5.0.0-alpha.4",
|
||||||
|
"embark-whisper-parity": "^5.0.0-alpha.4"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"embark-solo": "^5.0.0-alpha.2",
|
||||||
|
"npm-run-all": "4.1.5",
|
||||||
|
"rimraf": "3.0.0",
|
||||||
|
"tslint": "5.20.1",
|
||||||
|
"typescript": "3.7.2"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10.17.0 <12.0.0",
|
||||||
|
"npm": ">=6.11.3",
|
||||||
|
"yarn": ">=1.19.1"
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,10 +1,11 @@
|
||||||
import { Config } from './config';
|
import {
|
||||||
import { Plugins } from './plugins';
|
Config,
|
||||||
import { EmbarkEmitter as Events } from './events';
|
Events,
|
||||||
import { ProcessManager } from './processes/processManager';
|
IPC,
|
||||||
import { IPC } from './ipc';
|
Plugins,
|
||||||
import { ServicesMonitor } from './services_monitor';
|
ProcessManager,
|
||||||
|
ServicesMonitor
|
||||||
|
} from 'embark-core';
|
||||||
import { normalizeInput } from 'embark-utils';
|
import { normalizeInput } from 'embark-utils';
|
||||||
import { Logger } from 'embark-logger';
|
import { Logger } from 'embark-logger';
|
||||||
|
|
||||||
|
@ -67,6 +68,7 @@ export class Engine {
|
||||||
this.version = options.version;
|
this.version = options.version;
|
||||||
this.logFile = options.logFile;
|
this.logFile = options.logFile;
|
||||||
this.logLevel = options.logLevel;
|
this.logLevel = options.logLevel;
|
||||||
|
this.logger = options.logger;
|
||||||
this.events = options.events;
|
this.events = options.events;
|
||||||
this.context = options.context;
|
this.context = options.context;
|
||||||
this.useDashboard = options.useDashboard;
|
this.useDashboard = options.useDashboard;
|
||||||
|
@ -78,13 +80,13 @@ export class Engine {
|
||||||
}
|
}
|
||||||
|
|
||||||
init(_options, callback) {
|
init(_options, callback) {
|
||||||
callback = callback || function () { };
|
callback = callback || (() => {});
|
||||||
|
|
||||||
const options = _options || {};
|
const options = _options || {};
|
||||||
this.events = options.events || this.events || new Events();
|
this.events = options.events || this.events || new Events();
|
||||||
this.logger = options.logger || new Logger({ context: this.context, logLevel: options.logLevel || this.logLevel || 'info', events: this.events, logFile: this.logFile });
|
this.logger = this.logger || new Logger({context: this.context, logLevel: options.logLevel || this.logLevel || 'info', events: this.events, logFile: this.logFile});
|
||||||
this.config = new Config({ env: this.env, logger: this.logger, events: this.events, context: this.context, webServerConfig: this.webServerConfig, version: this.version, package: this.package });
|
this.config = new Config({env: this.env, logger: this.logger, events: this.events, context: this.context, webServerConfig: this.webServerConfig, version: this.version, package: this.package});
|
||||||
this.config.loadConfigFiles({ embarkConfig: this.embarkConfig, interceptLogs: this.interceptLogs });
|
this.config.loadConfigFiles({embarkConfig: this.embarkConfig, interceptLogs: this.interceptLogs});
|
||||||
this.plugins = this.config.plugins;
|
this.plugins = this.config.plugins;
|
||||||
this.isDev = this.config && this.config.blockchainConfig && (this.config.blockchainConfig.isDev || this.config.blockchainConfig.default);
|
this.isDev = this.config && this.config.blockchainConfig && (this.config.blockchainConfig.isDev || this.config.blockchainConfig.default);
|
||||||
|
|
||||||
|
@ -127,13 +129,13 @@ export class Engine {
|
||||||
|
|
||||||
registerModule(moduleName, options) {
|
registerModule(moduleName, options) {
|
||||||
if (this.plugins) {
|
if (this.plugins) {
|
||||||
this.plugins.loadInternalPlugin(moduleName, options || {});
|
this.plugins.loadInternalPlugin(require.resolve(moduleName), options || {});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
registerModulePackage(moduleName, options?: any) {
|
registerModulePackage(moduleName, options?: any) {
|
||||||
if (this.plugins) {
|
if (this.plugins) {
|
||||||
return this.plugins.loadInternalPlugin(moduleName, options || {}, true);
|
return this.plugins.loadInternalPlugin(require.resolve(moduleName), options || {}, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,7 +206,7 @@ export class Engine {
|
||||||
if (this.plugins) {
|
if (this.plugins) {
|
||||||
const plugin = this.plugins.createPlugin('coreservicesplugin', {});
|
const plugin = this.plugins.createPlugin('coreservicesplugin', {});
|
||||||
plugin.registerActionForEvent("embark:engine:started", (_params, cb) => {
|
plugin.registerActionForEvent("embark:engine:started", (_params, cb) => {
|
||||||
this.servicesMonitor && this.servicesMonitor.startMonitor();
|
if (this.servicesMonitor) { this.servicesMonitor.startMonitor(); }
|
||||||
cb();
|
cb();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -321,23 +323,23 @@ function interceptLogs(consoleContext, logger) {
|
||||||
const context: any = {};
|
const context: any = {};
|
||||||
context.console = consoleContext;
|
context.console = consoleContext;
|
||||||
|
|
||||||
context.console.log = function () {
|
context.console.log = () => {
|
||||||
logger.info(normalizeInput(arguments));
|
logger.info(normalizeInput(arguments));
|
||||||
};
|
};
|
||||||
context.console.warn = function () {
|
context.console.warn = () => {
|
||||||
logger.warn(normalizeInput(arguments));
|
logger.warn(normalizeInput(arguments));
|
||||||
};
|
};
|
||||||
context.console.info = function () {
|
context.console.info = () => {
|
||||||
logger.info(normalizeInput(arguments));
|
logger.info(normalizeInput(arguments));
|
||||||
};
|
};
|
||||||
context.console.debug = function () {
|
context.console.debug = () => {
|
||||||
// TODO: ue JSON.stringify
|
// TODO: ue JSON.stringify
|
||||||
logger.debug(normalizeInput(arguments));
|
logger.debug(normalizeInput(arguments));
|
||||||
};
|
};
|
||||||
context.console.trace = function () {
|
context.console.trace = () => {
|
||||||
logger.trace(normalizeInput(arguments));
|
logger.trace(normalizeInput(arguments));
|
||||||
};
|
};
|
||||||
context.console.dir = function () {
|
context.console.dir = () => {
|
||||||
logger.dir(normalizeInput(arguments));
|
logger.dir(normalizeInput(arguments));
|
||||||
};
|
};
|
||||||
}
|
}
|
|
@ -0,0 +1,158 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"composite": true,
|
||||||
|
"declarationDir": "./dist",
|
||||||
|
"rootDir": "./src",
|
||||||
|
"tsBuildInfoFile": "./node_modules/.cache/tsc/tsconfig.embark-engine.tsbuildinfo"
|
||||||
|
},
|
||||||
|
"extends": "../../../tsconfig.base.json",
|
||||||
|
"include": [
|
||||||
|
"src/**/*"
|
||||||
|
],
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"path": "../../plugins/accounts-manager"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../../plugins/basic-pipeline"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../../plugins/coverage"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../../plugins/debugger"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../../plugins/ens"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../../plugins/ethereum-blockchain-client"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../../plugins/ganache"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../../plugins/geth"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../../plugins/ipfs"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../../plugins/mocha-tests"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../../plugins/parity"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../../plugins/plugin-cmd"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../../plugins/profiler"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../../plugins/rpc-manager"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../../plugins/scaffolding"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../../plugins/solidity"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../../plugins/solidity-tests"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../../plugins/specialconfigs"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../../plugins/swarm"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../../plugins/transaction-logger"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../../plugins/transaction-tracker"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../../plugins/vyper"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../../plugins/web3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../../plugins/whisper-geth"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../../plugins/whisper-parity"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../../stack/api"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../../stack/authenticator"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../../stack/blockchain"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../../stack/blockchain-client"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../../stack/communication"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../../stack/compiler"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../../stack/contracts-manager"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../../stack/deployment"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../../stack/embarkjs"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../../stack/library-manager"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../../stack/namesystem"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../../stack/pipeline"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../../stack/process-logs-api-manager"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../../stack/proxy"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../../stack/storage"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../../stack/test-runner"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../../stack/watcher"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../../stack/webserver"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../code-runner"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../console"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../core"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../logger"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../utils"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -1,14 +0,0 @@
|
||||||
import { Maybe } from 'embark';
|
|
||||||
import * as i18n from 'i18n';
|
|
||||||
|
|
||||||
declare module 'embark-i18n' {
|
|
||||||
function setOrDetectLocale(locale: Maybe<string>): void;
|
|
||||||
function __(
|
|
||||||
phraseOrOptions: string | i18n.TranslateOptions,
|
|
||||||
...replace: string[]
|
|
||||||
): string;
|
|
||||||
function __(
|
|
||||||
phraseOrOptions: string | i18n.TranslateOptions,
|
|
||||||
replacements: i18n.Replacements
|
|
||||||
): string;
|
|
||||||
}
|
|
|
@ -26,36 +26,36 @@
|
||||||
"url": "https://github.com/embark-framework/embark.git"
|
"url": "https://github.com/embark-framework/embark.git"
|
||||||
},
|
},
|
||||||
"main": "./dist/index.js",
|
"main": "./dist/index.js",
|
||||||
|
"types": "./dist/index.d.ts",
|
||||||
"embark-collective": {
|
"embark-collective": {
|
||||||
"build:node": true
|
"build:node": true,
|
||||||
|
"typecheck": true
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"_build": "npm run solo -- build",
|
"_build": "npm run solo -- build",
|
||||||
|
"_typecheck": "npm run solo -- typecheck",
|
||||||
"ci": "npm run qa",
|
"ci": "npm run qa",
|
||||||
"clean": "npm run reset",
|
"clean": "npm run reset",
|
||||||
"lint": "npm-run-all lint:*",
|
"lint": "npm-run-all lint:*",
|
||||||
"lint:ts": "tslint -c tslint.json \"src/**/*.ts\"",
|
"lint:ts": "tslint -c tslint.json \"src/**/*.ts\"",
|
||||||
"qa": "npm-run-all lint typecheck _build",
|
"qa": "npm-run-all lint _typecheck _build",
|
||||||
"reset": "npx rimraf dist embark-*.tgz package",
|
"reset": "npx rimraf dist embark-*.tgz package",
|
||||||
"solo": "embark-solo",
|
"solo": "embark-solo"
|
||||||
"typecheck": "tsc",
|
|
||||||
"watch": "run-p watch:*",
|
|
||||||
"watch:typecheck": "npm run typecheck -- --preserveWatchOutput --watch"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime-corejs3": "7.7.4",
|
"@babel/runtime-corejs3": "7.7.4",
|
||||||
|
"@types/i18n": "0.8.3",
|
||||||
"colors": "1.3.2",
|
"colors": "1.3.2",
|
||||||
"core-js": "3.4.3",
|
"core-js": "3.4.3",
|
||||||
"i18n": "0.8.3",
|
"i18n": "0.8.3",
|
||||||
"os-locale": "4.0.0"
|
"os-locale": "4.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/i18n": "0.8.3",
|
|
||||||
"embark-solo": "^5.0.0-alpha.2",
|
"embark-solo": "^5.0.0-alpha.2",
|
||||||
"npm-run-all": "4.1.5",
|
"npm-run-all": "4.1.5",
|
||||||
"rimraf": "3.0.0",
|
"rimraf": "3.0.0",
|
||||||
"tslint": "5.16.0",
|
"tslint": "5.20.1",
|
||||||
"typescript": "3.6.3"
|
"typescript": "3.7.2"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=10.17.0 <12.0.0",
|
"node": ">=10.17.0 <12.0.0",
|
||||||
|
|
|
@ -3,7 +3,7 @@ import * as i18n from 'i18n';
|
||||||
import * as osLocale from 'os-locale';
|
import * as osLocale from 'os-locale';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
|
||||||
import { Maybe } /* supplied by @types/embark in packages/embark-typings */ from 'embark';
|
type Maybe<T> = false | 0 | undefined | null | T;
|
||||||
|
|
||||||
enum LocalType {
|
enum LocalType {
|
||||||
Specified = 'specified',
|
Specified = 'specified',
|
||||||
|
@ -49,4 +49,4 @@ export const setOrDetectLocale = (locale: Maybe<string>) => {
|
||||||
|
|
||||||
i18n.setLocale(DEFAULT_LANGUAGE);
|
i18n.setLocale(DEFAULT_LANGUAGE);
|
||||||
|
|
||||||
export const __ = i18nEmbark.__;
|
export const __ = (i18nEmbark.__ as unknown) as i18nAPI["__"];
|
||||||
|
|
|
@ -1,4 +1,12 @@
|
||||||
{
|
{
|
||||||
"extends": "../../../tsconfig.json",
|
"compilerOptions": {
|
||||||
"include": ["src/**/*"]
|
"composite": true,
|
||||||
|
"declarationDir": "./dist",
|
||||||
|
"rootDir": "./src",
|
||||||
|
"tsBuildInfoFile": "./node_modules/.cache/tsc/tsconfig.embark-i18n.tsbuildinfo"
|
||||||
|
},
|
||||||
|
"extends": "../../../tsconfig.base.json",
|
||||||
|
"include": [
|
||||||
|
"src/**/*"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,15 +25,18 @@
|
||||||
"url": "https://github.com/embark-framework/embark.git"
|
"url": "https://github.com/embark-framework/embark.git"
|
||||||
},
|
},
|
||||||
"main": "./dist/index.js",
|
"main": "./dist/index.js",
|
||||||
|
"types": "./dist/index.d.ts",
|
||||||
"embark-collective": {
|
"embark-collective": {
|
||||||
"build:node": true
|
"build:node": true,
|
||||||
|
"typecheck": true
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"_build": "npm run solo -- build",
|
"_build": "npm run solo -- build",
|
||||||
|
"_typecheck": "npm run solo -- typecheck",
|
||||||
"ci": "npm run qa",
|
"ci": "npm run qa",
|
||||||
"clean": "npm run reset",
|
"clean": "npm run reset",
|
||||||
"lint": "eslint src/",
|
"lint": "eslint src/",
|
||||||
"qa": "npm-run-all lint _build",
|
"qa": "npm-run-all lint _typecheck _build",
|
||||||
"reset": "npx rimraf dist embark-*.tgz package",
|
"reset": "npx rimraf dist embark-*.tgz package",
|
||||||
"solo": "embark-solo"
|
"solo": "embark-solo"
|
||||||
},
|
},
|
||||||
|
@ -44,8 +47,7 @@
|
||||||
"@babel/runtime-corejs3": "7.7.4",
|
"@babel/runtime-corejs3": "7.7.4",
|
||||||
"colors": "1.3.2",
|
"colors": "1.3.2",
|
||||||
"core-js": "3.4.3",
|
"core-js": "3.4.3",
|
||||||
"date-and-time": "0.6.2",
|
"date-and-time": "0.6.2"
|
||||||
"embark-utils": "^5.0.0-alpha.4"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"embark-solo": "^5.0.0-alpha.2",
|
"embark-solo": "^5.0.0-alpha.2",
|
||||||
|
|
|
@ -1,16 +1,24 @@
|
||||||
require('colors');
|
require('colors');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const date = require('date-and-time');
|
const date = require('date-and-time');
|
||||||
const { escapeHtml } = require('embark-utils');
|
const { escapeHtml } = require('./utils');
|
||||||
const util = require('util');
|
const util = require('util');
|
||||||
|
|
||||||
const DATE_FORMAT = 'YYYY-MM-DD HH:mm:ss:SSS';
|
const DATE_FORMAT = 'YYYY-MM-DD HH:mm:ss:SSS';
|
||||||
const LOG_REGEX = new RegExp(/\[(\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d:\d\d\d)\] (?:\[(\w*)\]:?)?\s?\s?(.*)/gmi);
|
const LOG_REGEX = new RegExp(/\[(\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d:\d\d\d)\] (?:\[(\w*)\]:?)?\s?\s?(.*)/gmi);
|
||||||
|
|
||||||
|
export const LogLevels = {
|
||||||
|
error: 'error',
|
||||||
|
warn: 'warn',
|
||||||
|
info: 'info',
|
||||||
|
debug: 'debug',
|
||||||
|
trace: 'trace'
|
||||||
|
};
|
||||||
|
|
||||||
export class Logger {
|
export class Logger {
|
||||||
constructor(options) {
|
constructor(options) {
|
||||||
this.events = options.events || {emit: function(){}};
|
this.events = options.events || {emit: function(){}};
|
||||||
this.logLevels = Object.keys(Logger.logLevels);
|
this.logLevels = Object.keys(LogLevels);
|
||||||
this.logLevel = options.logLevel || 'info';
|
this.logLevel = options.logLevel || 'info';
|
||||||
this._logFunction = options.logFunction || console.log;
|
this._logFunction = options.logFunction || console.log;
|
||||||
this.logFunction = function() {
|
this.logFunction = function() {
|
||||||
|
@ -67,14 +75,6 @@ export class Logger {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.logLevels = {
|
|
||||||
error: 'error',
|
|
||||||
warn: 'warn',
|
|
||||||
info: 'info',
|
|
||||||
debug: 'debug',
|
|
||||||
trace: 'trace'
|
|
||||||
};
|
|
||||||
|
|
||||||
Logger.prototype.registerAPICall = function (plugins) {
|
Logger.prototype.registerAPICall = function (plugins) {
|
||||||
const self = this;
|
const self = this;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
exports.escapeHtml = function(message) {
|
||||||
|
if(typeof message !== "string") return message;
|
||||||
|
|
||||||
|
return message
|
||||||
|
.replace(/&/g, "&")
|
||||||
|
.replace(/</g, "<")
|
||||||
|
.replace(/>/g, ">")
|
||||||
|
.replace(/\"/g, """)
|
||||||
|
.replace(/\'/g, "'");
|
||||||
|
};
|
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"composite": true,
|
||||||
|
"declarationDir": "./dist",
|
||||||
|
"rootDir": "./src",
|
||||||
|
"tsBuildInfoFile": "./node_modules/.cache/tsc/tsconfig.embark-logger.tsbuildinfo"
|
||||||
|
},
|
||||||
|
"extends": "../../../tsconfig.base.json",
|
||||||
|
"include": [
|
||||||
|
"src/**/*"
|
||||||
|
]
|
||||||
|
}
|
|
@ -2,4 +2,4 @@
|
||||||
|
|
||||||
/* global module require */
|
/* global module require */
|
||||||
|
|
||||||
require('./').reset();
|
require('./src').reset();
|
||||||
|
|
|
@ -13,19 +13,30 @@
|
||||||
"url": "https://github.com/embark-framework/embark.git"
|
"url": "https://github.com/embark-framework/embark.git"
|
||||||
},
|
},
|
||||||
"bin": "./bin.js",
|
"bin": "./bin.js",
|
||||||
"main": "index.js",
|
"main": "./src/index.js",
|
||||||
|
"types": "./dist/index.d.ts",
|
||||||
"files": [
|
"files": [
|
||||||
"bin.js"
|
"bin.js",
|
||||||
|
"dist",
|
||||||
|
"src"
|
||||||
],
|
],
|
||||||
"embark-collective": {},
|
"embark-collective": {
|
||||||
|
"typecheck": true
|
||||||
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"_typecheck": "npm run solo -- typecheck",
|
||||||
|
"ci": "npm run qa",
|
||||||
|
"clean": "npm run reset",
|
||||||
|
"qa": "npm-run-all _typecheck",
|
||||||
|
"reset": "npx rimraf dist embark-*.tgz package",
|
||||||
"solo": "embark-solo"
|
"solo": "embark-solo"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"rimraf": "3.0.0"
|
"rimraf": "3.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"embark-solo": "^5.0.0-alpha.2"
|
"embark-solo": "^5.0.0-alpha.2",
|
||||||
|
"npm-run-all": "4.1.5"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=10.17.0 <12.0.0",
|
"node": ">=10.17.0 <12.0.0",
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"composite": true,
|
||||||
|
"declarationDir": "./dist",
|
||||||
|
"rootDir": "./src",
|
||||||
|
"tsBuildInfoFile": "./node_modules/.cache/tsc/tsconfig.embark-reset.tsbuildinfo"
|
||||||
|
},
|
||||||
|
"extends": "../../../tsconfig.base.json",
|
||||||
|
"include": [
|
||||||
|
"src/**/*"
|
||||||
|
]
|
||||||
|
}
|
|
@ -1 +0,0 @@
|
||||||
types-embark-*.tgz
|
|
|
@ -1,144 +0,0 @@
|
||||||
# Change Log
|
|
||||||
|
|
||||||
All notable changes to this project will be documented in this file.
|
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
||||||
|
|
||||||
# [5.0.0-alpha.2](https://github.com/embark-framework/embark/compare/v5.0.0-alpha.1...v5.0.0-alpha.2) (2019-12-05)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **@embark/core:** ensure type declaration for Plugin.registerActionForEvent() is legit ([5dc4b21](https://github.com/embark-framework/embark/commit/5dc4b21)), closes [/github.com/embark-framework/embark/commit/776db1b7f71e9a78f216cf2acc6c1387c60b3604#diff-5cab125016e6d753f03b6cd0241d5ebbR267](https://github.com//github.com/embark-framework/embark/commit/776db1b7f71e9a78f216cf2acc6c1387c60b3604/issues/diff-5cab125016e6d753f03b6cd0241d5ebbR267)
|
|
||||||
* **@embark/proxy:** Fix unsubsribe handling and add new provider ([f6f4507](https://github.com/embark-framework/embark/commit/f6f4507))
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* **@embark/embark-rpc-manager:** Add support for `eth_signTypedData_v3` ([c7ec49a](https://github.com/embark-framework/embark/commit/c7ec49a)), closes [#1850](https://github.com/embark-framework/embark/issues/1850) [#1850](https://github.com/embark-framework/embark/issues/1850)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [5.0.0-alpha.1](https://github.com/embark-framework/embark/compare/v5.0.0-alpha.0...v5.0.0-alpha.1) (2019-11-05)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **@embark/proxy:** Fix contract event subscriptions ([f9ad486](https://github.com/embark-framework/embark/commit/f9ad486))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [5.0.0-alpha.0](https://github.com/embark-framework/embark/compare/v4.1.1...v5.0.0-alpha.0) (2019-10-28)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **@embark/proxy:** Fix contract event subscriptions ([173d53d](https://github.com/embark-framework/embark/commit/173d53d))
|
|
||||||
|
|
||||||
|
|
||||||
### Build System
|
|
||||||
|
|
||||||
* bump all packages' engines settings ([#1985](https://github.com/embark-framework/embark/issues/1985)) ([ed02cc8](https://github.com/embark-framework/embark/commit/ed02cc8))
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* **@embark/compiler:** support :before and :after hooks on event compiler:contracts:compile ([#1878](https://github.com/embark-framework/embark/issues/1878)) ([043ccc0](https://github.com/embark-framework/embark/commit/043ccc0))
|
|
||||||
|
|
||||||
|
|
||||||
### BREAKING CHANGES
|
|
||||||
|
|
||||||
* node: >=10.17.0 <12.0.0
|
|
||||||
npm: >=6.11.3
|
|
||||||
yarn: >=1.19.1
|
|
||||||
|
|
||||||
node v10.17.0 is the latest in the 10.x series and is still in the Active LTS
|
|
||||||
lifecycle. Embark is still not compatible with node's 12.x and 13.x
|
|
||||||
series (because of some dependencies), otherwise it would probably make sense
|
|
||||||
to bump our minimum supported node version all the way to the most recent 12.x
|
|
||||||
release.
|
|
||||||
|
|
||||||
npm v6.11.3 is the version that's bundled with node v10.17.0.
|
|
||||||
|
|
||||||
yarn v1.19.1 is the most recent version as of the time node v10.17.0 was
|
|
||||||
released.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [4.1.0](https://github.com/embark-framework/embark/compare/v4.1.0-beta.6...v4.1.0) (2019-08-12)
|
|
||||||
|
|
||||||
**Note:** Version bump only for package @types/embark
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [4.1.0-beta.5](https://github.com/embark-framework/embark/compare/v4.1.0-beta.4...v4.1.0-beta.5) (2019-07-10)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **@embark/code-runner:** restore EmbarkJS.environment property in the cli dashboard ([7d27125](https://github.com/embark-framework/embark/commit/7d27125))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [4.1.0-beta.4](https://github.com/embark-framework/embark/compare/v4.1.0-beta.3...v4.1.0-beta.4) (2019-06-27)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **@embark/coverage:** function types and single statement ifs ([2ce9ca6](https://github.com/embark-framework/embark/commit/2ce9ca6))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [4.1.0-beta.3](https://github.com/embark-framework/embark/compare/v4.1.0-beta.2...v4.1.0-beta.3) (2019-06-07)
|
|
||||||
|
|
||||||
**Note:** Version bump only for package @types/embark
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [4.1.0-beta.1](https://github.com/embark-framework/embark/compare/v4.1.0-beta.0...v4.1.0-beta.1) (2019-05-15)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* **@embark/api:** Add command `service api on/off` ([634feb5](https://github.com/embark-framework/embark/commit/634feb5))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [4.0.0](https://github.com/embark-framework/embark/compare/v4.0.0-beta.2...v4.0.0) (2019-03-18)
|
|
||||||
|
|
||||||
**Note:** Version bump only for package @types/embark
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [4.0.0-beta.1](https://github.com/embark-framework/embark/compare/v4.0.0-beta.0...v4.0.0-beta.1) (2019-03-18)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **@embark/cockpit:** Fix cockpit not suggesting console commands ([0eaad43](https://github.com/embark-framework/embark/commit/0eaad43))
|
|
||||||
* **console:** fix ENS tests not working with embark side by side ([e20c08a](https://github.com/embark-framework/embark/commit/e20c08a))
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* **@embark/core:** Auto generate EmbarkJS events ([d378ccf](https://github.com/embark-framework/embark/commit/d378ccf))
|
|
||||||
* **test/reporter:** log tx functions during tests ([87d92b6](https://github.com/embark-framework/embark/commit/87d92b6))
|
|
||||||
* add repository.directory field to package.json ([a9c5e1a](https://github.com/embark-framework/embark/commit/a9c5e1a))
|
|
||||||
* normalize README and package.json bugs, homepage, description ([5418f16](https://github.com/embark-framework/embark/commit/5418f16))
|
|
|
@ -1,12 +0,0 @@
|
||||||
import './src/omg-js-util';
|
|
||||||
import './src/prettier-plugin-solidity';
|
|
||||||
import './src/remix-debug-debugtest';
|
|
||||||
|
|
||||||
export * from './src/callbacks';
|
|
||||||
export * from './src/contract';
|
|
||||||
export * from './src/embark';
|
|
||||||
export * from './src/contractsConfig';
|
|
||||||
export * from './src/embarkConfig';
|
|
||||||
export * from './src/logger';
|
|
||||||
export * from './src/maybe';
|
|
||||||
export * from './src/plugins';
|
|
|
@ -1,33 +0,0 @@
|
||||||
{
|
|
||||||
"name": "@types/embark",
|
|
||||||
"private": true,
|
|
||||||
"version": "5.0.0-alpha.2",
|
|
||||||
"author": "Iuri Matias <iuri.matias@gmail.com>",
|
|
||||||
"contributors": [],
|
|
||||||
"description": "TypeScript definitions for Embark",
|
|
||||||
"license": "MIT",
|
|
||||||
"main": "",
|
|
||||||
"types": "index",
|
|
||||||
"embark-collective": {},
|
|
||||||
"scripts": {
|
|
||||||
"ci": "npm run qa",
|
|
||||||
"lint": "tslint -c tslint.json index.d.ts \"src/**/*.ts\"",
|
|
||||||
"qa": "npm-run-all lint typecheck",
|
|
||||||
"solo": "embark-solo",
|
|
||||||
"typecheck": "tsc",
|
|
||||||
"watch": "run-p watch:*",
|
|
||||||
"watch:typecheck": "npm run typecheck -- --preserveWatchOutput --watch"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@types/web3": "1.0.12",
|
|
||||||
"embark-solo": "^5.0.0-alpha.2",
|
|
||||||
"npm-run-all": "4.1.5",
|
|
||||||
"tslint": "5.16.0",
|
|
||||||
"typescript": "3.6.3"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=10.17.0 <12.0.0",
|
|
||||||
"npm": ">=6.11.3",
|
|
||||||
"yarn": ">=1.19.1"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1 +0,0 @@
|
||||||
export type Callback<Tv> = (err?: Error | null, val?: Tv) => void;
|
|
|
@ -1,8 +0,0 @@
|
||||||
import { ABIDefinition } from 'web3/eth/abi';
|
|
||||||
|
|
||||||
export interface Contract {
|
|
||||||
abiDefinition: ABIDefinition[];
|
|
||||||
deployedAddress: string;
|
|
||||||
className: string;
|
|
||||||
silent?: boolean;
|
|
||||||
}
|
|
|
@ -1,16 +0,0 @@
|
||||||
export interface ContractsConfig {
|
|
||||||
deploy: { [name: string]: ContractConfig };
|
|
||||||
gas: string | number;
|
|
||||||
tracking: boolean | string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ContractConfig {
|
|
||||||
address?: string;
|
|
||||||
args?: any[];
|
|
||||||
instanceOf?: string;
|
|
||||||
gas?: number;
|
|
||||||
gasPrice?: number;
|
|
||||||
silent?: boolean;
|
|
||||||
track?: boolean;
|
|
||||||
deploy?: boolean;
|
|
||||||
}
|
|
|
@ -1,85 +0,0 @@
|
||||||
import { Logger } from './logger';
|
|
||||||
import { Plugins } from './plugins';
|
|
||||||
import { Callback } from './callbacks';
|
|
||||||
|
|
||||||
type CommandCallback = (
|
|
||||||
opt1?: any,
|
|
||||||
opt2?: any,
|
|
||||||
opt3?: any,
|
|
||||||
opt4?: any,
|
|
||||||
opt5?: any,
|
|
||||||
opt6?: any,
|
|
||||||
opt7?: any,
|
|
||||||
opt8?: any,
|
|
||||||
opt9?: any,
|
|
||||||
opt10?: any,
|
|
||||||
opt11?: any,
|
|
||||||
opt12?: any,
|
|
||||||
) => any;
|
|
||||||
|
|
||||||
export interface Events {
|
|
||||||
on: any;
|
|
||||||
request: any;
|
|
||||||
request2: any;
|
|
||||||
emit: any;
|
|
||||||
once: any;
|
|
||||||
setCommandHandler(
|
|
||||||
name: string,
|
|
||||||
callback: CommandCallback,
|
|
||||||
): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Config {
|
|
||||||
contractsFiles: any[];
|
|
||||||
embarkConfig: {
|
|
||||||
contracts: string[] | string;
|
|
||||||
config: {
|
|
||||||
contracts: string;
|
|
||||||
};
|
|
||||||
versions: {
|
|
||||||
solc: string;
|
|
||||||
};
|
|
||||||
generationDir: string;
|
|
||||||
};
|
|
||||||
blockchainConfig: {
|
|
||||||
endpoint: string;
|
|
||||||
accounts: any[];
|
|
||||||
proxy: boolean;
|
|
||||||
rpcPort: string | number;
|
|
||||||
wsPort: string | number;
|
|
||||||
rpcHost: string | number;
|
|
||||||
wsHost: string | number;
|
|
||||||
wsOrigins: string;
|
|
||||||
rpcCorsDomain: string;
|
|
||||||
wsRPC: boolean;
|
|
||||||
isDev: boolean;
|
|
||||||
client: string;
|
|
||||||
};
|
|
||||||
webServerConfig: {
|
|
||||||
certOptions: {
|
|
||||||
key: string;
|
|
||||||
cert: string;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
plugins: Plugins;
|
|
||||||
reloadConfig(): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
type ActionCallback<T> = (params: any, cb: Callback<T>) => void;
|
|
||||||
|
|
||||||
export interface Embark {
|
|
||||||
env: string;
|
|
||||||
events: Events;
|
|
||||||
plugins: Plugins;
|
|
||||||
registerAPICall(method: string, endpoint: string, cb: (...args: any[]) => void): void;
|
|
||||||
registerConsoleCommand: any;
|
|
||||||
logger: Logger;
|
|
||||||
fs: any;
|
|
||||||
config: Config;
|
|
||||||
currentContext: string[];
|
|
||||||
registerActionForEvent<T>(
|
|
||||||
name: string,
|
|
||||||
options?: ActionCallback<T> | { priority: number },
|
|
||||||
action?: ActionCallback<T>,
|
|
||||||
): void;
|
|
||||||
}
|
|
|
@ -1,3 +0,0 @@
|
||||||
export interface EmbarkConfig {
|
|
||||||
contracts: [string];
|
|
||||||
}
|
|
|
@ -1,7 +0,0 @@
|
||||||
export interface Logger {
|
|
||||||
info(text: string): void;
|
|
||||||
warn(text: string): void;
|
|
||||||
debug(text: string): void;
|
|
||||||
trace(text: string): void;
|
|
||||||
error(text: string, ...args: Array<string | Error>): void;
|
|
||||||
}
|
|
|
@ -1 +0,0 @@
|
||||||
export type Maybe<T> = false | 0 | undefined | null | T;
|
|
|
@ -1 +0,0 @@
|
||||||
declare module '@omisego/omg-js-util';
|
|
|
@ -1,22 +0,0 @@
|
||||||
import {Callback} from './callbacks';
|
|
||||||
|
|
||||||
export interface Plugin {
|
|
||||||
dappGenerators: any;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Plugins {
|
|
||||||
getPluginsFor(name: string): [Plugin];
|
|
||||||
loadInternalPlugin(name: string, options: any): void;
|
|
||||||
getPluginsProperty(pluginType: string, property: string, sub_property?: string): any[];
|
|
||||||
plugins: Plugin[];
|
|
||||||
runActionsForEvent(event: string, args: any, cb: Callback<any>): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Plugin {
|
|
||||||
name: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface CompilerPluginObject {
|
|
||||||
extension: string;
|
|
||||||
cb: any;
|
|
||||||
}
|
|
|
@ -1 +0,0 @@
|
||||||
declare module 'prettier-plugin-solidity';
|
|
|
@ -1 +0,0 @@
|
||||||
declare module 'remix-debug-debugtest';
|
|
|
@ -1,7 +0,0 @@
|
||||||
{
|
|
||||||
"extends": "../../../tsconfig.json",
|
|
||||||
"files": [
|
|
||||||
"index.d.ts"
|
|
||||||
],
|
|
||||||
"include": ["src/**/*"]
|
|
||||||
}
|
|
|
@ -1,42 +0,0 @@
|
||||||
declare module "embark-utils" {
|
|
||||||
import {Logger} from "embark";
|
|
||||||
|
|
||||||
export class File {
|
|
||||||
public path: string;
|
|
||||||
constructor(options: any);
|
|
||||||
public prepareForCompilation(isCoverage?: boolean): any;
|
|
||||||
}
|
|
||||||
|
|
||||||
function anchoredValue(anchor: string|null, value: string): string;
|
|
||||||
function anchoredPath(anchor: string|null, ...args: string[]): string;
|
|
||||||
function compact(array: any): any;
|
|
||||||
function checkIsAvailable(url: string, callback: any): void;
|
|
||||||
function dockerHostSwap(host: string): string;
|
|
||||||
function buildUrl(protocol: string, host: string, port: number, type: string): string;
|
|
||||||
function buildUrlFromConfig(config: any): string;
|
|
||||||
function canonicalHost(host: string): string;
|
|
||||||
function dappPath(...names: string[]): string;
|
|
||||||
function diagramPath(...names: string[]): string;
|
|
||||||
function escapeHtml(message: any): string;
|
|
||||||
function embarkPath(...names: string[]): string;
|
|
||||||
function exit(code?: any): void;
|
|
||||||
function findMonorepoPackageFromRoot(pkgName: string, prefilter?: null | ((pkgName: string) => (pkgJsonPath: string) => boolean)): Promise<string>;
|
|
||||||
function findMonorepoPackageFromRootSync(pkgName: string, prefilter?: null | ((pkgName: string) => (pkgJsonPath: string) => boolean)): string;
|
|
||||||
function findNextPort(port: number): Promise<number>;
|
|
||||||
function isEs6Module(module: any): boolean;
|
|
||||||
function isInsideMonorepo(): Promise<boolean>;
|
|
||||||
function isInsideMonorepoSync(): boolean;
|
|
||||||
function monorepoRootPath(): Promise<string>;
|
|
||||||
function monorepoRootPathSync(): string;
|
|
||||||
function jsonFunctionReplacer(key: any, value: any): any;
|
|
||||||
function fuzzySearch(text: string, list: any, filter: any): any;
|
|
||||||
function getExternalContractUrl(file: string, provideUrl: string): string;
|
|
||||||
function recursiveMerge(target: any, source: any): any;
|
|
||||||
function pkgPath(...names: string[]): string;
|
|
||||||
function removePureView(dir: string): void;
|
|
||||||
function pingEndpoint(host: string, port: number, type: string, protocol: string, origin: string, callback: any): void;
|
|
||||||
|
|
||||||
export class AccountParser {
|
|
||||||
public static parseAccountsConfig(accountsConfig: any[], web3: any, dappPath: string, logger: Logger, nodeAccounts?: any[]): any[];
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -25,28 +25,32 @@
|
||||||
"url": "https://github.com/embark-framework/embark.git"
|
"url": "https://github.com/embark-framework/embark.git"
|
||||||
},
|
},
|
||||||
"main": "./dist/index.js",
|
"main": "./dist/index.js",
|
||||||
|
"types": "./dist/index.d.ts",
|
||||||
"embark-collective": {
|
"embark-collective": {
|
||||||
"build:node": true
|
"build:node": true,
|
||||||
|
"typecheck": true
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"_build": "npm run solo -- build",
|
"_build": "npm run solo -- build",
|
||||||
|
"_typecheck": "npm run solo -- typecheck",
|
||||||
"ci": "npm run qa",
|
"ci": "npm run qa",
|
||||||
"clean": "npm run reset",
|
"clean": "npm run reset",
|
||||||
"lint": "npm-run-all lint:*",
|
"lint": "npm-run-all lint:*",
|
||||||
"lint:js": "eslint src/",
|
"lint:js": "eslint src/",
|
||||||
"lint:ts": "tslint -c tslint.json \"src/**/*.ts\"",
|
"lint:ts": "tslint -c tslint.json \"src/**/*.ts\"",
|
||||||
"qa": "npm-run-all lint typecheck _build",
|
"qa": "npm-run-all lint _typecheck _build",
|
||||||
"reset": "npx rimraf dist embark-*.tgz package",
|
"reset": "npx rimraf dist embark-*.tgz package",
|
||||||
"solo": "embark-solo",
|
"solo": "embark-solo"
|
||||||
"typecheck": "tsc",
|
|
||||||
"watch": "run-p watch:*",
|
|
||||||
"watch:typecheck": "npm run typecheck -- --preserveWatchOutput --watch"
|
|
||||||
},
|
},
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
"extends": "../../../.eslintrc.json"
|
"extends": "../../../.eslintrc.json"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime-corejs3": "7.7.4",
|
"@babel/runtime-corejs3": "7.7.4",
|
||||||
|
"@types/follow-redirects": "1.5.0",
|
||||||
|
"@types/fs-extra": "7.0.0",
|
||||||
|
"@types/node": "12.7.8",
|
||||||
|
"@types/pretty-ms": "5.0.1",
|
||||||
"bip39": "3.0.2",
|
"bip39": "3.0.2",
|
||||||
"clipboardy": "1.2.3",
|
"clipboardy": "1.2.3",
|
||||||
"colors": "1.3.2",
|
"colors": "1.3.2",
|
||||||
|
@ -71,17 +75,13 @@
|
||||||
"ws": "7.1.2"
|
"ws": "7.1.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/follow-redirects": "1.5.0",
|
|
||||||
"@types/fs-extra": "7.0.0",
|
|
||||||
"@types/node": "12.7.8",
|
|
||||||
"@types/pretty-ms": "5.0.1",
|
|
||||||
"embark-inside-monorepo": "^5.0.0-alpha.0",
|
"embark-inside-monorepo": "^5.0.0-alpha.0",
|
||||||
"embark-solo": "^5.0.0-alpha.2",
|
"embark-solo": "^5.0.0-alpha.2",
|
||||||
"eslint": "5.7.0",
|
"eslint": "5.7.0",
|
||||||
"npm-run-all": "4.1.5",
|
"npm-run-all": "4.1.5",
|
||||||
"rimraf": "3.0.0",
|
"rimraf": "3.0.0",
|
||||||
"tslint": "5.16.0",
|
"tslint": "5.20.1",
|
||||||
"typescript": "3.6.3"
|
"typescript": "3.7.2"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=10.17.0 <12.0.0",
|
"node": ">=10.17.0 <12.0.0",
|
||||||
|
|
|
@ -35,7 +35,7 @@ export default class AccountParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*eslint complexity: ["error", 30]*/
|
/*eslint complexity: ["error", 30]*/
|
||||||
static getAccount(accountConfig, web3, dappPath, logger = console, nodeAccounts) {
|
static getAccount(accountConfig, web3, dappPath, logger = console, nodeAccounts = null) {
|
||||||
const returnAddress = web3 === false;
|
const returnAddress = web3 === false;
|
||||||
let hexBalance = null;
|
let hexBalance = null;
|
||||||
if (accountConfig.balance && web3) {
|
if (accountConfig.balance && web3) {
|
||||||
|
|
|
@ -27,7 +27,6 @@ export {
|
||||||
soliditySha3,
|
soliditySha3,
|
||||||
toChecksumAddress
|
toChecksumAddress
|
||||||
} from './web3Utils';
|
} from './web3Utils';
|
||||||
export { getAddressToContract, getTransactionParams } from './transactionUtils';
|
|
||||||
import LongRunningProcessTimer from './longRunningProcessTimer';
|
import LongRunningProcessTimer from './longRunningProcessTimer';
|
||||||
export { LongRunningProcessTimer };
|
export { LongRunningProcessTimer };
|
||||||
import AccountParser from './accountParser';
|
import AccountParser from './accountParser';
|
||||||
|
|
|
@ -30,12 +30,23 @@ const getImports = (source: string) => {
|
||||||
}).filter((fileImport) => fileImport.length);
|
}).filter((fileImport) => fileImport.length);
|
||||||
};
|
};
|
||||||
|
|
||||||
const prepareInitialFile = async (file: File) => {
|
const prepareInitialFile = async (file: File | any) => {
|
||||||
if (file.type === Types.http) {
|
if (file.type === Types.http) {
|
||||||
return await file.content;
|
return await file.content;
|
||||||
}
|
}
|
||||||
|
|
||||||
const to = file.path.includes(dappPath(".embark")) ? path.normalize(file.path) : dappPath(".embark", file.path);
|
let to: string;
|
||||||
|
if (file.path.includes(dappPath(".embark"))) {
|
||||||
|
to = path.normalize(file.path);
|
||||||
|
} else if (path.isAbsolute(file.path)) {
|
||||||
|
// don't want 'C:\' in calculated path on Windows
|
||||||
|
const relativeFrom = path.normalize('/');
|
||||||
|
const relativePath = path.relative(relativeFrom, file.path);
|
||||||
|
to = dappPath(".embark", relativePath);
|
||||||
|
} else {
|
||||||
|
to = dappPath(".embark", file.path);
|
||||||
|
}
|
||||||
|
|
||||||
if (file.type === Types.dappFile || file.type === Types.custom) {
|
if (file.type === Types.dappFile || file.type === Types.custom) {
|
||||||
if (file.resolver) {
|
if (file.resolver) {
|
||||||
fs.mkdirpSync(path.dirname(to));
|
fs.mkdirpSync(path.dirname(to));
|
||||||
|
|
|
@ -1,4 +1,20 @@
|
||||||
{
|
{
|
||||||
"extends": "../../../tsconfig.json",
|
"compilerOptions": {
|
||||||
"include": ["src/**/*"]
|
"composite": true,
|
||||||
|
"declarationDir": "./dist",
|
||||||
|
"rootDir": "./src",
|
||||||
|
"tsBuildInfoFile": "./node_modules/.cache/tsc/tsconfig.embark-utils.tsbuildinfo"
|
||||||
|
},
|
||||||
|
"extends": "../../../tsconfig.base.json",
|
||||||
|
"include": [
|
||||||
|
"src/**/*"
|
||||||
|
],
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"path": "../i18n"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../logger"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
"embark": "./bin/embark"
|
"embark": "./bin/embark"
|
||||||
},
|
},
|
||||||
"main": "./dist/lib/index.js",
|
"main": "./dist/lib/index.js",
|
||||||
|
"types": "./dist/lib/index.d.ts",
|
||||||
"files": [
|
"files": [
|
||||||
"bin",
|
"bin",
|
||||||
"dist/bin",
|
"dist/bin",
|
||||||
|
@ -33,14 +34,22 @@
|
||||||
"locales"
|
"locales"
|
||||||
],
|
],
|
||||||
"embark-collective": {
|
"embark-collective": {
|
||||||
"build:node": true
|
"build:node": true,
|
||||||
|
"typecheck": {
|
||||||
|
"include": [
|
||||||
|
"src/bin/**/*",
|
||||||
|
"src/cmd/**/*",
|
||||||
|
"src/lib/**/*"
|
||||||
|
]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"_build": "npm run solo -- build",
|
"_build": "npm run solo -- build",
|
||||||
|
"_typecheck": "npm run solo -- typecheck",
|
||||||
"ci": "npm run qa",
|
"ci": "npm run qa",
|
||||||
"clean": "npm run reset",
|
"clean": "npm run reset",
|
||||||
"lint": "eslint bin/embark src/bin/ src/lib/",
|
"lint": "eslint bin/embark src/bin/ src/lib/",
|
||||||
"qa": "npm-run-all lint _build test",
|
"qa": "npm-run-all lint _typecheck _build test",
|
||||||
"reset": "npx rimraf .nyc_output coverage dist embark-*.tgz package",
|
"reset": "npx rimraf .nyc_output coverage dist embark-*.tgz package",
|
||||||
"solo": "embark-solo",
|
"solo": "embark-solo",
|
||||||
"test": "nyc --reporter=html --reporter=json mocha \"dist/test/**/*.js\" --exit --no-timeouts --require ./scripts/test.js --require source-map-support/register"
|
"test": "nyc --reporter=html --reporter=json mocha \"dist/test/**/*.js\" --exit --no-timeouts --require ./scripts/test.js --require source-map-support/register"
|
||||||
|
@ -68,61 +77,15 @@
|
||||||
"core-js": "3.4.3",
|
"core-js": "3.4.3",
|
||||||
"date-and-time": "0.6.2",
|
"date-and-time": "0.6.2",
|
||||||
"decompress": "4.2.0",
|
"decompress": "4.2.0",
|
||||||
"deep-equal": "1.0.1",
|
|
||||||
"embark-accounts-manager": "^5.0.0-alpha.4",
|
|
||||||
"embark-api": "^5.0.0-alpha.4",
|
|
||||||
"embark-authenticator": "^5.0.0-alpha.4",
|
|
||||||
"embark-basic-pipeline": "^5.0.0-alpha.4",
|
|
||||||
"embark-blockchain": "^5.0.0-alpha.4",
|
|
||||||
"embark-blockchain-client": "^5.0.0-alpha.2",
|
|
||||||
"embark-code-runner": "^5.0.0-alpha.4",
|
|
||||||
"embark-communication": "^5.0.0-alpha.4",
|
|
||||||
"embark-compiler": "^5.0.0-alpha.4",
|
|
||||||
"embark-console": "^5.0.0-alpha.4",
|
|
||||||
"embark-contracts-manager": "^5.0.0-alpha.4",
|
|
||||||
"embark-core": "^5.0.0-alpha.4",
|
"embark-core": "^5.0.0-alpha.4",
|
||||||
"embark-coverage": "^5.0.0-alpha.4",
|
|
||||||
"embark-debugger": "^5.0.0-alpha.4",
|
|
||||||
"embark-deploy-tracker": "^5.0.0-alpha.2",
|
"embark-deploy-tracker": "^5.0.0-alpha.2",
|
||||||
"embark-deployment": "^5.0.0-alpha.4",
|
"embark-engine": "^5.0.0-alpha.4",
|
||||||
"embark-embarkjs": "^5.0.0-alpha.4",
|
|
||||||
"embark-ens": "^5.0.0-alpha.4",
|
|
||||||
"embark-ethereum-blockchain-client": "^5.0.0-alpha.4",
|
|
||||||
"embark-ganache": "^5.0.0-alpha.2",
|
|
||||||
"embark-geth": "^5.0.0-alpha.4",
|
|
||||||
"embark-graph": "^5.0.0-alpha.2",
|
"embark-graph": "^5.0.0-alpha.2",
|
||||||
"embark-i18n": "^5.0.0-alpha.2",
|
"embark-i18n": "^5.0.0-alpha.2",
|
||||||
"embark-ipfs": "^5.0.0-alpha.4",
|
|
||||||
"embark-library-manager": "^5.0.0-alpha.4",
|
|
||||||
"embark-logger": "^5.0.0-alpha.4",
|
"embark-logger": "^5.0.0-alpha.4",
|
||||||
"embark-mocha-tests": "^5.0.0-alpha.4",
|
|
||||||
"embark-namesystem": "^5.0.0-alpha.2",
|
|
||||||
"embark-parity": "^5.0.0-alpha.4",
|
|
||||||
"embark-pipeline": "^5.0.0-alpha.4",
|
|
||||||
"embark-plugin-cmd": "^5.0.0-alpha.4",
|
|
||||||
"embark-process-logs-api-manager": "^5.0.0-alpha.4",
|
|
||||||
"embark-profiler": "^5.0.0-alpha.2",
|
|
||||||
"embark-proxy": "^5.0.0-alpha.4",
|
|
||||||
"embark-reset": "^5.0.0-alpha.2",
|
"embark-reset": "^5.0.0-alpha.2",
|
||||||
"embark-scaffolding": "^5.0.0-alpha.2",
|
"embark-scaffolding": "^5.0.0-alpha.2",
|
||||||
"embark-solidity": "^5.0.0-alpha.4",
|
|
||||||
"embark-specialconfigs": "^5.0.0-alpha.2",
|
|
||||||
"embark-storage": "^5.0.0-alpha.4",
|
|
||||||
"embark-swarm": "^5.0.0-alpha.4",
|
|
||||||
"embark-test-runner": "^5.0.0-alpha.4",
|
|
||||||
"embark-transaction-logger": "^5.0.0-alpha.4",
|
|
||||||
"embark-transaction-tracker": "^5.0.0-alpha.2",
|
|
||||||
"embark-ui": "^5.0.0-alpha.4",
|
|
||||||
"embark-utils": "^5.0.0-alpha.4",
|
"embark-utils": "^5.0.0-alpha.4",
|
||||||
"embark-vyper": "^5.0.0-alpha.2",
|
|
||||||
"embark-watcher": "^5.0.0-alpha.4",
|
|
||||||
"embark-web3": "^5.0.0-alpha.4",
|
|
||||||
"embark-webserver": "^5.0.0-alpha.4",
|
|
||||||
"embarkjs-ens": "^5.0.0-alpha.4",
|
|
||||||
"embarkjs-ipfs": "^5.0.0-alpha.2",
|
|
||||||
"embarkjs-swarm": "^5.0.0-alpha.2",
|
|
||||||
"embarkjs-web3": "^5.0.0-alpha.2",
|
|
||||||
"embarkjs-whisper": "^5.0.0-alpha.2",
|
|
||||||
"eth-ens-namehash": "2.0.8",
|
"eth-ens-namehash": "2.0.8",
|
||||||
"ethereumjs-wallet": "0.6.3",
|
"ethereumjs-wallet": "0.6.3",
|
||||||
"find-up": "2.1.0",
|
"find-up": "2.1.0",
|
||||||
|
@ -179,10 +142,15 @@
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"chai": "4.1.2",
|
"chai": "4.1.2",
|
||||||
|
"embark-code-runner": "^5.0.0-alpha.4",
|
||||||
|
"embark-compiler": "^5.0.0-alpha.4",
|
||||||
|
"embark-contracts-manager": "^5.0.0-alpha.4",
|
||||||
|
"embark-solidity": "^5.0.0-alpha.3",
|
||||||
"embark-solo": "^5.0.0-alpha.2",
|
"embark-solo": "^5.0.0-alpha.2",
|
||||||
"embark-test-contract-0": "0.0.2",
|
"embark-test-contract-0": "0.0.2",
|
||||||
"embark-test-contract-1": "0.0.1",
|
"embark-test-contract-1": "0.0.1",
|
||||||
"embark-testing": "^5.0.0-alpha.4",
|
"embark-testing": "^5.0.0-alpha.4",
|
||||||
|
"embark-transaction-logger": "^5.0.0-alpha.3",
|
||||||
"eslint": "5.7.0",
|
"eslint": "5.7.0",
|
||||||
"npm-run-all": "4.1.5",
|
"npm-run-all": "4.1.5",
|
||||||
"nyc": "13.1.0",
|
"nyc": "13.1.0",
|
||||||
|
|
|
@ -1,17 +1,20 @@
|
||||||
import { Config, Engine, Events, fs, TemplateGenerator } from 'embark-core';
|
import { Config, Events, fs, TemplateGenerator } from 'embark-core';
|
||||||
|
import { Engine } from 'embark-engine';
|
||||||
import { __ } from 'embark-i18n';
|
import { __ } from 'embark-i18n';
|
||||||
import { dappPath, embarkPath, joinPath, setUpEnv } from 'embark-utils';
|
import { dappPath, embarkPath, joinPath, setUpEnv } from 'embark-utils';
|
||||||
import { Logger } from 'embark-logger';
|
import { Logger, LogLevels } from 'embark-logger';
|
||||||
let async = require('async');
|
let async = require('async');
|
||||||
const constants = require('embark-core/constants');
|
const constants = require('embark-core/constants');
|
||||||
const { reset: embarkReset, paths: defaultResetPaths } = require('embark-reset');
|
const { reset: embarkReset, paths: defaultResetPaths } = require('embark-reset');
|
||||||
const cloneDeep = require('clone-deep');
|
const cloneDeep = require('clone-deep');
|
||||||
|
import { readJsonSync } from 'fs-extra';
|
||||||
|
import { join } from 'path';
|
||||||
|
|
||||||
setUpEnv(joinPath(__dirname, '../../'));
|
setUpEnv(joinPath(__dirname, '../../'));
|
||||||
|
|
||||||
require('colors');
|
require('colors');
|
||||||
|
|
||||||
let pkg = require('../../package.json');
|
const pkg = readJsonSync(join(__dirname, '../../package.json'));
|
||||||
|
|
||||||
class EmbarkController {
|
class EmbarkController {
|
||||||
|
|
||||||
|
@ -26,7 +29,7 @@ class EmbarkController {
|
||||||
|
|
||||||
initConfig(env, options) {
|
initConfig(env, options) {
|
||||||
this.events = new Events();
|
this.events = new Events();
|
||||||
this.logger = new Logger({ logLevel: Logger.logLevels.debug, events: this.events, context: this.context });
|
this.logger = new Logger({ logLevel: LogLevels.debug, events: this.events, context: this.context });
|
||||||
this.config = new Config({ env: env, logger: this.logger, events: this.events, context: this.context, version: this.version });
|
this.config = new Config({ env: env, logger: this.logger, events: this.events, context: this.context, version: this.version });
|
||||||
this.config.loadConfigFiles(options);
|
this.config.loadConfigFiles(options);
|
||||||
this.plugins = this.config.plugins;
|
this.plugins = this.config.plugins;
|
||||||
|
@ -739,7 +742,7 @@ class EmbarkController {
|
||||||
version: this.version,
|
version: this.version,
|
||||||
embarkConfig: options.embarkConfig || 'embark.json',
|
embarkConfig: options.embarkConfig || 'embark.json',
|
||||||
logFile: options.logFile,
|
logFile: options.logFile,
|
||||||
logLevel: options.logLevel || Logger.logLevels.warn,
|
logLevel: options.logLevel || LogLevels.warn,
|
||||||
context: this.context,
|
context: this.context,
|
||||||
useDashboard: false,
|
useDashboard: false,
|
||||||
webpackConfigName: options.webpackConfigName,
|
webpackConfigName: options.webpackConfigName,
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
let pkg = require('../../package.json');
|
|
||||||
import { Config, Events } from 'embark-core';
|
import { Config, Events } from 'embark-core';
|
||||||
import { Logger } from 'embark-logger';
|
import { Logger } from 'embark-logger';
|
||||||
|
import { readJsonSync } from 'fs-extra';
|
||||||
|
import { join } from 'path';
|
||||||
|
|
||||||
class Embark {
|
const pkg = readJsonSync(join(__dirname, '../../package.json'));
|
||||||
|
|
||||||
|
export default class Embark {
|
||||||
|
|
||||||
constructor(options) {
|
constructor(options) {
|
||||||
this.version = pkg.version;
|
this.version = pkg.version;
|
||||||
|
@ -25,5 +28,3 @@ class Embark {
|
||||||
this.plugins = this.config.plugins;
|
this.plugins = this.config.plugins;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = Embark;
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
let Embark = require('../lib/index');
|
import Embark from '../lib/index';
|
||||||
let Cmd = require('../cmd/cmd');
|
let Cmd = require('../cmd/cmd');
|
||||||
|
|
||||||
// Function to send a line to stdin
|
// Function to send a line to stdin
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
/*global describe, it, require*/
|
/*global describe, it, require*/
|
||||||
import { File, Types } from "embark-utils";
|
import { File, Types } from "embark-utils";
|
||||||
|
|
||||||
let ContractsManager = require('embark-contracts-manager');
|
import ContractsManager from 'embark-contracts-manager';
|
||||||
let Compiler = require('embark-compiler');
|
import Compiler from 'embark-compiler';
|
||||||
import { Logger } from 'embark-logger';
|
import { Logger } from 'embark-logger';
|
||||||
import { Events, fs, IPC, TestLogger, Plugins } from 'embark-core';
|
import { Events, fs, IPC, TestLogger, Plugins } from 'embark-core';
|
||||||
let assert = require('assert');
|
let assert = require('assert');
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { File, Types } from "embark-utils";
|
||||||
|
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
|
|
||||||
const Compiler = require('embark-compiler');
|
import Compiler from 'embark-compiler';
|
||||||
|
|
||||||
const readFile = function(file) {
|
const readFile = function(file) {
|
||||||
return new File({filename: file, type: Types.dappFile, path: file});
|
return new File({filename: file, type: Types.dappFile, path: file});
|
||||||
|
|
|
@ -1,190 +0,0 @@
|
||||||
/*globals describe, it, beforeEach*/
|
|
||||||
const {expect} = require('chai');
|
|
||||||
const sinon = require('sinon');
|
|
||||||
import { Logger } from 'embark-logger';
|
|
||||||
import { getAddressToContract } from 'embark-utils';
|
|
||||||
const ConsoleListener = require('embark-console-listener');
|
|
||||||
import { Events, fs, IPC } from 'embark-core';
|
|
||||||
require('colors');
|
|
||||||
|
|
||||||
let events,
|
|
||||||
logger,
|
|
||||||
consoleListener,
|
|
||||||
ipc,
|
|
||||||
embark,
|
|
||||||
loggerInfos = [],
|
|
||||||
eventsEmitted = [],
|
|
||||||
ipcRequest,
|
|
||||||
contractsList;
|
|
||||||
|
|
||||||
function resetTest() {
|
|
||||||
loggerInfos = [];
|
|
||||||
eventsEmitted = [];
|
|
||||||
ipcRequest = {
|
|
||||||
type: 'contract-log',
|
|
||||||
address: "0x12345",
|
|
||||||
data: "0x6d4ce63c",
|
|
||||||
transactionHash: "hash",
|
|
||||||
blockNumber: "0x0",
|
|
||||||
gasUsed: "0x0",
|
|
||||||
status: "yay"
|
|
||||||
};
|
|
||||||
contractsList = [
|
|
||||||
{
|
|
||||||
abiDefinition: [
|
|
||||||
{
|
|
||||||
"constant": true,
|
|
||||||
"inputs": [],
|
|
||||||
"name": "storedData",
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"name": "",
|
|
||||||
"type": "uint256"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"payable": false,
|
|
||||||
"stateMutability": "view",
|
|
||||||
"type": "function"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"constant": false,
|
|
||||||
"inputs": [
|
|
||||||
{
|
|
||||||
"name": "x",
|
|
||||||
"type": "uint256"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"name": "set",
|
|
||||||
"outputs": [],
|
|
||||||
"payable": false,
|
|
||||||
"stateMutability": "nonpayable",
|
|
||||||
"type": "function"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"constant": true,
|
|
||||||
"inputs": [],
|
|
||||||
"name": "get",
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"name": "retVal",
|
|
||||||
"type": "uint256"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"payable": false,
|
|
||||||
"stateMutability": "view",
|
|
||||||
"type": "function"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"inputs": [
|
|
||||||
{
|
|
||||||
"name": "initialValue",
|
|
||||||
"type": "uint256"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"payable": false,
|
|
||||||
"stateMutability": "nonpayable",
|
|
||||||
"type": "constructor"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
deployedAddress: "0x12345",
|
|
||||||
className: "SimpleStorage",
|
|
||||||
silent: true
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
events = new Events();
|
|
||||||
logger = new Logger(events);
|
|
||||||
ipc = new IPC({ipcRole: 'none'});
|
|
||||||
embark = {
|
|
||||||
events,
|
|
||||||
logger,
|
|
||||||
fs: {
|
|
||||||
existsSync: () => { return false; },
|
|
||||||
dappPath: () => { return "ok"; }
|
|
||||||
},
|
|
||||||
config: {
|
|
||||||
contractsConfig: {}
|
|
||||||
},
|
|
||||||
registerAPICall: () => {}
|
|
||||||
};
|
|
||||||
|
|
||||||
// setup ConsoleListener
|
|
||||||
consoleListener = new ConsoleListener(embark, {ipc});
|
|
||||||
consoleListener.contractsDeployed = true;
|
|
||||||
consoleListener.outputDone = true;
|
|
||||||
|
|
||||||
sinon.stub(events, 'emit').callsFake((eventName, data) => {
|
|
||||||
eventsEmitted.push({eventName, data});
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
sinon.stub(logger, 'info').callsFake((args) => {
|
|
||||||
loggerInfos.push(args);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
describe('Console Listener', function () {
|
|
||||||
beforeEach('reset test', function (done) {
|
|
||||||
resetTest();
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('#listenForLogRequests', function () {
|
|
||||||
it('should emit the correct contracts logs', function (done) {
|
|
||||||
getAddressToContract(contractsList, consoleListener.addressToContract);
|
|
||||||
consoleListener._onIpcLogRequest(ipcRequest);
|
|
||||||
|
|
||||||
const expectedContractLog = {
|
|
||||||
address: "0x12345",
|
|
||||||
blockNumber: 0,
|
|
||||||
data: "0x6d4ce63c",
|
|
||||||
functionName: "get",
|
|
||||||
gasUsed: 0,
|
|
||||||
name: "SimpleStorage",
|
|
||||||
paramString: "",
|
|
||||||
status: "yay",
|
|
||||||
transactionHash: "hash",
|
|
||||||
type: "contract-log"
|
|
||||||
};
|
|
||||||
const {name, functionName, paramString, transactionHash, gasUsed, blockNumber, status} = expectedContractLog;
|
|
||||||
|
|
||||||
const contractLogEmitted = eventsEmitted.find(event => event.eventName === 'contracts:log');
|
|
||||||
expect(contractLogEmitted).to.deep.equal({
|
|
||||||
eventName: 'contracts:log',
|
|
||||||
data: expectedContractLog
|
|
||||||
});
|
|
||||||
|
|
||||||
const blockchainTxLogEmitted = eventsEmitted.find(event => event.eventName === 'blockchain:tx');
|
|
||||||
expect(blockchainTxLogEmitted).to.deep.equal({
|
|
||||||
eventName: 'blockchain:tx',
|
|
||||||
data: {
|
|
||||||
name,
|
|
||||||
functionName,
|
|
||||||
paramString,
|
|
||||||
transactionHash,
|
|
||||||
gasUsed,
|
|
||||||
blockNumber,
|
|
||||||
status
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
expect(loggerInfos[0]).to.be.equal(`Blockchain>`.underline + ` ${name}.${functionName}(${paramString})`.bold + ` | ${transactionHash} | gas:${gasUsed} | blk:${blockNumber} | status:${status}`);
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should emit a log for a non-contract log', function (done) {
|
|
||||||
ipcRequest.type = 'something-other-than-contract-log';
|
|
||||||
getAddressToContract(contractsList, consoleListener.addressToContract);
|
|
||||||
consoleListener._onIpcLogRequest(ipcRequest);
|
|
||||||
|
|
||||||
expect(loggerInfos[0]).to.be.equal(JSON.stringify(ipcRequest));
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should emit an "unknown contract" log message', function (done) {
|
|
||||||
consoleListener._onIpcLogRequest(ipcRequest);
|
|
||||||
|
|
||||||
expect(loggerInfos[0]).to.be.equal(`Contract log for unknown contract: ${JSON.stringify(ipcRequest)}`);
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*globals describe, it, beforeEach*/
|
/*globals describe, it, beforeEach*/
|
||||||
const {expect} = require('chai');
|
const {expect} = require('chai');
|
||||||
import { getAddressToContract, getTransactionParams } from 'embark-utils';
|
import { getAddressToContract, getTransactionParams } from 'embark-transaction-logger';
|
||||||
require('colors');
|
require('colors');
|
||||||
|
|
||||||
let contractsList;
|
let contractsList;
|
||||||
|
|
|
@ -0,0 +1,61 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"composite": true,
|
||||||
|
"declarationDir": "./dist",
|
||||||
|
"rootDir": "./src",
|
||||||
|
"tsBuildInfoFile": "./node_modules/.cache/tsc/tsconfig.embark.tsbuildinfo"
|
||||||
|
},
|
||||||
|
"extends": "../../tsconfig.base.json",
|
||||||
|
"include": [
|
||||||
|
"src/bin/**/*",
|
||||||
|
"src/cmd/**/*",
|
||||||
|
"src/lib/**/*"
|
||||||
|
],
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"path": "../core/code-runner"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../core/core"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../core/engine"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../core/i18n"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../core/logger"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../core/reset"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../core/utils"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../plugins/deploy-tracker"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../plugins/graph"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../plugins/scaffolding"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../plugins/solidity"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../plugins/transaction-logger"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../stack/compiler"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../stack/contracts-manager"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../utils/testing"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -22,10 +22,12 @@
|
||||||
"url": "https://github.com/embark-framework/embark.git"
|
"url": "https://github.com/embark-framework/embark.git"
|
||||||
},
|
},
|
||||||
"main": "./dist/lib/node/index.js",
|
"main": "./dist/lib/node/index.js",
|
||||||
|
"types": "./dist/lib/node/index.d.ts",
|
||||||
"browser": {
|
"browser": {
|
||||||
"./dist/lib/node/index.js": "./dist/browser/lib/index.js",
|
"./dist/lib/node/index.js": "./dist/browser/lib/index.js",
|
||||||
"./dist/browser/lib/async.js": "./dist/browser/lib/browser/async.js"
|
"./dist/browser/lib/async.js": "./dist/browser/lib/browser/async.js"
|
||||||
},
|
},
|
||||||
|
|
||||||
"browserslist": [
|
"browserslist": [
|
||||||
"last 1 version",
|
"last 1 version",
|
||||||
"not dead",
|
"not dead",
|
||||||
|
@ -37,13 +39,19 @@
|
||||||
],
|
],
|
||||||
"embark-collective": {
|
"embark-collective": {
|
||||||
"build:browser": true,
|
"build:browser": true,
|
||||||
"build:node": true
|
"build:node": true,
|
||||||
|
"typecheck": {
|
||||||
|
"exclude": [
|
||||||
|
"src/lib/browser"
|
||||||
|
]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"_build": "npm run solo -- build",
|
"_build": "npm run solo -- build",
|
||||||
|
"_typecheck": "npm run solo -- typecheck",
|
||||||
"ci": "npm run qa",
|
"ci": "npm run qa",
|
||||||
"clean": "npm run reset",
|
"clean": "npm run reset",
|
||||||
"qa": "npm-run-all _build test",
|
"qa": "npm-run-all _typecheck _build test",
|
||||||
"reset": "npx rimraf .nyc_output coverage dist embarkjs-*.tgz package",
|
"reset": "npx rimraf .nyc_output coverage dist embarkjs-*.tgz package",
|
||||||
"solo": "embark-solo",
|
"solo": "embark-solo",
|
||||||
"test": "nyc --reporter=html --reporter=json mocha \"dist/test/**/*.js\" --exit --no-timeouts --require source-map-support/register"
|
"test": "nyc --reporter=html --reporter=json mocha \"dist/test/**/*.js\" --exit --no-timeouts --require source-map-support/register"
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
import {reduce} from './async';
|
import {reduce} from './async';
|
||||||
|
|
||||||
let Blockchain = {
|
let Blockchain = {
|
||||||
|
Contract: Contract,
|
||||||
list: [],
|
list: [],
|
||||||
done: false,
|
done: false,
|
||||||
err: null
|
err: null
|
||||||
|
@ -226,7 +227,7 @@ Blockchain.execWhenReady = function(cb) {
|
||||||
this.list.push(cb);
|
this.list.push(cb);
|
||||||
};
|
};
|
||||||
|
|
||||||
let Contract = function(options) {
|
function Contract(options) {
|
||||||
var self = this;
|
var self = this;
|
||||||
var ContractClass;
|
var ContractClass;
|
||||||
|
|
||||||
|
@ -358,8 +359,6 @@ Contract.prototype.send = function(value, unit, _options) {
|
||||||
return this.blockchainConnector.send(options);
|
return this.blockchainConnector.send(options);
|
||||||
};
|
};
|
||||||
|
|
||||||
Blockchain.Contract = Contract;
|
|
||||||
|
|
||||||
class BlockchainConnectionError extends Error {
|
class BlockchainConnectionError extends Error {
|
||||||
constructor(connectionErrors) {
|
constructor(connectionErrors) {
|
||||||
super("Could not establish a connection to a node.");
|
super("Could not establish a connection to a node.");
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"composite": true,
|
||||||
|
"declarationDir": "./dist",
|
||||||
|
"rootDir": "./src",
|
||||||
|
"tsBuildInfoFile": "./node_modules/.cache/tsc/tsconfig.embarkjs.tsbuildinfo"
|
||||||
|
},
|
||||||
|
"exclude": [
|
||||||
|
"src/lib/browser"
|
||||||
|
],
|
||||||
|
"extends": "../../../tsconfig.base.json",
|
||||||
|
"include": [
|
||||||
|
"src/lib/**/*"
|
||||||
|
]
|
||||||
|
}
|
|
@ -21,7 +21,8 @@
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/embark-framework/embark.git"
|
"url": "https://github.com/embark-framework/embark.git"
|
||||||
},
|
},
|
||||||
"main": "dist/node/index.js",
|
"main": "./dist/node/index.js",
|
||||||
|
"types": "./dist/node/index.d.ts",
|
||||||
"browser": "./dist/browser/index.js",
|
"browser": "./dist/browser/index.js",
|
||||||
"browserslist": [
|
"browserslist": [
|
||||||
"last 1 version",
|
"last 1 version",
|
||||||
|
@ -33,13 +34,15 @@
|
||||||
],
|
],
|
||||||
"embark-collective": {
|
"embark-collective": {
|
||||||
"build:browser": true,
|
"build:browser": true,
|
||||||
"build:node": true
|
"build:node": true,
|
||||||
|
"typecheck": true
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"_build": "npm run solo -- build",
|
"_build": "npm run solo -- build",
|
||||||
|
"_typecheck": "npm run solo -- typecheck",
|
||||||
"ci": "npm run qa",
|
"ci": "npm run qa",
|
||||||
"clean": "npm run reset",
|
"clean": "npm run reset",
|
||||||
"qa": "npm-run-all _build",
|
"qa": "npm-run-all _typecheck _build",
|
||||||
"reset": "npx rimraf coverage dist embarkjs-*.tgz package",
|
"reset": "npx rimraf coverage dist embarkjs-*.tgz package",
|
||||||
"solo": "embark-solo"
|
"solo": "embark-solo"
|
||||||
},
|
},
|
||||||
|
|
|
@ -1 +1,3 @@
|
||||||
module.exports = require('..').default;
|
import embarkENS from '..';
|
||||||
|
|
||||||
|
module.exports = embarkENS;
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"composite": true,
|
||||||
|
"declarationDir": "./dist",
|
||||||
|
"rootDir": "./src",
|
||||||
|
"tsBuildInfoFile": "./node_modules/.cache/tsc/tsconfig.embarkjs-ens.tsbuildinfo"
|
||||||
|
},
|
||||||
|
"extends": "../../../tsconfig.base.json",
|
||||||
|
"include": [
|
||||||
|
"src/**/*"
|
||||||
|
],
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"path": "../embarkjs"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -21,7 +21,8 @@
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/embark-framework/embark.git"
|
"url": "https://github.com/embark-framework/embark.git"
|
||||||
},
|
},
|
||||||
"main": "dist/node/index.js",
|
"main": "./dist/node/index.js",
|
||||||
|
"types": "./dist/node/index.d.ts",
|
||||||
"browser": "./dist/browser/index.js",
|
"browser": "./dist/browser/index.js",
|
||||||
"browserslist": [
|
"browserslist": [
|
||||||
"last 1 version",
|
"last 1 version",
|
||||||
|
@ -33,13 +34,15 @@
|
||||||
],
|
],
|
||||||
"embark-collective": {
|
"embark-collective": {
|
||||||
"build:browser": true,
|
"build:browser": true,
|
||||||
"build:node": true
|
"build:node": true,
|
||||||
|
"typecheck": true
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"_build": "npm run solo -- build",
|
"_build": "npm run solo -- build",
|
||||||
|
"_typecheck": "npm run solo -- typecheck",
|
||||||
"ci": "npm run qa",
|
"ci": "npm run qa",
|
||||||
"clean": "npm run reset",
|
"clean": "npm run reset",
|
||||||
"qa": "npm-run-all _build",
|
"qa": "npm-run-all _typecheck _build",
|
||||||
"reset": "npx rimraf coverage dist embarkjs-*.tgz package",
|
"reset": "npx rimraf coverage dist embarkjs-*.tgz package",
|
||||||
"solo": "embark-solo"
|
"solo": "embark-solo"
|
||||||
},
|
},
|
||||||
|
|
|
@ -1 +1,3 @@
|
||||||
module.exports = require('..').default;
|
import embarkIPFS from '..';
|
||||||
|
|
||||||
|
module.exports = embarkIPFS;
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"composite": true,
|
||||||
|
"declarationDir": "./dist",
|
||||||
|
"rootDir": "./src",
|
||||||
|
"tsBuildInfoFile": "./node_modules/.cache/tsc/tsconfig.embarkjs-ipfs.tsbuildinfo"
|
||||||
|
},
|
||||||
|
"extends": "../../../tsconfig.base.json",
|
||||||
|
"include": [
|
||||||
|
"src/**/*"
|
||||||
|
]
|
||||||
|
}
|
|
@ -21,7 +21,8 @@
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/embark-framework/embark.git"
|
"url": "https://github.com/embark-framework/embark.git"
|
||||||
},
|
},
|
||||||
"main": "dist/node/index.js",
|
"main": "./dist/node/index.js",
|
||||||
|
"types": "./dist/node/index.d.ts",
|
||||||
"browser": "./dist/browser/index.js",
|
"browser": "./dist/browser/index.js",
|
||||||
"browserslist": [
|
"browserslist": [
|
||||||
"last 1 version",
|
"last 1 version",
|
||||||
|
@ -33,13 +34,15 @@
|
||||||
],
|
],
|
||||||
"embark-collective": {
|
"embark-collective": {
|
||||||
"build:browser": true,
|
"build:browser": true,
|
||||||
"build:node": true
|
"build:node": true,
|
||||||
|
"typecheck": true
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"_build": "npm run solo -- build",
|
"_build": "npm run solo -- build",
|
||||||
|
"_typecheck": "npm run solo -- typecheck",
|
||||||
"ci": "npm run qa",
|
"ci": "npm run qa",
|
||||||
"clean": "npm run reset",
|
"clean": "npm run reset",
|
||||||
"qa": "npm-run-all _build",
|
"qa": "npm-run-all _typecheck _build",
|
||||||
"reset": "npx rimraf coverage dist embarkjs-*.tgz package",
|
"reset": "npx rimraf coverage dist embarkjs-*.tgz package",
|
||||||
"solo": "embark-solo"
|
"solo": "embark-solo"
|
||||||
},
|
},
|
||||||
|
|
|
@ -1 +1,3 @@
|
||||||
module.exports = require('..').default;
|
import embarkSwarm from '..';
|
||||||
|
|
||||||
|
module.exports = embarkSwarm;
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"composite": true,
|
||||||
|
"declarationDir": "./dist",
|
||||||
|
"rootDir": "./src",
|
||||||
|
"tsBuildInfoFile": "./node_modules/.cache/tsc/tsconfig.embarkjs-swarm.tsbuildinfo"
|
||||||
|
},
|
||||||
|
"extends": "../../../tsconfig.base.json",
|
||||||
|
"include": [
|
||||||
|
"src/**/*"
|
||||||
|
]
|
||||||
|
}
|
|
@ -21,7 +21,8 @@
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/embark-framework/embark.git"
|
"url": "https://github.com/embark-framework/embark.git"
|
||||||
},
|
},
|
||||||
"main": "dist/node/index.js",
|
"main": "./dist/node/index.js",
|
||||||
|
"types": "./dist/node/index.d.ts",
|
||||||
"browser": "./dist/browser/index.js",
|
"browser": "./dist/browser/index.js",
|
||||||
"browserslist": [
|
"browserslist": [
|
||||||
"last 1 version",
|
"last 1 version",
|
||||||
|
@ -33,13 +34,15 @@
|
||||||
],
|
],
|
||||||
"embark-collective": {
|
"embark-collective": {
|
||||||
"build:browser": true,
|
"build:browser": true,
|
||||||
"build:node": true
|
"build:node": true,
|
||||||
|
"typecheck": true
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"_build": "npm run solo -- build",
|
"_build": "npm run solo -- build",
|
||||||
|
"_typecheck": "npm run solo -- typecheck",
|
||||||
"ci": "npm run qa",
|
"ci": "npm run qa",
|
||||||
"clean": "npm run reset",
|
"clean": "npm run reset",
|
||||||
"qa": "npm-run-all _build",
|
"qa": "npm-run-all _typecheck _build",
|
||||||
"reset": "npx rimraf coverage dist embarkjs-*.tgz package",
|
"reset": "npx rimraf coverage dist embarkjs-*.tgz package",
|
||||||
"solo": "embark-solo"
|
"solo": "embark-solo"
|
||||||
},
|
},
|
||||||
|
|
|
@ -1 +1,3 @@
|
||||||
module.exports = require('..').default;
|
import embarkWeb3 from '..';
|
||||||
|
|
||||||
|
module.exports = embarkWeb3;
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"composite": true,
|
||||||
|
"declarationDir": "./dist",
|
||||||
|
"rootDir": "./src",
|
||||||
|
"tsBuildInfoFile": "./node_modules/.cache/tsc/tsconfig.embarkjs-web3.tsbuildinfo"
|
||||||
|
},
|
||||||
|
"extends": "../../../tsconfig.base.json",
|
||||||
|
"include": [
|
||||||
|
"src/**/*"
|
||||||
|
]
|
||||||
|
}
|
|
@ -21,7 +21,8 @@
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/embark-framework/embark.git"
|
"url": "https://github.com/embark-framework/embark.git"
|
||||||
},
|
},
|
||||||
"main": "dist/node/index.js",
|
"main": "./dist/node/index.js",
|
||||||
|
"types": "./dist/node/index.d.ts",
|
||||||
"browser": "./dist/browser/index.js",
|
"browser": "./dist/browser/index.js",
|
||||||
"browserslist": [
|
"browserslist": [
|
||||||
"last 1 version",
|
"last 1 version",
|
||||||
|
@ -33,13 +34,15 @@
|
||||||
],
|
],
|
||||||
"embark-collective": {
|
"embark-collective": {
|
||||||
"build:browser": true,
|
"build:browser": true,
|
||||||
"build:node": true
|
"build:node": true,
|
||||||
|
"typecheck": true
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"_build": "npm run solo -- build",
|
"_build": "npm run solo -- build",
|
||||||
|
"_typecheck": "npm run solo -- typecheck",
|
||||||
"ci": "npm run qa",
|
"ci": "npm run qa",
|
||||||
"clean": "npm run reset",
|
"clean": "npm run reset",
|
||||||
"qa": "npm-run-all _build",
|
"qa": "npm-run-all _typecheck _build",
|
||||||
"reset": "npx rimraf coverage dist embarkjs-*.tgz package",
|
"reset": "npx rimraf coverage dist embarkjs-*.tgz package",
|
||||||
"solo": "embark-solo"
|
"solo": "embark-solo"
|
||||||
},
|
},
|
||||||
|
|
|
@ -1 +1,3 @@
|
||||||
module.exports = require('..').default;
|
import embarkWhisper from '..';
|
||||||
|
|
||||||
|
module.exports = embarkWhisper;
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"composite": true,
|
||||||
|
"declarationDir": "./dist",
|
||||||
|
"rootDir": "./src",
|
||||||
|
"tsBuildInfoFile": "./node_modules/.cache/tsc/tsconfig.embarkjs-whisper.tsbuildinfo"
|
||||||
|
},
|
||||||
|
"extends": "../../../tsconfig.base.json",
|
||||||
|
"include": [
|
||||||
|
"src/**/*"
|
||||||
|
]
|
||||||
|
}
|
|
@ -25,21 +25,21 @@
|
||||||
"url": "https://github.com/embark-framework/embark.git"
|
"url": "https://github.com/embark-framework/embark.git"
|
||||||
},
|
},
|
||||||
"main": "./dist/index.js",
|
"main": "./dist/index.js",
|
||||||
|
"types": "./dist/index.d.ts",
|
||||||
"embark-collective": {
|
"embark-collective": {
|
||||||
"build:node": true
|
"build:node": true,
|
||||||
|
"typecheck": true
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"_build": "npm run solo -- build",
|
"_build": "npm run solo -- build",
|
||||||
|
"_typecheck": "npm run solo -- typecheck",
|
||||||
"ci": "npm run qa",
|
"ci": "npm run qa",
|
||||||
"clean": "npm run reset",
|
"clean": "npm run reset",
|
||||||
"lint": "npm-run-all lint:*",
|
"lint": "npm-run-all lint:*",
|
||||||
"lint:ts": "tslint -c tslint.json \"src/**/*.ts\"",
|
"lint:ts": "tslint -c tslint.json \"src/**/*.ts\"",
|
||||||
"qa": "npm-run-all lint typecheck _build",
|
"qa": "npm-run-all lint _typecheck _build",
|
||||||
"reset": "npx rimraf dist embark-*.tgz package",
|
"reset": "npx rimraf dist embark-*.tgz package",
|
||||||
"solo": "embark-solo",
|
"solo": "embark-solo"
|
||||||
"typecheck": "tsc",
|
|
||||||
"watch": "run-p watch:*",
|
|
||||||
"watch:typecheck": "npm run typecheck -- --preserveWatchOutput --watch"
|
|
||||||
},
|
},
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
"extends": "../../../.eslintrc.json"
|
"extends": "../../../.eslintrc.json"
|
||||||
|
@ -59,8 +59,8 @@
|
||||||
"eslint": "5.7.0",
|
"eslint": "5.7.0",
|
||||||
"npm-run-all": "4.1.5",
|
"npm-run-all": "4.1.5",
|
||||||
"rimraf": "3.0.0",
|
"rimraf": "3.0.0",
|
||||||
"tslint": "5.16.0",
|
"tslint": "5.20.1",
|
||||||
"typescript": "3.6.3"
|
"typescript": "3.7.2"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=10.17.0 <12.0.0",
|
"node": ">=10.17.0 <12.0.0",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import async from "async";
|
import async from "async";
|
||||||
import { Callback, Embark, Events } /* supplied by @types/embark in packages/embark-typings */ from "embark";
|
import { Embark, EmbarkEvents } from "embark-core";
|
||||||
import { __ } from "embark-i18n";
|
import { __ } from "embark-i18n";
|
||||||
import { AccountParser, dappPath } from "embark-utils";
|
import { AccountParser, dappPath } from "embark-utils";
|
||||||
import { Logger } from 'embark-logger';
|
import { Logger } from 'embark-logger';
|
||||||
|
@ -9,7 +9,7 @@ import fundAccount from "./fundAccount";
|
||||||
|
|
||||||
export default class AccountsManager {
|
export default class AccountsManager {
|
||||||
private readonly logger: Logger;
|
private readonly logger: Logger;
|
||||||
private readonly events: Events;
|
private readonly events: EmbarkEvents;
|
||||||
private _web3: Web3 | null = null;
|
private _web3: Web3 | null = null;
|
||||||
private _accounts: any[] | null = null;
|
private _accounts: any[] | null = null;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,26 @@
|
||||||
{
|
{
|
||||||
"compilerOptions": { "baseUrl": ".", "paths": { "*": ["types/*"] } },
|
"compilerOptions": {
|
||||||
"extends": "../../../tsconfig.json",
|
"composite": true,
|
||||||
"include": ["src/**/*"]
|
"declarationDir": "./dist",
|
||||||
|
"rootDir": "./src",
|
||||||
|
"tsBuildInfoFile": "./node_modules/.cache/tsc/tsconfig.embark-accounts-manager.tsbuildinfo"
|
||||||
|
},
|
||||||
|
"extends": "../../../tsconfig.base.json",
|
||||||
|
"include": [
|
||||||
|
"src/**/*"
|
||||||
|
],
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"path": "../../core/core"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../../core/i18n"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../../core/logger"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../../core/utils"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,15 +25,23 @@
|
||||||
"url": "https://github.com/embark-framework/embark.git"
|
"url": "https://github.com/embark-framework/embark.git"
|
||||||
},
|
},
|
||||||
"main": "./dist/index.js",
|
"main": "./dist/index.js",
|
||||||
|
"types": "./dist/index.d.ts",
|
||||||
"embark-collective": {
|
"embark-collective": {
|
||||||
"build:node": true
|
"build:node": true,
|
||||||
|
"typecheck": {
|
||||||
|
"exclude": [
|
||||||
|
"src/babel-loader-overrides.js",
|
||||||
|
"src/webpack.config.js"
|
||||||
|
]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"_build": "npm run solo -- build",
|
"_build": "npm run solo -- build",
|
||||||
|
"_typecheck": "npm run solo -- typecheck",
|
||||||
"ci": "npm run qa",
|
"ci": "npm run qa",
|
||||||
"clean": "npm run reset",
|
"clean": "npm run reset",
|
||||||
"lint": "eslint src/",
|
"lint": "eslint src/",
|
||||||
"qa": "npm-run-all lint _build test",
|
"qa": "npm-run-all lint _typecheck _build test",
|
||||||
"reset": "npx rimraf dist embark-*.tgz package",
|
"reset": "npx rimraf dist embark-*.tgz package",
|
||||||
"solo": "embark-solo",
|
"solo": "embark-solo",
|
||||||
"test": "jest"
|
"test": "jest"
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"composite": true,
|
||||||
|
"declarationDir": "./dist",
|
||||||
|
"rootDir": "./src",
|
||||||
|
"tsBuildInfoFile": "./node_modules/.cache/tsc/tsconfig.embark-basic-pipeline.tsbuildinfo"
|
||||||
|
},
|
||||||
|
"exclude": [
|
||||||
|
"src/babel-loader-overrides.js",
|
||||||
|
"src/webpack.config.js"
|
||||||
|
],
|
||||||
|
"extends": "../../../tsconfig.base.json",
|
||||||
|
"include": [
|
||||||
|
"src/**/*"
|
||||||
|
],
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"path": "../../core/core"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../../core/i18n"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../../core/utils"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../../utils/testing"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue