From 3693ebd90d29d5381ac5c3dd6f4d721d8ecd4f4e Mon Sep 17 00:00:00 2001 From: "Michael Bradley, Jr" Date: Thu, 20 Feb 2020 17:47:01 -0600 Subject: [PATCH] fix: ensure that packages properly specify their dependencies Many packages in the monorepo did not specify all of their dependencies; they were effectively relying on resolution in the monorepo's root `node_modules`. In a production release of `embark` and `embark[js]-*` packages this can lead to broken packages. To fix the problem currently and to help prevent it from happening again, make use of the `eslint-plugin-import` package's `import/no-extraneous-dependencies` and `import/no-unresolved` rules. In the root `tslint.json` set `"no-implicit-dependencies": true`, wich is the tslint equivalent of `import/no-extraneous-dependencies`; there is no tslint equivalent for `import/no-unresolved`, but we will eventually replace tslint with an eslint configuration that checks both `.js` and `.ts` files. For `import/no-unresolved` to work in our monorepo setup, in most packages add an `index.js` that has: ```js module.exports = require('./dist'); // or './dist/lib' in some cases ``` And point `"main"` in `package.json` to `"./index.js"`. Despite what's indicated in npm's documentation for `package.json`, it's also necessary to add `"index.js"` to the `"files"` array. Make sure that all `.js` files that can and should be linted are in fact linted. For example, files in `packages/embark/src/cmd/` weren't being linted and many test suites weren't being linted. Bump all relevant packages to `eslint@6.8.0`. Fix all linter errors that arose after these changes. Implement a `check-yarn-lock` script that's run as part of `"ci:full"` and `"qa:full"`, and can manually be invoked via `yarn cylock` in the root of the monorepo. The script exits with error if any specifiers are found in `yarn.lock` for `embark[js][-*]` and/or `@embarklabs/*` (with a few exceptions, cf. `scripts/check-yarn-lock.js`). --- .eslintrc.json | 21 +- babel.config.js | 56 +++--- dapps/tests/service/package.json | 9 +- package.json | 19 +- packages/cockpit/api-client/index.js | 1 + packages/cockpit/api-client/package.json | 7 +- packages/cockpit/ui/package.json | 2 +- .../ui/scripts/copy-monaco-to-public.js | 2 - packages/core/code-runner/index.js | 1 + packages/core/code-runner/package.json | 18 +- packages/core/code-runner/src/fs.js | 1 - .../core/code-runner/test/code-runner.spec.js | 7 +- packages/core/code-runner/tsconfig.json | 3 + packages/core/console/index.js | 1 + packages/core/console/package.json | 14 +- packages/core/console/test/console.spec.js | 3 +- packages/core/core/index.js | 1 + packages/core/core/package.json | 11 +- packages/core/core/src/ipc.js | 2 - packages/core/engine/index.js | 1 + packages/core/engine/package.json | 5 +- packages/core/i18n/index.js | 1 + packages/core/i18n/package.json | 3 +- packages/core/logger/index.js | 1 + packages/core/logger/package.json | 17 +- packages/core/logger/test/logger.spec.js | 3 +- packages/core/reset/bin.js | 5 - packages/core/reset/bin/reset | 3 + packages/core/reset/package.json | 12 +- packages/core/reset/src/index.js | 2 - packages/core/utils/index.js | 1 + packages/core/utils/package.json | 9 +- packages/core/utils/src/monorepo.js | 2 - packages/embark/.babelrc.js | 2 - packages/embark/bin/embark | 1 + packages/embark/package.json | 12 +- packages/embark/scripts/test.js | 2 - packages/embark/src/bin/embark.js | 2 - .../embark/src/cmd/dashboard/dashboard.js | 4 +- packages/embark/src/lib/index.js | 30 --- .../embark/src/lib/utils/checkDependencies.js | 2 - packages/embark/src/test/accountParser.js | 8 +- packages/embark/src/test/cmd.js | 9 +- packages/embark/src/test/contracts.js | 30 +-- packages/embark/src/test/events.js | 24 ++- .../src/test/modules/compiler/compiler.js | 4 +- .../src/test/modules/solidity/solidity.js | 9 +- packages/embark/src/test/plugins.spec.js | 3 +- packages/embark/src/test/vm.js | 8 + packages/embark/src/test/vm_fs.js | 3 +- packages/embarkjs/embarkjs/.babelrc.js | 6 +- packages/embarkjs/embarkjs/index.js | 1 + packages/embarkjs/embarkjs/package.json | 15 +- packages/embarkjs/embarkjs/src/lib/utils.js | 5 +- .../embarkjs/src/test/helpers/blockchain.js | 2 - packages/embarkjs/ens/.babelrc.js | 6 +- packages/embarkjs/ens/index.js | 1 + packages/embarkjs/ens/package.json | 13 +- packages/embarkjs/ipfs/.babelrc.js | 6 +- packages/embarkjs/ipfs/index.js | 1 + packages/embarkjs/ipfs/package.json | 12 +- packages/embarkjs/swarm/.babelrc.js | 6 +- packages/embarkjs/swarm/index.js | 1 + packages/embarkjs/swarm/package.json | 10 +- packages/embarkjs/web3/.babelrc.js | 6 +- packages/embarkjs/web3/index.js | 1 + packages/embarkjs/web3/package.json | 10 +- packages/embarkjs/web3/src/index.js | 2 - packages/embarkjs/whisper/.babelrc.js | 6 +- packages/embarkjs/whisper/index.js | 1 + packages/embarkjs/whisper/package.json | 13 +- .../whisper/src/communicationFunctions.js | 2 - packages/embarkjs/whisper/src/index.js | 1 - packages/plugins/accounts-manager/index.js | 1 + .../plugins/accounts-manager/package.json | 7 +- packages/plugins/basic-pipeline/index.js | 1 + packages/plugins/basic-pipeline/package.json | 16 +- packages/plugins/basic-pipeline/src/env.js | 2 - .../basic-pipeline/src/webpack.config.js | 2 - packages/plugins/basic-pipeline/test/index.js | 1 + packages/plugins/coverage/index.js | 1 + packages/plugins/coverage/package.json | 15 +- .../test/{printer.spec.ts => printer.spec.js} | 11 +- packages/plugins/debugger/index.js | 1 + packages/plugins/debugger/package.json | 5 +- packages/plugins/deploy-tracker/index.js | 1 + packages/plugins/deploy-tracker/package.json | 14 +- packages/plugins/deploy-tracker/tsconfig.json | 6 + packages/plugins/ens/index.js | 1 + packages/plugins/ens/package.json | 9 +- packages/plugins/ens/src/index.js | 47 ++--- packages/plugins/ens/test/index.js | 6 +- .../ethereum-blockchain-client/index.js | 1 + .../ethereum-blockchain-client/package.json | 8 +- packages/plugins/ganache/index.js | 1 + packages/plugins/ganache/package.json | 7 +- packages/plugins/geth/index.js | 1 + packages/plugins/geth/package.json | 7 +- packages/plugins/graph/index.js | 1 + packages/plugins/graph/package.json | 7 +- packages/plugins/ipfs/index.js | 1 + packages/plugins/ipfs/package.json | 9 +- packages/plugins/mocha-tests/index.js | 1 + packages/plugins/mocha-tests/package.json | 13 +- packages/plugins/nethermind/index.js | 1 + packages/plugins/nethermind/package.json | 8 +- packages/plugins/nethermind/tsconfig.json | 3 + packages/plugins/parity/index.js | 1 + packages/plugins/parity/package.json | 8 +- packages/plugins/parity/tsconfig.json | 3 + packages/plugins/plugin-cmd/index.js | 1 + packages/plugins/plugin-cmd/package.json | 7 +- packages/plugins/profiler/index.js | 1 + packages/plugins/profiler/package.json | 7 +- packages/plugins/rpc-manager/index.js | 1 + packages/plugins/rpc-manager/package.json | 13 +- packages/plugins/scaffolding/index.js | 1 + packages/plugins/scaffolding/package.json | 7 +- packages/plugins/scripts-runner/index.js | 1 + packages/plugins/scripts-runner/package.json | 23 ++- .../scripts-runner/test/script-runner.spec.js | 28 +-- packages/plugins/snark/index.js | 1 + packages/plugins/snark/package.json | 20 +- packages/plugins/solc/index.js | 1 + packages/plugins/solc/package.json | 7 +- packages/plugins/solc/src/index.js | 1 - packages/plugins/solidity-tests/index.js | 1 + packages/plugins/solidity-tests/package.json | 13 +- packages/plugins/solidity/index.js | 1 + packages/plugins/solidity/package.json | 8 +- packages/plugins/specialconfigs/index.js | 1 + packages/plugins/specialconfigs/package.json | 8 +- .../specialconfigs/src/functionConfigs.js | 40 ++-- packages/plugins/specialconfigs/src/index.js | 2 - packages/plugins/suggestions/index.js | 1 + packages/plugins/suggestions/package.json | 14 +- packages/plugins/swarm/index.js | 1 + packages/plugins/swarm/package.json | 9 +- packages/plugins/transaction-logger/index.js | 1 + .../plugins/transaction-logger/package.json | 7 +- packages/plugins/transaction-tracker/index.js | 1 + .../plugins/transaction-tracker/package.json | 10 +- packages/plugins/vyper/index.js | 1 + packages/plugins/vyper/package.json | 7 +- packages/plugins/web3/index.js | 1 + packages/plugins/web3/package.json | 11 +- packages/plugins/web3/tsconfig.json | 3 + packages/plugins/whisper-geth/index.js | 1 + packages/plugins/whisper-geth/package.json | 13 +- .../plugins/whisper-geth/src/blockchain.js | 1 - .../whisper-geth/src/whisperGethClient.js | 1 - packages/plugins/whisper-geth/tsconfig.json | 6 + packages/plugins/whisper-parity/index.js | 1 + packages/plugins/whisper-parity/package.json | 8 +- packages/plugins/whisper-parity/tsconfig.json | 3 + packages/stack/api/index.js | 1 + packages/stack/api/package.json | 8 +- packages/stack/authenticator/index.js | 1 + packages/stack/authenticator/package.json | 7 +- packages/stack/blockchain/index.js | 1 + packages/stack/blockchain/package.json | 19 +- packages/stack/blockchain/test/index.js | 1 + packages/stack/communication/index.js | 1 + packages/stack/communication/package.json | 17 +- .../communication/test/communication.spec.js | 13 +- packages/stack/compiler/index.js | 1 + packages/stack/compiler/package.json | 16 +- packages/stack/compiler/src/index.ts | 3 +- packages/stack/compiler/test/compiler.spec.js | 21 +- packages/stack/contracts-manager/index.js | 1 + packages/stack/contracts-manager/package.json | 5 +- packages/stack/deployment/index.js | 1 + packages/stack/deployment/package.json | 19 +- .../stack/deployment/test/deployment.spec.js | 7 +- packages/stack/deployment/tsconfig.json | 3 + packages/stack/embarkjs/index.js | 1 + packages/stack/embarkjs/package.json | 10 +- packages/stack/embarkjs/tsconfig.json | 3 + packages/stack/library-manager/index.js | 1 + packages/stack/library-manager/package.json | 7 +- packages/stack/namesystem/index.js | 1 + packages/stack/namesystem/package.json | 7 +- packages/stack/pipeline/index.js | 1 + packages/stack/pipeline/package.json | 13 +- packages/stack/pipeline/tsconfig.json | 3 + .../stack/process-logs-api-manager/index.js | 1 + .../process-logs-api-manager/package.json | 7 +- packages/stack/proxy/index.js | 1 + packages/stack/proxy/package.json | 8 +- packages/stack/proxy/src/proxy.js | 20 +- packages/stack/storage/index.js | 1 + packages/stack/storage/package.json | 8 +- packages/stack/storage/processes.js | 1 - packages/stack/test-runner/index.js | 1 + packages/stack/test-runner/package.json | 16 +- packages/stack/test-runner/src/lib/index.js | 37 ++-- packages/stack/test-runner/tsconfig.json | 3 + packages/stack/watcher/index.js | 1 + packages/stack/watcher/package.json | 7 +- packages/stack/webserver/index.js | 1 + packages/stack/webserver/package.json | 8 +- packages/utils/collective/bin/collective | 2 - packages/utils/collective/package.json | 7 +- packages/utils/collective/{ => src}/index.js | 35 ++-- packages/utils/inside-monorepo/package.json | 9 +- .../utils/inside-monorepo/{ => src}/index.js | 0 packages/utils/solo/bin/solo | 2 - packages/utils/solo/package.json | 9 +- packages/utils/solo/{ => src}/index.js | 7 - packages/utils/testing/index.js | 1 + packages/utils/testing/package.json | 18 +- .../utils/testing/src/{lib => }/embark.js | 0 .../utils/testing/src/{lib => }/events.js | 0 .../utils/testing/src/{lib => }/httpServer.ts | 2 - packages/utils/testing/src/{lib => }/index.js | 0 .../utils/testing/src/{lib => }/plugin.js | 0 packages/utils/testing/test/testing_test.js | 3 - packages/utils/testing/tsconfig.json | 2 +- scripts/check-working-tree.js | 2 - scripts/check-yarn-lock.js | 33 ++++ scripts/coverage-collect.js | 2 - scripts/coverage-collector.js | 2 - scripts/coverage-report.js | 2 - scripts/coveralls-branch-name.js | 2 - scripts/coveralls-pr-id.js | 2 - scripts/globalize.js | 4 +- scripts/monorun.js | 2 - scripts/nightly-release.js | 2 - scripts/release.js | 3 +- scripts/stable-release.js | 3 +- tslint.json | 7 +- yarn.lock | 184 ++++++------------ 232 files changed, 985 insertions(+), 723 deletions(-) create mode 100644 packages/cockpit/api-client/index.js create mode 100644 packages/core/code-runner/index.js create mode 100644 packages/core/console/index.js create mode 100644 packages/core/core/index.js create mode 100644 packages/core/engine/index.js create mode 100644 packages/core/i18n/index.js create mode 100644 packages/core/logger/index.js delete mode 100755 packages/core/reset/bin.js create mode 100755 packages/core/reset/bin/reset create mode 100644 packages/core/utils/index.js delete mode 100644 packages/embark/src/lib/index.js create mode 100644 packages/embarkjs/embarkjs/index.js create mode 100644 packages/embarkjs/ens/index.js create mode 100644 packages/embarkjs/ipfs/index.js create mode 100644 packages/embarkjs/swarm/index.js create mode 100644 packages/embarkjs/web3/index.js create mode 100644 packages/embarkjs/whisper/index.js create mode 100644 packages/plugins/accounts-manager/index.js create mode 100644 packages/plugins/basic-pipeline/index.js create mode 100644 packages/plugins/coverage/index.js rename packages/plugins/coverage/src/test/{printer.spec.ts => printer.spec.js} (86%) create mode 100644 packages/plugins/debugger/index.js create mode 100644 packages/plugins/deploy-tracker/index.js create mode 100644 packages/plugins/ens/index.js create mode 100644 packages/plugins/ethereum-blockchain-client/index.js create mode 100644 packages/plugins/ganache/index.js create mode 100644 packages/plugins/geth/index.js create mode 100644 packages/plugins/graph/index.js create mode 100644 packages/plugins/ipfs/index.js create mode 100644 packages/plugins/mocha-tests/index.js create mode 100644 packages/plugins/nethermind/index.js create mode 100644 packages/plugins/parity/index.js create mode 100644 packages/plugins/plugin-cmd/index.js create mode 100644 packages/plugins/profiler/index.js create mode 100644 packages/plugins/rpc-manager/index.js create mode 100644 packages/plugins/scaffolding/index.js create mode 100644 packages/plugins/scripts-runner/index.js create mode 100644 packages/plugins/snark/index.js create mode 100644 packages/plugins/solc/index.js create mode 100644 packages/plugins/solidity-tests/index.js create mode 100644 packages/plugins/solidity/index.js create mode 100644 packages/plugins/specialconfigs/index.js create mode 100644 packages/plugins/suggestions/index.js create mode 100644 packages/plugins/swarm/index.js create mode 100644 packages/plugins/transaction-logger/index.js create mode 100644 packages/plugins/transaction-tracker/index.js create mode 100644 packages/plugins/vyper/index.js create mode 100644 packages/plugins/web3/index.js create mode 100644 packages/plugins/whisper-geth/index.js create mode 100644 packages/plugins/whisper-parity/index.js create mode 100644 packages/stack/api/index.js create mode 100644 packages/stack/authenticator/index.js create mode 100644 packages/stack/blockchain/index.js create mode 100644 packages/stack/communication/index.js create mode 100644 packages/stack/compiler/index.js create mode 100644 packages/stack/contracts-manager/index.js create mode 100644 packages/stack/deployment/index.js create mode 100644 packages/stack/embarkjs/index.js create mode 100644 packages/stack/library-manager/index.js create mode 100644 packages/stack/namesystem/index.js create mode 100644 packages/stack/pipeline/index.js create mode 100644 packages/stack/process-logs-api-manager/index.js create mode 100644 packages/stack/proxy/index.js create mode 100644 packages/stack/storage/index.js delete mode 100644 packages/stack/storage/processes.js create mode 100644 packages/stack/test-runner/index.js create mode 100644 packages/stack/watcher/index.js create mode 100644 packages/stack/webserver/index.js rename packages/utils/collective/{ => src}/index.js (93%) rename packages/utils/inside-monorepo/{ => src}/index.js (100%) rename packages/utils/solo/{ => src}/index.js (81%) create mode 100644 packages/utils/testing/index.js rename packages/utils/testing/src/{lib => }/embark.js (100%) rename packages/utils/testing/src/{lib => }/events.js (100%) rename packages/utils/testing/src/{lib => }/httpServer.ts (98%) rename packages/utils/testing/src/{lib => }/index.js (100%) rename packages/utils/testing/src/{lib => }/plugin.js (100%) create mode 100644 scripts/check-yarn-lock.js diff --git a/.eslintrc.json b/.eslintrc.json index b793f0b95..19626951d 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -5,10 +5,12 @@ "node": true }, "extends": [ - "eslint:recommended" + "eslint:recommended", + "plugin:import/typescript" ], "parser": "babel-eslint", "plugins": [ + "import", "react" ], "rules": { @@ -72,6 +74,8 @@ "id-blacklist": "error", "id-length": "off", "id-match": "error", + "import/no-extraneous-dependencies": "error", + "import/no-unresolved": [2, { "commonjs": true }], "indent": "off", "indent-legacy": "off", "init-declarations": "off", @@ -102,7 +106,6 @@ "no-bitwise": "error", "no-buffer-constructor": "error", "no-caller": "error", - "no-catch-shadow": "error", "no-confusing-arrow": "error", "no-console": "off", "no-continue": "off", @@ -280,5 +283,19 @@ "error", "never" ] + }, + "settings": { + "import/resolver": { + "node": { + "extensions": [ + ".d.ts", + ".js", + ".json", + ".jsx", + ".ts", + ".tsx" + ] + } + } } } diff --git a/babel.config.js b/babel.config.js index cddba42bb..7857db2ca 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,5 +1,3 @@ -/* global module require */ - /* * dependencies of this config should be specified in `./package.json` relative * to this config file (which should be in the root of the monorepo); @@ -21,20 +19,26 @@ module.exports = (api) => { ], plugins: [ 'babel-plugin-macros', - ['@babel/plugin-proposal-decorators', { - legacy: true - }], + [ + '@babel/plugin-proposal-decorators', { + legacy: true + } + ], '@babel/plugin-proposal-export-namespace-from', '@babel/plugin-proposal-export-default-from', '@babel/plugin-syntax-dynamic-import', - ['@babel/plugin-proposal-class-properties', { - loose: true - }], + [ + '@babel/plugin-proposal-class-properties', { + loose: true + } + ], '@babel/plugin-proposal-nullish-coalescing-operator', '@babel/plugin-proposal-optional-chaining', - ['@babel/plugin-transform-runtime', { - corejs: 3 - }] + [ + '@babel/plugin-transform-runtime', { + corejs: 3 + } + ] ], presets: [ '@babel/preset-env', @@ -48,13 +52,15 @@ module.exports = (api) => { const browser = cloneDeep(base); browser.plugins[browser.plugins.length - 1][1].useESModules = true; - browser.presets[0] = [browser.presets[0], { - corejs: 3, - modules: false, - shippedProposals: true, - targets: {browsers: ['last 1 version', 'not dead', '> 0.2%']}, - useBuiltIns: 'usage' - }]; + browser.presets[0] = [ + browser.presets[0], { + corejs: 3, + modules: false, + shippedProposals: true, + targets: {browsers: ['last 1 version', 'not dead', '> 0.2%']}, + useBuiltIns: 'usage' + } + ]; if (env === 'browser' || env.startsWith('browser:')) { return browser; @@ -66,12 +72,14 @@ module.exports = (api) => { 0, 'babel-plugin-dynamic-import-node' ); - node.presets[0] = [node.presets[0], { - corejs: 3, - shippedProposals: true, - targets: {node: '10.17.0'}, - useBuiltIns: 'usage' - }]; + node.presets[0] = [ + node.presets[0], { + corejs: 3, + shippedProposals: true, + targets: {node: '10.17.0'}, + useBuiltIns: 'usage' + } + ]; if (env === 'node' || env.startsWith('node:')) { return node; diff --git a/dapps/tests/service/package.json b/dapps/tests/service/package.json index 5d9d82a80..fc06705cc 100644 --- a/dapps/tests/service/package.json +++ b/dapps/tests/service/package.json @@ -4,15 +4,22 @@ "haml": "0.4.3" }, "devDependencies": { + "eslint": "6.8.0", "rimraf": "3.0.0" }, "license": "MIT", - "main": "index.js", + "main": "./index.js", "name": "embark-dapp-test-service", "private": true, "scripts": { + "ci": "npm run qa", "clean": "npm run reset", + "lint": "eslint *.js", + "qa": "npm-run-all lint", "reset": "npx rimraf embark-*.tgz package" }, + "eslintConfig": { + "extends": "../../../.eslintrc.json" + }, "version": "5.0.0" } diff --git a/package.json b/package.json index 3a461cb70..06ad867bf 100644 --- a/package.json +++ b/package.json @@ -12,12 +12,14 @@ "@babel/plugin-transform-runtime": "7.7.4", "@babel/preset-env": "7.7.4", "@babel/preset-typescript": "7.7.4", + "@typescript-eslint/parser": "2.20.0", "babel-eslint": "10.0.3", "babel-plugin-dynamic-import-node": "2.3.0", "babel-plugin-macros": "2.7.1", "chalk": "2.4.2", "coveralls": "3.0.9", - "eslint": "6.2.2", + "eslint": "6.8.0", + "eslint-plugin-import": "2.18.2", "find-up": "4.1.0", "form-data": "2.5.1", "fs-extra": "8.1.0", @@ -27,7 +29,8 @@ "npm-run-all": "4.1.5", "nyc": "13.1.0", "rimraf": "3.0.0", - "semver": "5.6.0" + "semver": "5.6.0", + "typescript": "3.7.2" }, "engines": { "node": ">=10.17.0", @@ -42,7 +45,7 @@ "build:no-ui": "npm run build -- --ignore embark-ui", "ci": "node scripts/monorun --ignore embark-dapp-* --stream ci", "ci:dapps": "lerna run --concurrency=1 --scope embark-dapp-* --stream ci", - "ci:full": "npm-run-all cwtree typecheck \"lint -- --concurrency={1}\" build:no-ui \"test -- --concurrency={1}\" ci:dapps cwtree -- 1", + "ci:full": "npm-run-all cylock cwtree typecheck lint build:no-ui \"test -- --concurrency={1}\" ci:dapps cwtree -- 1", "clean": "node scripts/monorun --stream clean", "clean:full": "npx npm-run-all clean clean:top", "clean:top": "npm run reset:top && npx rimraf node_modules", @@ -52,9 +55,12 @@ "coverage:report": "node scripts/coverage-report", "coveralls": "npm-run-all coverage:collect coverage:coveralls", "cwtree": "node scripts/check-working-tree", + "cylock": "node scripts/check-yarn-lock", "deploy:site": "node site/deploy-site", "globalize": "node scripts/globalize", - "lint": "node scripts/monorun --parallel lint", + "lint": "npm-run-all lint:*", + "lint:packages": "node scripts/monorun --parallel lint", + "lint:top": "eslint *.js scripts/", "package": "lerna exec --concurrency=1 --no-private --stream -- npm pack", "postclean": "npx lerna clean --yes", "postreboot": "yarn install", @@ -63,7 +69,7 @@ "preqa:full": "yarn install", "qa": "node scripts/monorun --ignore embark-dapp-* --stream qa", "qa:dapps": "lerna run --concurrency=1 --scope embark-dapp-* --stream qa", - "qa:full": "npm-run-all cwtree reboot:full cwtree typecheck \"lint -- --concurrency={1}\" build \"test -- --concurrency={1}\" qa:dapps cwtree -- 1", + "qa:full": "npm-run-all cylock cwtree reboot:full cwtree typecheck lint build \"test -- --concurrency={1}\" qa:dapps cwtree -- 1", "reboot": "npm run clean", "reboot:full": "npm run clean:full", "release": "node scripts/release", @@ -84,6 +90,9 @@ "watch:test": "node scripts/monorun --ignore embark-dapp-* --parallel watch:test", "watch:typecheck": "node scripts/monorun --parallel watch:typecheck" }, + "eslintConfig": { + "extends": "./.eslintrc.json" + }, "workspaces": { "packages": [ "dapps/templates/*", diff --git a/packages/cockpit/api-client/index.js b/packages/cockpit/api-client/index.js new file mode 100644 index 000000000..cce693358 --- /dev/null +++ b/packages/cockpit/api-client/index.js @@ -0,0 +1 @@ +module.exports = require('./dist'); diff --git a/packages/cockpit/api-client/package.json b/packages/cockpit/api-client/package.json index 2d6f81be3..35d5a4cbf 100644 --- a/packages/cockpit/api-client/package.json +++ b/packages/cockpit/api-client/package.json @@ -21,10 +21,11 @@ "type": "git", "url": "https://github.com/embarklabs/embark.git" }, - "main": "./dist/index.js", + "main": "./index.js", "types": "./dist/index.d.ts", "files": [ - "dist" + "dist", + "index.js" ], "embark-collective": { "build:node": true, @@ -51,7 +52,7 @@ }, "devDependencies": { "embark-solo": "^5.1.1", - "eslint": "5.7.0", + "eslint": "6.8.0", "npm-run-all": "4.1.5", "rimraf": "3.0.0" }, diff --git a/packages/cockpit/ui/package.json b/packages/cockpit/ui/package.json index abf9a2f93..168cfc9a1 100644 --- a/packages/cockpit/ui/package.json +++ b/packages/cockpit/ui/package.json @@ -29,7 +29,7 @@ "build-storybook": "build-storybook -s public", "ci": "npm-run-all lint test", "clean": "npm run reset", - "lint": "eslint src/", + "lint": "eslint scripts/ src/", "prebuild": "node scripts/copy-monaco-to-public", "prestart": "node scripts/copy-monaco-to-public dev", "qa": "npm-run-all lint test build", diff --git a/packages/cockpit/ui/scripts/copy-monaco-to-public.js b/packages/cockpit/ui/scripts/copy-monaco-to-public.js index 88ebcf908..785063b34 100644 --- a/packages/cockpit/ui/scripts/copy-monaco-to-public.js +++ b/packages/cockpit/ui/scripts/copy-monaco-to-public.js @@ -1,5 +1,3 @@ -/* global __dirname process require */ - const findUp = require('find-up'); const {copy, ensureDir} = require('fs-extra'); const path = require('path'); diff --git a/packages/core/code-runner/index.js b/packages/core/code-runner/index.js new file mode 100644 index 000000000..cce693358 --- /dev/null +++ b/packages/core/code-runner/index.js @@ -0,0 +1 @@ +module.exports = require('./dist'); diff --git a/packages/core/code-runner/package.json b/packages/core/code-runner/package.json index c56a2cbdc..8acb5838f 100644 --- a/packages/core/code-runner/package.json +++ b/packages/core/code-runner/package.json @@ -16,7 +16,8 @@ "solidity" ], "files": [ - "dist" + "dist", + "index.js" ], "license": "MIT", "repository": { @@ -24,7 +25,7 @@ "type": "git", "url": "https://github.com/embarklabs/embark.git" }, - "main": "./dist/index.js", + "main": "./index.js", "types": "./dist/index.d.ts", "embark-collective": { "build:node": true, @@ -36,7 +37,7 @@ "ci": "npm run qa", "clean": "npm run reset", "lint": "npm-run-all lint:*", - "lint:js": "eslint src/", + "lint:js": "eslint src/ test/", "lint:ts": "tslint -c tslint.json \"src/**/*.ts\"", "qa": "npm-run-all lint _typecheck _build test", "reset": "npx rimraf dist embark-*.tgz package", @@ -44,7 +45,11 @@ "test": "jest" }, "eslintConfig": { - "extends": "../../../.eslintrc.json" + "extends": [ + "../../../.eslintrc.json", + "plugin:jest/recommended", + "plugin:jest/style" + ] }, "dependencies": { "@babel/runtime-corejs3": "7.7.7", @@ -53,6 +58,7 @@ "colors": "1.4.0", "core-js": "3.6.2", "embark-core": "^5.2.2", + "embark-i18n": "^5.1.1", "embark-logger": "^5.2.0", "embark-utils": "^5.2.0", "embarkjs": "^5.2.3-nightly.0", @@ -66,10 +72,12 @@ "babel-jest": "24.9.0", "embark-solo": "^5.1.1", "embark-testing": "^5.2.0", - "eslint": "5.7.0", + "eslint": "6.8.0", + "eslint-plugin-jest": "22.5.1", "jest": "24.9.0", "npm-run-all": "4.1.5", "rimraf": "3.0.0", + "sinon": "7.4.2", "tslint": "5.20.1", "typescript": "3.7.2" }, diff --git a/packages/core/code-runner/src/fs.js b/packages/core/code-runner/src/fs.js index dd011a340..4560a3e78 100644 --- a/packages/core/code-runner/src/fs.js +++ b/packages/core/code-runner/src/fs.js @@ -1,4 +1,3 @@ -/* global module process require */ const fs = require('fs-extra'); const os = require('os'); const parseJson = require('parse-json'); diff --git a/packages/core/code-runner/test/code-runner.spec.js b/packages/core/code-runner/test/code-runner.spec.js index 7238a7892..9a3f3577f 100644 --- a/packages/core/code-runner/test/code-runner.spec.js +++ b/packages/core/code-runner/test/code-runner.spec.js @@ -9,13 +9,13 @@ process.env.DAPP_PATH = 'something'; describe('core/code-runner', () => { - const { embark, plugins } = fakeEmbark(); + const { embark } = fakeEmbark(); - let codeRunner, doneCb; + // eslint-disable-next-line no-unused-vars + let codeRunner; beforeEach(() => { codeRunner = new CodeRunner(embark); - doneCb = sinon.fake(); }); afterEach(() => { @@ -42,4 +42,3 @@ describe('core/code-runner', () => { await embark.events.request2('runcode:eval', `testVar.foo = 'bar';`); }); }); - diff --git a/packages/core/code-runner/tsconfig.json b/packages/core/code-runner/tsconfig.json index 9b46c1fd5..eef6e065d 100644 --- a/packages/core/code-runner/tsconfig.json +++ b/packages/core/code-runner/tsconfig.json @@ -19,6 +19,9 @@ { "path": "../core" }, + { + "path": "../i18n" + }, { "path": "../logger" }, diff --git a/packages/core/console/index.js b/packages/core/console/index.js new file mode 100644 index 000000000..cce693358 --- /dev/null +++ b/packages/core/console/index.js @@ -0,0 +1 @@ +module.exports = require('./dist'); diff --git a/packages/core/console/package.json b/packages/core/console/package.json index 21cb24e80..c1b47f696 100644 --- a/packages/core/console/package.json +++ b/packages/core/console/package.json @@ -16,7 +16,8 @@ "solidity" ], "files": [ - "dist" + "dist", + "index.js" ], "license": "MIT", "repository": { @@ -24,7 +25,7 @@ "type": "git", "url": "https://github.com/embarklabs/embark.git" }, - "main": "./dist/index.js", + "main": "./index.js", "types": "./dist/index.d.ts", "embark-collective": { "build:node": true, @@ -36,6 +37,7 @@ "ci": "npm run qa", "clean": "npm run reset", "lint": "npm-run-all lint:*", + "lint:js": "eslint test/", "lint:ts": "tslint -c tslint.json \"src/**/*.ts\"", "qa": "npm-run-all lint _typecheck _build test", "reset": "npx rimraf .nyc_output coverage dist embark-*.tgz package", @@ -43,7 +45,11 @@ "test": "jest" }, "eslintConfig": { - "extends": "../../../.eslintrc.json" + "extends": [ + "../../../.eslintrc.json", + "plugin:jest/recommended", + "plugin:jest/style" + ] }, "dependencies": { "@babel/runtime-corejs3": "7.7.4", @@ -62,6 +68,8 @@ "embark-logger": "^5.2.0", "embark-solo": "^5.1.1", "embark-testing": "^5.2.0", + "eslint": "6.8.0", + "eslint-plugin-jest": "22.5.1", "jest": "24.9.0", "npm-run-all": "4.1.5", "rimraf": "3.0.0", diff --git a/packages/core/console/test/console.spec.js b/packages/core/console/test/console.spec.js index 9f59c0a02..11f266e95 100644 --- a/packages/core/console/test/console.spec.js +++ b/packages/core/console/test/console.spec.js @@ -1,4 +1,3 @@ -/*globals describe, it*/ import assert from 'assert'; import { fakeEmbark } from 'embark-testing'; import Console from '../src'; @@ -10,7 +9,7 @@ process.env.DAPP_PATH = 'something'; describe('core/console', () => { - const { embark, plugins } = fakeEmbark(); + const { embark } = fakeEmbark(); let console; diff --git a/packages/core/core/index.js b/packages/core/core/index.js new file mode 100644 index 000000000..cce693358 --- /dev/null +++ b/packages/core/core/index.js @@ -0,0 +1 @@ +module.exports = require('./dist'); diff --git a/packages/core/core/package.json b/packages/core/core/package.json index acb2fab7e..d4de7a3b8 100644 --- a/packages/core/core/package.json +++ b/packages/core/core/package.json @@ -18,6 +18,7 @@ "files": [ "constants.json", "dist", + "index.js", "process.js" ], "license": "MIT", @@ -26,7 +27,7 @@ "type": "git", "url": "https://github.com/embarklabs/embark.git" }, - "main": "./dist/index.js", + "main": "./index.js", "types": "./dist/index.d.ts", "embark-collective": { "build:node": true, @@ -38,7 +39,7 @@ "ci": "npm run qa", "clean": "npm run reset", "lint": "npm-run-all lint:*", - "lint:js": "eslint process.js src/", + "lint:js": "eslint src/", "lint:ts": "tslint -c tslint.json \"src/**/*.ts\"", "qa": "npm-run-all lint _typecheck _build", "reset": "npx rimraf dist embark-*.tgz package", @@ -50,6 +51,7 @@ "dependencies": { "@babel/runtime-corejs3": "7.7.4", "@types/deep-equal": "1.0.1", + "async": "2.6.1", "colors": "1.3.2", "core-js": "3.4.3", "decompress": "4.2.0", @@ -61,9 +63,12 @@ "flatted": "0.2.3", "fs-extra": "8.1.0", "globule": "1.2.1", + "hosted-git-info": "2.8.4", "lodash.clonedeep": "4.5.0", "node-ipc": "9.1.1", "parse-json": "4.0.0", + "request": "2.88.0", + "semver": "5.6.0", "shelljs": "0.8.3", "uuid": "3.3.2", "web3": "1.2.6", @@ -72,7 +77,7 @@ }, "devDependencies": { "embark-solo": "^5.1.1", - "eslint": "5.7.0", + "eslint": "6.8.0", "npm-run-all": "4.1.5", "rimraf": "3.0.0", "tslint": "5.20.1", diff --git a/packages/core/core/src/ipc.js b/packages/core/core/src/ipc.js index c4c7ae9b2..1301ea3b4 100644 --- a/packages/core/core/src/ipc.js +++ b/packages/core/core/src/ipc.js @@ -1,5 +1,3 @@ -/* global module process require */ - const ipc = require('node-ipc'); const {parse, stringify} = require('flatted/cjs'); const path = require('path'); diff --git a/packages/core/engine/index.js b/packages/core/engine/index.js new file mode 100644 index 000000000..cce693358 --- /dev/null +++ b/packages/core/engine/index.js @@ -0,0 +1 @@ +module.exports = require('./dist'); diff --git a/packages/core/engine/package.json b/packages/core/engine/package.json index a9f6e1475..aad6af794 100644 --- a/packages/core/engine/package.json +++ b/packages/core/engine/package.json @@ -16,7 +16,8 @@ "solidity" ], "files": [ - "dist" + "dist", + "index.js" ], "license": "MIT", "repository": { @@ -24,7 +25,7 @@ "type": "git", "url": "https://github.com/embarklabs/embark.git" }, - "main": "./dist/index.js", + "main": "./index.js", "types": "./dist/index.d.ts", "embark-collective": { "build:node": true, diff --git a/packages/core/i18n/index.js b/packages/core/i18n/index.js new file mode 100644 index 000000000..cce693358 --- /dev/null +++ b/packages/core/i18n/index.js @@ -0,0 +1 @@ +module.exports = require('./dist'); diff --git a/packages/core/i18n/package.json b/packages/core/i18n/package.json index aa39edebe..e7f3729a2 100644 --- a/packages/core/i18n/package.json +++ b/packages/core/i18n/package.json @@ -17,6 +17,7 @@ ], "files": [ "dist", + "index.js", "locales" ], "license": "MIT", @@ -25,7 +26,7 @@ "type": "git", "url": "https://github.com/embarklabs/embark.git" }, - "main": "./dist/index.js", + "main": "./index.js", "types": "./dist/index.d.ts", "embark-collective": { "build:node": true, diff --git a/packages/core/logger/index.js b/packages/core/logger/index.js new file mode 100644 index 000000000..cce693358 --- /dev/null +++ b/packages/core/logger/index.js @@ -0,0 +1 @@ +module.exports = require('./dist'); diff --git a/packages/core/logger/package.json b/packages/core/logger/package.json index dd39f9a56..1260b574b 100644 --- a/packages/core/logger/package.json +++ b/packages/core/logger/package.json @@ -16,7 +16,8 @@ "solidity" ], "files": [ - "dist" + "dist", + "index.js" ], "license": "MIT", "repository": { @@ -24,7 +25,7 @@ "type": "git", "url": "https://github.com/embarklabs/embark.git" }, - "main": "./dist/index.js", + "main": "./index.js", "types": "./dist/index.d.ts", "embark-collective": { "build:node": true, @@ -35,14 +36,18 @@ "_typecheck": "npm run solo -- typecheck", "ci": "npm run qa", "clean": "npm run reset", - "lint": "eslint src/", + "lint": "eslint src/ test/", "qa": "npm-run-all lint _typecheck _build test", "reset": "npx rimraf dist embark-*.tgz package", "solo": "embark-solo", "test": "jest" }, "eslintConfig": { - "extends": "../../../.eslintrc.json" + "extends": [ + "../../../.eslintrc.json", + "plugin:jest/recommended", + "plugin:jest/style" + ] }, "dependencies": { "@babel/runtime-corejs3": "7.8.3", @@ -58,9 +63,11 @@ "embark-solo": "^5.1.1", "embark-testing": "^5.2.0", "eslint": "6.8.0", + "eslint-plugin-jest": "22.5.1", "jest": "24.9.0", "npm-run-all": "4.1.5", - "rimraf": "3.0.0" + "rimraf": "3.0.0", + "sinon": "7.4.2" }, "engines": { "node": ">=10.17.0", diff --git a/packages/core/logger/test/logger.spec.js b/packages/core/logger/test/logger.spec.js index 11ee3bee3..390c58a7b 100644 --- a/packages/core/logger/test/logger.spec.js +++ b/packages/core/logger/test/logger.spec.js @@ -1,11 +1,10 @@ import assert from 'assert'; import sinon from 'sinon'; -import * as fs from 'fs'; import { fakeEmbark } from 'embark-testing'; describe('core/logger', () => { - const { embark, plugins } = fakeEmbark(); + const { embark } = fakeEmbark(); let logger, testLogFn, resolve; const logFile = 'embark.log'; diff --git a/packages/core/reset/bin.js b/packages/core/reset/bin.js deleted file mode 100755 index 5310da38c..000000000 --- a/packages/core/reset/bin.js +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env node - -/* global module require */ - -require('./src').reset(); diff --git a/packages/core/reset/bin/reset b/packages/core/reset/bin/reset new file mode 100755 index 000000000..561d72240 --- /dev/null +++ b/packages/core/reset/bin/reset @@ -0,0 +1,3 @@ +#!/usr/bin/env node + +require('..').reset(); diff --git a/packages/core/reset/package.json b/packages/core/reset/package.json index 77e835f0b..f503a9e6d 100644 --- a/packages/core/reset/package.json +++ b/packages/core/reset/package.json @@ -12,12 +12,11 @@ "type": "git", "url": "https://github.com/embarklabs/embark.git" }, - "bin": "./bin.js", + "bin": "./bin/reset", "main": "./src/index.js", "types": "./dist/index.d.ts", "files": [ - "bin.js", - "dist", + "bin", "src" ], "embark-collective": { @@ -27,15 +26,20 @@ "_typecheck": "npm run solo -- typecheck", "ci": "npm run qa", "clean": "npm run reset", - "qa": "npm-run-all _typecheck", + "lint": "eslint bin/reset src/", + "qa": "npm-run-all lint _typecheck", "reset": "npx rimraf dist embark-*.tgz package", "solo": "embark-solo" }, + "eslintConfig": { + "extends": "../../../.eslintrc.json" + }, "dependencies": { "rimraf": "3.0.0" }, "devDependencies": { "embark-solo": "^5.1.1", + "eslint": "6.8.0", "npm-run-all": "4.1.5" }, "engines": { diff --git a/packages/core/reset/src/index.js b/packages/core/reset/src/index.js index 9a0db0114..cdab430f8 100644 --- a/packages/core/reset/src/index.js +++ b/packages/core/reset/src/index.js @@ -1,5 +1,3 @@ -/* global exports process require */ - const {join} = require('path'); const {promisify} = require('util'); const rimraf = promisify(require('rimraf')); diff --git a/packages/core/utils/index.js b/packages/core/utils/index.js new file mode 100644 index 000000000..cce693358 --- /dev/null +++ b/packages/core/utils/index.js @@ -0,0 +1 @@ +module.exports = require('./dist'); diff --git a/packages/core/utils/package.json b/packages/core/utils/package.json index b9a718bdd..c21ef7c23 100644 --- a/packages/core/utils/package.json +++ b/packages/core/utils/package.json @@ -16,7 +16,8 @@ "solidity" ], "files": [ - "dist" + "dist", + "index.js" ], "license": "MIT", "repository": { @@ -24,7 +25,7 @@ "type": "git", "url": "https://github.com/embarklabs/embark.git" }, - "main": "./dist/index.js", + "main": "./index.js", "types": "./dist/index.d.ts", "embark-collective": { "build:node": true, @@ -52,6 +53,7 @@ "@types/fs-extra": "7.0.0", "@types/node": "12.7.8", "@types/pretty-ms": "5.0.1", + "async": "2.6.1", "bip39": "3.0.2", "clipboardy": "1.2.3", "colors": "1.3.2", @@ -68,6 +70,7 @@ "multihashes": "0.4.14", "ora": "4.0.3", "pretty-ms": "5.1.0", + "propose": "0.0.5", "shelljs": "0.8.3", "web3": "1.2.6", "web3-eth": "1.2.6", @@ -77,7 +80,7 @@ "devDependencies": { "embark-inside-monorepo": "^5.1.0", "embark-solo": "^5.1.1", - "eslint": "5.7.0", + "eslint": "6.8.0", "npm-run-all": "4.1.5", "rimraf": "3.0.0", "tslint": "5.20.1", diff --git a/packages/core/utils/src/monorepo.js b/packages/core/utils/src/monorepo.js index ecad8f438..3f9cb56f6 100644 --- a/packages/core/utils/src/monorepo.js +++ b/packages/core/utils/src/monorepo.js @@ -1,5 +1,3 @@ -/* global __dirname module require */ - const findUp = require('find-up'); const {readJson, readJsonSync} = require('fs-extra'); diff --git a/packages/embark/.babelrc.js b/packages/embark/.babelrc.js index 5bb1ef830..e2cb82ff1 100644 --- a/packages/embark/.babelrc.js +++ b/packages/embark/.babelrc.js @@ -1,5 +1,3 @@ -/* global __dirname module require */ - const cloneDeep = require('lodash.clonedeep'); const {copySync, ensureDirSync} = require('fs-extra'); const glob = require('glob'); diff --git a/packages/embark/bin/embark b/packages/embark/bin/embark index 26f43867e..86277908c 100755 --- a/packages/embark/bin/embark +++ b/packages/embark/bin/embark @@ -1,4 +1,5 @@ #!/usr/bin/env node require('source-map-support/register'); +// eslint-disable-next-line import/no-unresolved require('../dist/bin/embark'); diff --git a/packages/embark/package.json b/packages/embark/package.json index c0ccc7c6a..b005cfd32 100644 --- a/packages/embark/package.json +++ b/packages/embark/package.json @@ -24,8 +24,6 @@ "bin": { "embark": "./bin/embark" }, - "main": "./dist/lib/index.js", - "types": "./dist/lib/index.d.ts", "files": [ "bin", "dist/bin", @@ -48,7 +46,7 @@ "_typecheck": "npm run solo -- typecheck", "ci": "npm run qa", "clean": "npm run reset", - "lint": "eslint bin/embark src/bin/ src/lib/", + "lint": "eslint --ignore-pattern '!.*.js' .babelrc.js bin/embark scripts/ src/", "qa": "npm-run-all lint _typecheck _build test", "reset": "npx rimraf .nyc_output coverage dist embark-*.tgz package", "solo": "embark-solo", @@ -93,7 +91,7 @@ "ganache-cli": "6.8.2", "glob": "7.1.4", "globule": "1.2.1", - "hosted-git-info": "2.7.1", + "hosted-git-info": "2.8.4", "http-proxy": "1.17.0", "istanbul": "0.4.5", "json-parse-better-errors": "1.0.2", @@ -105,14 +103,11 @@ "parse-json": "4.0.0", "pkg-up": "2.0.0", "promptly": "2.2.0", - "propose": "0.0.5", "pump": "3.0.0", - "request": "2.88.0", "semver": "5.6.0", "shelljs": "0.8.3", "simples": "0.8.8", "source-map-support": "0.5.13", - "string-replace-async": "1.2.1", "term.js": "0.0.7", "viz.js": "1.8.2", "vm2": "3.6.4", @@ -148,10 +143,11 @@ "embark-test-contract-1": "0.0.1", "embark-testing": "^5.2.0", "embark-transaction-logger": "^5.2.2", - "eslint": "5.7.0", + "eslint": "6.8.0", "npm-run-all": "4.1.5", "nyc": "13.1.0", "rejected-or-not": "1.0.1", + "request": "2.88.0", "rimraf": "3.0.0", "sinon": "4.5.0" }, diff --git a/packages/embark/scripts/test.js b/packages/embark/scripts/test.js index 0b1fdd21c..af440cc5b 100644 --- a/packages/embark/scripts/test.js +++ b/packages/embark/scripts/test.js @@ -1,5 +1,3 @@ -/* global __dirname process require */ - const fs = require('fs-extra'); const os = require('os'); const path = require('path'); diff --git a/packages/embark/src/bin/embark.js b/packages/embark/src/bin/embark.js index 217a6d843..83c8a583c 100755 --- a/packages/embark/src/bin/embark.js +++ b/packages/embark/src/bin/embark.js @@ -1,5 +1,3 @@ -/* global __dirname process require */ - // This script doesn't use JS syntax, packages, or APIs *un*supported by any // node version >=4.0.0, so unsupported versions from v4.0.0+ will get the // intended error messages. A future version of this script could instead rely diff --git a/packages/embark/src/cmd/dashboard/dashboard.js b/packages/embark/src/cmd/dashboard/dashboard.js index 51e707ad3..946d0915d 100644 --- a/packages/embark/src/cmd/dashboard/dashboard.js +++ b/packages/embark/src/cmd/dashboard/dashboard.js @@ -54,7 +54,7 @@ class Dashboard { this.events.on("deployment:contract:error", (_contract) => { this.events.request("contracts:state", (err, contracts) => { - monitor.setContracts(contracts) + monitor.setContracts(contracts); }); }); @@ -68,7 +68,7 @@ class Dashboard { this.events.on("deployment:contract:undeployed", (_contract) => { this.events.request("contracts:state", (err, contracts) => { this.events.emit('contracts:state', contracts); - monitor.setContracts(contracts) + monitor.setContracts(contracts); }); }); diff --git a/packages/embark/src/lib/index.js b/packages/embark/src/lib/index.js deleted file mode 100644 index ed8624e48..000000000 --- a/packages/embark/src/lib/index.js +++ /dev/null @@ -1,30 +0,0 @@ -import { Config, Events } from 'embark-core'; -import { Logger } from 'embark-logger'; -import { readJsonSync } from 'fs-extra'; -import { join } from 'path'; - -const pkg = readJsonSync(join(__dirname, '../../package.json')); - -export default class Embark { - - constructor(options) { - this.version = pkg.version; - this.options = options || {}; - } - - initConfig(env, options) { - this.events = new Events(); - this.logger = new Logger({logLevel: '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, - package: pkg - }); - this.config.loadConfigFiles(options); - this.plugins = this.config.plugins; - } -} diff --git a/packages/embark/src/lib/utils/checkDependencies.js b/packages/embark/src/lib/utils/checkDependencies.js index 8188b7821..c7f3a2241 100644 --- a/packages/embark/src/lib/utils/checkDependencies.js +++ b/packages/embark/src/lib/utils/checkDependencies.js @@ -1,5 +1,3 @@ -/* global module process require */ - /** * This source code was adapted from: * https://github.com/mgol/check-dependencies/blob/1.1.0/lib/check-dependencies.js diff --git a/packages/embark/src/test/accountParser.js b/packages/embark/src/test/accountParser.js index 523c035bd..821658a45 100644 --- a/packages/embark/src/test/accountParser.js +++ b/packages/embark/src/test/accountParser.js @@ -1,4 +1,5 @@ -/*global __dirname, describe, it, before, after, require*/ +/* global describe it before after */ + import { TestLogger } from 'embark-core'; import * as i18n from 'embark-i18n'; const assert = require('assert'); @@ -8,12 +9,9 @@ import { dappPath, getWeiBalanceFromString, getHexBalanceFromString, - AccountParser, - joinPath, - setUpEnv + AccountParser } from 'embark-utils'; -/* setUpEnv(joinPath(__dirname, '../../')); */ i18n.setOrDetectLocale('en'); describe('embark.AccountParser', function () { diff --git a/packages/embark/src/test/cmd.js b/packages/embark/src/test/cmd.js index 2dd1a4797..d565094df 100644 --- a/packages/embark/src/test/cmd.js +++ b/packages/embark/src/test/cmd.js @@ -1,4 +1,7 @@ -import Embark from '../lib/index'; +/* global describe it */ + +const assert = require('assert'); + let Cmd = require('../cmd/cmd'); // Function to send a line to stdin @@ -21,7 +24,7 @@ describe('embark.Cmd', function () { describe('#new', function () { it('it should create an app with a name', function (done) { - let cmd = new Cmd(Embark); + let cmd = new Cmd(); let pl = passingLines(); let appname = 'deleteapp'; cmd.newApp(appname, function (output) { @@ -36,7 +39,7 @@ describe('embark.Cmd', function () { }); it('it should prompt when given an empty app name', function (done) { - let cmd = new Cmd(Embark); + let cmd = new Cmd(); let pl = passingLines(); let appname = 'deleteapp'; diff --git a/packages/embark/src/test/contracts.js b/packages/embark/src/test/contracts.js index 27bdc95ec..ab5f88833 100644 --- a/packages/embark/src/test/contracts.js +++ b/packages/embark/src/test/contracts.js @@ -1,10 +1,10 @@ -/*global describe, it, require*/ +/* global describe it */ + import { File, Types } from "embark-utils"; import ContractsManager from 'embark-contracts-manager'; -import Compiler from 'embark-compiler'; import { Logger } from 'embark-logger'; -import { Events, fs, IPC, TestLogger, Plugins } from 'embark-core'; +import { Events, IPC, TestLogger, Plugins } from 'embark-core'; import findUp from 'find-up'; let assert = require('assert'); @@ -51,25 +51,6 @@ describe('embark.Contracts', function() { plugins.loadInternalPlugin('embark-solidity', {ipc: ipcObject}, true); let events = new Events(); - let embarkObject = { - registerAPICall: () => {}, - events: events, - fs: { - existsSync: () => { return false; }, - dappPath: () => { return "ok"; } - }, - logger: plugins.logger, - embarkConfig: { - options: { - solc: { - "optimize": true, - "optimize-runs": 200 - } - } - } - }; - - let compiler = new Compiler(embarkObject, {plugins: plugins}); let contractsConfig; events.setCommandHandler("config:contractsConfig", function(cb) { @@ -134,7 +115,7 @@ describe('embark.Contracts', function() { describe('#build', function() { it('generate contracts', function(done) { - contractsManager.buildContracts(contractsConfig, compiledContracts, function(err, result) { + contractsManager.buildContracts(contractsConfig, compiledContracts, function(err, _result) { if (err) { throw err; } @@ -194,7 +175,6 @@ describe('embark.Contracts', function() { plugins.loadInternalPlugin('embark-solidity', {ipc: ipcObject}, true); let events = new Events(); - let compiler = new Compiler({events: events, logger: plugins.logger}, {plugins: plugins}); let contractsConfig; events.setCommandHandler("config:contractsConfig", function(cb) { @@ -268,7 +248,7 @@ describe('embark.Contracts', function() { describe('#build', function() { it('generate contracts', function(done) { - contractsManager.buildContracts(contractsConfig, compiledContracts, function(err, result) { + contractsManager.buildContracts(contractsConfig, compiledContracts, function(err, _result) { if (err) { throw err; } diff --git a/packages/embark/src/test/events.js b/packages/embark/src/test/events.js index e82ec430b..61797a150 100644 --- a/packages/embark/src/test/events.js +++ b/packages/embark/src/test/events.js @@ -1,6 +1,6 @@ -/*globals describe, it, before, beforeEach*/ -import { Events, fs } from 'embark-core'; -import { File, Types } from 'embark-utils'; +/* globals describe it before beforeEach */ + +import { Events } from 'embark-core'; const Assert = require("assert"); const {expect} = require("chai"); @@ -21,6 +21,7 @@ describe('embark.Events', function () { describe('Set event listeners', function () { it('should be able to listen to an event emission', (done) => { events.on(testEventName, ({isTest}) => { + // eslint-disable-next-line no-unused-expressions expect(isTest).to.be.true; done(); }); @@ -29,6 +30,7 @@ describe('embark.Events', function () { it('should be able to listen to an event emission once', (done) => { events.once(testEventName, ({isTest}) => { + // eslint-disable-next-line no-unused-expressions expect(isTest).to.be.true; done(); }); @@ -46,10 +48,12 @@ describe('embark.Events', function () { it('should be able to set a command handler with data and request the event', (done) => { events.setCommandHandler(testEventName, (options, cb) => { + // eslint-disable-next-line no-unused-expressions expect(options.isTest).to.be.true; cb(options); }); events.request(testEventName, { isTest: true }, (data) => { + // eslint-disable-next-line no-unused-expressions expect(data.isTest).to.be.true; done(); }); @@ -57,12 +61,14 @@ describe('embark.Events', function () { it('should be able to set a command handler with data and request the event once', (done) => { events.setCommandHandlerOnce(testEventName, (options, cb) => { + // eslint-disable-next-line no-unused-expressions expect(options.isTest).to.be.true; cb(options); }); events.request(testEventName, { isTest: true }, (data) => { + // eslint-disable-next-line no-unused-expressions expect(data.isTest).to.be.true; - events.request(testEventName, { isTest: true }, (data) => { + events.request(testEventName, { isTest: true }, (_data) => { Assert.fail("Should not call the requested event again, as it was set with once only"); }); done(); @@ -72,24 +78,31 @@ describe('embark.Events', function () { it('should be able to request an event before a command handler has been set', (done) => { let testData = { isTest: true, manipulatedCount: 0 }; events.request(testEventName, testData, (dataFirst) => { + // eslint-disable-next-line no-unused-expressions expect(dataFirst.isTest).to.be.true; expect(dataFirst.manipulatedCount).to.equal(1); + // eslint-disable-next-line no-unused-expressions expect(dataFirst.isAnotherTest).to.be.undefined; }); events.request(testEventName, testData, (dataSecond) => { + // eslint-disable-next-line no-unused-expressions expect(dataSecond.isTest).to.be.true; expect(dataSecond.manipulatedCount).to.equal(2); + // eslint-disable-next-line no-unused-expressions expect(dataSecond.isAnotherTest).to.be.undefined; dataSecond.isAnotherTest = true; events.request(testEventName, dataSecond, (dataThird) => { + // eslint-disable-next-line no-unused-expressions expect(dataThird.isTest).to.be.true; expect(dataThird.manipulatedCount).to.equal(3); + // eslint-disable-next-line no-unused-expressions expect(dataThird.isAnotherTest).to.be.true; done(); }); }); events.setCommandHandler(testEventName, (options, cb) => { + // eslint-disable-next-line no-unused-expressions expect(options.isTest).to.be.true; options.manipulatedCount++; cb(options); @@ -99,8 +112,10 @@ describe('embark.Events', function () { it('should be able to request an event before a command handler has been set once', (done) => { let testData = { isTest: true, manipulatedCount: 0 }; events.request(testEventName, testData, (data) => { + // eslint-disable-next-line no-unused-expressions expect(data.isTest).to.be.true; expect(data.manipulatedCount).to.equal(1); + // eslint-disable-next-line no-unused-expressions expect(data.isAnotherTest).to.be.undefined; events.request(testEventName, data, (_dataSecondRun) => { Assert.fail("Should not call the requested event again, as it was set with once only"); @@ -110,6 +125,7 @@ describe('embark.Events', function () { done(); }); events.setCommandHandlerOnce(testEventName, (options, cb) => { + // eslint-disable-next-line no-unused-expressions expect(options.isTest).to.be.true; options.manipulatedCount = options.manipulatedCount + 1; cb(options); diff --git a/packages/embark/src/test/modules/compiler/compiler.js b/packages/embark/src/test/modules/compiler/compiler.js index 4e0c200ef..24920edec 100644 --- a/packages/embark/src/test/modules/compiler/compiler.js +++ b/packages/embark/src/test/modules/compiler/compiler.js @@ -1,4 +1,5 @@ -/*global describe, it, require*/ +/* global describe it */ + import { Events, Plugins, TestLogger } from 'embark-core'; import { File, Types } from "embark-utils"; import findUp from 'find-up'; @@ -61,6 +62,7 @@ describe('embark.Compiler', function() { } }; + // eslint-disable-next-line no-unused-vars const compiler = new Compiler(embarkObject, {plugins: plugins}); it("should return aggregated result", (done) => { diff --git a/packages/embark/src/test/modules/solidity/solidity.js b/packages/embark/src/test/modules/solidity/solidity.js index 1b87472d4..7836468d5 100644 --- a/packages/embark/src/test/modules/solidity/solidity.js +++ b/packages/embark/src/test/modules/solidity/solidity.js @@ -1,5 +1,6 @@ -/*global describe, it, require*/ -import { fs, IPC, TestLogger } from 'embark-core'; +/* global describe it */ + +import { IPC, TestLogger } from 'embark-core'; import { File, Types } from 'embark-utils'; let SolidityCompiler = require('embark-solidity'); @@ -84,7 +85,7 @@ describe('embark.Solidity', function() { compiler.compile_solidity([ readFile('modules/solidity/contracts/simple_storage.sol'), readFile('modules/solidity/contracts/token.sol') - ], {}, function(err, compiledContracts) { + ], {}, function(_err, _compiledContracts) { //assert.deepEqual(compiledContracts, expectedObject); done(); }); @@ -127,7 +128,7 @@ describe('embark.Solidity', function() { compiler.compile_solidity([ readFile('modules/solidity/contracts/simple_storage.sol'), readFile('modules/solidity/contracts/token.sol') - ], {}, function(err, compiledContracts) { + ], {}, function(_err, _compiledContracts) { //assert.deepEqual(compiledContracts, expectedObject); done(); }); diff --git a/packages/embark/src/test/plugins.spec.js b/packages/embark/src/test/plugins.spec.js index 6cc2ef22d..5240e6014 100644 --- a/packages/embark/src/test/plugins.spec.js +++ b/packages/embark/src/test/plugins.spec.js @@ -1,4 +1,5 @@ -/*global __dirname, describe, it, beforeEach, afterEach, require*/ +/* global describe it beforeEach afterEach */ + import * as i18n from 'embark-i18n'; import { Plugins } from 'embark-core'; diff --git a/packages/embark/src/test/vm.js b/packages/embark/src/test/vm.js index 0e0720b2f..af6dc092f 100644 --- a/packages/embark/src/test/vm.js +++ b/packages/embark/src/test/vm.js @@ -13,6 +13,7 @@ describe('embark.vm', function () { describe('#evaluateCode', function () { it('should be able to evaluate basic code', function (done) { vm.doEval('1 + 1', false, (err, result) => { + // eslint-disable-next-line no-unused-expressions expect(err).to.be.null; expect(result).to.be.equal(2); done(); @@ -20,6 +21,7 @@ describe('embark.vm', function () { }); it('should be able to access the members of the sandbox', function (done) { vm.doEval('testObj.shouldReturnEmbark', false, (err, result) => { + // eslint-disable-next-line no-unused-expressions expect(err).to.be.null; expect(result).to.be.equal('embark'); done(); @@ -27,6 +29,7 @@ describe('embark.vm', function () { }); it('should be able to evaluate async code using await', function (done) { vm.doEval('await testObj.shouldReturnEmbarkAwait()', false, (err, result) => { + // eslint-disable-next-line no-unused-expressions expect(err).to.be.null; expect(result).to.be.equal('embark'); done(); @@ -37,6 +40,7 @@ describe('embark.vm', function () { it('should be able to evaluate code on a registered variable', function (done) { vm.registerVar('success', true, () => { vm.doEval('success', false, (err, result) => { + // eslint-disable-next-line no-unused-expressions expect(err).to.be.null; expect(result).to.be.equal(true); done(); @@ -46,6 +50,7 @@ describe('embark.vm', function () { it('should be able to access a required module that was registered as a variable', function (done) { vm.registerVar('externalRequire', (module.exports = () => { return "success"; }), () => { vm.doEval('externalRequire()', false, (err, result) => { + // eslint-disable-next-line no-unused-expressions expect(err).to.be.null; expect(result).to.be.equal('success'); done(); @@ -59,6 +64,7 @@ describe('embark.vm', function () { }; vm.registerVar('externalRequireES6', es6Module, () => { vm.doEval('externalRequireES6()', false, (err, result) => { + // eslint-disable-next-line no-unused-expressions expect(err).to.be.null; expect(result).to.be.equal("es6"); done(); @@ -68,10 +74,12 @@ describe('embark.vm', function () { it('should be able to access changed state', function (done) { vm.registerVar('one', 1, () => { vm.doEval('one += 1; one;', false, (err1, result1) => { + // eslint-disable-next-line no-unused-expressions expect(err1).to.be.null; expect(result1).to.be.equal(2); vm.registerVar('x', 'x', () => { // instantiates new VM, but should save state vm.doEval('one', false, (err2, result2) => { + // eslint-disable-next-line no-unused-expressions expect(err2).to.be.null; expect(result2).to.be.equal(2); done(); diff --git a/packages/embark/src/test/vm_fs.js b/packages/embark/src/test/vm_fs.js index 5b3253a62..cc2080802 100644 --- a/packages/embark/src/test/vm_fs.js +++ b/packages/embark/src/test/vm_fs.js @@ -1,4 +1,5 @@ -/*global after, before, describe, it, require, process*/ +/* global after before describe it */ + import { fs } from 'embark-code-runner'; const { embarkPath } = require('embark-utils'); const {assert} = require('chai'); diff --git a/packages/embarkjs/embarkjs/.babelrc.js b/packages/embarkjs/embarkjs/.babelrc.js index 9b27403c6..eb8f209c3 100644 --- a/packages/embarkjs/embarkjs/.babelrc.js +++ b/packages/embarkjs/embarkjs/.babelrc.js @@ -1,5 +1,3 @@ -/* global module require */ - const cloneDeep = require('lodash.clonedeep'); module.exports = (api) => { @@ -18,9 +16,7 @@ module.exports = (api) => { const node = cloneDeep(base); Object.assign(node, { - ignore: [ - 'src/lib/browser' - ] + ignore: ['src/lib/browser'] }); const test = cloneDeep(node); diff --git a/packages/embarkjs/embarkjs/index.js b/packages/embarkjs/embarkjs/index.js new file mode 100644 index 000000000..eea45e46b --- /dev/null +++ b/packages/embarkjs/embarkjs/index.js @@ -0,0 +1 @@ +module.exports = require('./dist/lib/node'); diff --git a/packages/embarkjs/embarkjs/package.json b/packages/embarkjs/embarkjs/package.json index 200139cff..5124ad1de 100644 --- a/packages/embarkjs/embarkjs/package.json +++ b/packages/embarkjs/embarkjs/package.json @@ -21,7 +21,7 @@ "type": "git", "url": "https://github.com/embarklabs/embark.git" }, - "main": "./dist/lib/node/index.js", + "main": "./index.js", "types": "./dist/lib/node/index.d.ts", "browser": { "./dist/lib/node/index.js": "./dist/browser/lib/index.js", @@ -34,7 +34,8 @@ ], "files": [ "dist/browser", - "dist/lib" + "dist/lib", + "index.js" ], "embark-collective": { "build:browser": true, @@ -42,6 +43,9 @@ "typecheck": { "exclude": [ "src/lib/browser" + ], + "include": [ + "src/lib/**/*" ] } }, @@ -50,11 +54,15 @@ "_typecheck": "npm run solo -- typecheck", "ci": "npm run qa", "clean": "npm run reset", - "qa": "npm-run-all _typecheck _build test", + "lint": "eslint --ignore-pattern '!.*.js' .babelrc.js src/", + "qa": "npm-run-all lint _typecheck _build test", "reset": "npx rimraf .nyc_output coverage dist embarkjs-*.tgz package", "solo": "embark-solo", "test": "nyc --reporter=html --reporter=json mocha \"dist/test/**/*.js\" --exit --no-timeouts --require source-map-support/register" }, + "eslintConfig": { + "extends": "../../../.eslintrc.json" + }, "nyc": { "exclude": [ "**/node_modules/**", @@ -73,6 +81,7 @@ "ajv": "6.10.2", "chai": "4.2.0", "embark-solo": "^5.1.1", + "eslint": "6.8.0", "lodash.clonedeep": "4.5.0", "mocha": "6.2.2", "npm-run-all": "4.1.5", diff --git a/packages/embarkjs/embarkjs/src/lib/utils.js b/packages/embarkjs/embarkjs/src/lib/utils.js index d3f31a17d..30a5930a1 100644 --- a/packages/embarkjs/embarkjs/src/lib/utils.js +++ b/packages/embarkjs/embarkjs/src/lib/utils.js @@ -1,5 +1,3 @@ -/* global clearInterval global require setInterval */ - const Web3 = global.Web3 || require('web3'); let Utils = { @@ -23,6 +21,7 @@ let Utils = { const promise = new Promise((resolve, reject) => { let hash; let calledBacked = false; + let interval; function callback(err, receipt) { if (calledBacked) { @@ -46,7 +45,7 @@ let Utils = { // FIXME The issue somehow only happens when the blockchain node is started in the same terminal // Only poll with a Websocket provider if (web3.currentProvider.constructor.name === 'WebsocketProvider') { - var interval = setInterval(function () { + interval = setInterval(function () { if (!hash) { return; } diff --git a/packages/embarkjs/embarkjs/src/test/helpers/blockchain.js b/packages/embarkjs/embarkjs/src/test/helpers/blockchain.js index 61a6ab6f7..f2b0b427d 100644 --- a/packages/embarkjs/embarkjs/src/test/helpers/blockchain.js +++ b/packages/embarkjs/embarkjs/src/test/helpers/blockchain.js @@ -1,5 +1,3 @@ -/* global Buffer global module require */ - const async = require('async'); const http = require('http'); const net = require('net'); diff --git a/packages/embarkjs/ens/.babelrc.js b/packages/embarkjs/ens/.babelrc.js index 05d103187..10c737381 100644 --- a/packages/embarkjs/ens/.babelrc.js +++ b/packages/embarkjs/ens/.babelrc.js @@ -1,5 +1,3 @@ -/* global module require */ - const cloneDeep = require('lodash.clonedeep'); module.exports = (api) => { @@ -9,9 +7,7 @@ module.exports = (api) => { const browser = cloneDeep(base); Object.assign(browser, { - ignore: [ - 'src/node' - ] + ignore: ['src/node'] }); const node = cloneDeep(base); diff --git a/packages/embarkjs/ens/index.js b/packages/embarkjs/ens/index.js new file mode 100644 index 000000000..9f3bd7ad9 --- /dev/null +++ b/packages/embarkjs/ens/index.js @@ -0,0 +1 @@ +module.exports = require('./dist/node'); diff --git a/packages/embarkjs/ens/package.json b/packages/embarkjs/ens/package.json index 8a92a9313..64b58c770 100644 --- a/packages/embarkjs/ens/package.json +++ b/packages/embarkjs/ens/package.json @@ -21,7 +21,7 @@ "type": "git", "url": "https://github.com/embarklabs/embark.git" }, - "main": "./dist/node/index.js", + "main": "./index.js", "types": "./dist/node/index.d.ts", "browser": "./dist/browser/index.js", "browserslist": [ @@ -30,7 +30,8 @@ "> 0.2%" ], "files": [ - "dist" + "dist", + "index.js" ], "embark-collective": { "build:browser": true, @@ -42,12 +43,17 @@ "_typecheck": "npm run solo -- typecheck", "ci": "npm run qa", "clean": "npm run reset", - "qa": "npm-run-all _typecheck _build", + "lint": "eslint --ignore-pattern '!.*.js' .babelrc.js src/", + "qa": "npm-run-all lint _typecheck _build", "reset": "npx rimraf coverage dist embarkjs-*.tgz package", "solo": "embark-solo" }, + "eslintConfig": { + "extends": "../../../.eslintrc.json" + }, "dependencies": { "@babel/runtime-corejs3": "7.7.4", + "async": "2.6.1", "core-js": "3.4.3", "embarkjs": "^5.2.3-nightly.0", "eth-ens-namehash": "2.0.8", @@ -56,6 +62,7 @@ "devDependencies": { "ajv": "6.10.2", "embark-solo": "^5.1.1", + "eslint": "6.8.0", "lodash.clonedeep": "4.5.0", "npm-run-all": "4.1.5", "rimraf": "3.0.0" diff --git a/packages/embarkjs/ipfs/.babelrc.js b/packages/embarkjs/ipfs/.babelrc.js index 05d103187..10c737381 100644 --- a/packages/embarkjs/ipfs/.babelrc.js +++ b/packages/embarkjs/ipfs/.babelrc.js @@ -1,5 +1,3 @@ -/* global module require */ - const cloneDeep = require('lodash.clonedeep'); module.exports = (api) => { @@ -9,9 +7,7 @@ module.exports = (api) => { const browser = cloneDeep(base); Object.assign(browser, { - ignore: [ - 'src/node' - ] + ignore: ['src/node'] }); const node = cloneDeep(base); diff --git a/packages/embarkjs/ipfs/index.js b/packages/embarkjs/ipfs/index.js new file mode 100644 index 000000000..9f3bd7ad9 --- /dev/null +++ b/packages/embarkjs/ipfs/index.js @@ -0,0 +1 @@ +module.exports = require('./dist/node'); diff --git a/packages/embarkjs/ipfs/package.json b/packages/embarkjs/ipfs/package.json index 968baf09a..b4c9c1018 100644 --- a/packages/embarkjs/ipfs/package.json +++ b/packages/embarkjs/ipfs/package.json @@ -21,7 +21,7 @@ "type": "git", "url": "https://github.com/embarklabs/embark.git" }, - "main": "./dist/node/index.js", + "main": "./index.js", "types": "./dist/node/index.d.ts", "browser": "./dist/browser/index.js", "browserslist": [ @@ -30,7 +30,8 @@ "> 0.2%" ], "files": [ - "dist" + "dist", + "index.js" ], "embark-collective": { "build:browser": true, @@ -42,10 +43,14 @@ "_typecheck": "npm run solo -- typecheck", "ci": "npm run qa", "clean": "npm run reset", - "qa": "npm-run-all _typecheck _build", + "lint": "eslint --ignore-pattern '!.*.js' .babelrc.js src/", + "qa": "npm-run-all lint _typecheck _build", "reset": "npx rimraf coverage dist embarkjs-*.tgz package", "solo": "embark-solo" }, + "eslintConfig": { + "extends": "../../../.eslintrc.json" + }, "dependencies": { "@babel/runtime-corejs3": "7.7.4", "core-js": "3.4.3", @@ -54,6 +59,7 @@ "devDependencies": { "ajv": "6.10.2", "embark-solo": "^5.1.1", + "eslint": "6.8.0", "lodash.clonedeep": "4.5.0", "npm-run-all": "4.1.5", "rimraf": "3.0.0" diff --git a/packages/embarkjs/swarm/.babelrc.js b/packages/embarkjs/swarm/.babelrc.js index 05d103187..10c737381 100644 --- a/packages/embarkjs/swarm/.babelrc.js +++ b/packages/embarkjs/swarm/.babelrc.js @@ -1,5 +1,3 @@ -/* global module require */ - const cloneDeep = require('lodash.clonedeep'); module.exports = (api) => { @@ -9,9 +7,7 @@ module.exports = (api) => { const browser = cloneDeep(base); Object.assign(browser, { - ignore: [ - 'src/node' - ] + ignore: ['src/node'] }); const node = cloneDeep(base); diff --git a/packages/embarkjs/swarm/index.js b/packages/embarkjs/swarm/index.js new file mode 100644 index 000000000..9f3bd7ad9 --- /dev/null +++ b/packages/embarkjs/swarm/index.js @@ -0,0 +1 @@ +module.exports = require('./dist/node'); diff --git a/packages/embarkjs/swarm/package.json b/packages/embarkjs/swarm/package.json index 0b85cda08..450209ee1 100644 --- a/packages/embarkjs/swarm/package.json +++ b/packages/embarkjs/swarm/package.json @@ -21,7 +21,7 @@ "type": "git", "url": "https://github.com/embarklabs/embark.git" }, - "main": "./dist/node/index.js", + "main": "./index.js", "types": "./dist/node/index.d.ts", "browser": "./dist/browser/index.js", "browserslist": [ @@ -30,7 +30,8 @@ "> 0.2%" ], "files": [ - "dist" + "dist", + "index.js" ], "embark-collective": { "build:browser": true, @@ -42,10 +43,14 @@ "_typecheck": "npm run solo -- typecheck", "ci": "npm run qa", "clean": "npm run reset", + "lint": "eslint --ignore-pattern '!.*.js' .babelrc.js src/", "qa": "npm-run-all _typecheck _build", "reset": "npx rimraf coverage dist embarkjs-*.tgz package", "solo": "embark-solo" }, + "eslintConfig": { + "extends": "../../../.eslintrc.json" + }, "dependencies": { "@babel/runtime-corejs3": "7.7.4", "core-js": "3.4.3", @@ -55,6 +60,7 @@ "devDependencies": { "ajv": "6.10.2", "embark-solo": "^5.1.1", + "eslint": "6.8.0", "lodash.clonedeep": "4.5.0", "npm-run-all": "4.1.5", "rimraf": "3.0.0" diff --git a/packages/embarkjs/web3/.babelrc.js b/packages/embarkjs/web3/.babelrc.js index 05d103187..10c737381 100644 --- a/packages/embarkjs/web3/.babelrc.js +++ b/packages/embarkjs/web3/.babelrc.js @@ -1,5 +1,3 @@ -/* global module require */ - const cloneDeep = require('lodash.clonedeep'); module.exports = (api) => { @@ -9,9 +7,7 @@ module.exports = (api) => { const browser = cloneDeep(base); Object.assign(browser, { - ignore: [ - 'src/node' - ] + ignore: ['src/node'] }); const node = cloneDeep(base); diff --git a/packages/embarkjs/web3/index.js b/packages/embarkjs/web3/index.js new file mode 100644 index 000000000..9f3bd7ad9 --- /dev/null +++ b/packages/embarkjs/web3/index.js @@ -0,0 +1 @@ +module.exports = require('./dist/node'); diff --git a/packages/embarkjs/web3/package.json b/packages/embarkjs/web3/package.json index 27af22bb0..6bd03346d 100644 --- a/packages/embarkjs/web3/package.json +++ b/packages/embarkjs/web3/package.json @@ -21,7 +21,7 @@ "type": "git", "url": "https://github.com/embarklabs/embark.git" }, - "main": "./dist/node/index.js", + "main": "./index.js", "types": "./dist/node/index.d.ts", "browser": "./dist/browser/index.js", "browserslist": [ @@ -30,7 +30,8 @@ "> 0.2%" ], "files": [ - "dist" + "dist", + "index.js" ], "embark-collective": { "build:browser": true, @@ -42,10 +43,14 @@ "_typecheck": "npm run solo -- typecheck", "ci": "npm run qa", "clean": "npm run reset", + "lint": "eslint --ignore-pattern '!.*.js' .babelrc.js src/", "qa": "npm-run-all _typecheck _build", "reset": "npx rimraf coverage dist embarkjs-*.tgz package", "solo": "embark-solo" }, + "eslintConfig": { + "extends": "../../../.eslintrc.json" + }, "dependencies": { "@babel/runtime-corejs3": "7.7.4", "core-js": "3.4.3", @@ -54,6 +59,7 @@ "devDependencies": { "ajv": "6.10.2", "embark-solo": "^5.1.1", + "eslint": "6.8.0", "lodash.clonedeep": "4.5.0", "npm-run-all": "4.1.5", "rimraf": "3.0.0" diff --git a/packages/embarkjs/web3/src/index.js b/packages/embarkjs/web3/src/index.js index 886d2ac9c..36c5f3aa1 100644 --- a/packages/embarkjs/web3/src/index.js +++ b/packages/embarkjs/web3/src/index.js @@ -1,5 +1,3 @@ -/* global global require */ - const Web3 = require('web3'); const __embarkWeb3 = {}; diff --git a/packages/embarkjs/whisper/.babelrc.js b/packages/embarkjs/whisper/.babelrc.js index 05d103187..10c737381 100644 --- a/packages/embarkjs/whisper/.babelrc.js +++ b/packages/embarkjs/whisper/.babelrc.js @@ -1,5 +1,3 @@ -/* global module require */ - const cloneDeep = require('lodash.clonedeep'); module.exports = (api) => { @@ -9,9 +7,7 @@ module.exports = (api) => { const browser = cloneDeep(base); Object.assign(browser, { - ignore: [ - 'src/node' - ] + ignore: ['src/node'] }); const node = cloneDeep(base); diff --git a/packages/embarkjs/whisper/index.js b/packages/embarkjs/whisper/index.js new file mode 100644 index 000000000..9f3bd7ad9 --- /dev/null +++ b/packages/embarkjs/whisper/index.js @@ -0,0 +1 @@ +module.exports = require('./dist/node'); diff --git a/packages/embarkjs/whisper/package.json b/packages/embarkjs/whisper/package.json index 416a996f2..bc4598c14 100644 --- a/packages/embarkjs/whisper/package.json +++ b/packages/embarkjs/whisper/package.json @@ -21,7 +21,7 @@ "type": "git", "url": "https://github.com/embarklabs/embark.git" }, - "main": "./dist/node/index.js", + "main": "./index.js", "types": "./dist/node/index.d.ts", "browser": "./dist/browser/index.js", "browserslist": [ @@ -30,7 +30,8 @@ "> 0.2%" ], "files": [ - "dist" + "dist", + "index.js" ], "embark-collective": { "build:browser": true, @@ -42,19 +43,25 @@ "_typecheck": "npm run solo -- typecheck", "ci": "npm run qa", "clean": "npm run reset", + "lint": "eslint --ignore-pattern '!.*.js' .babelrc.js src/", "qa": "npm-run-all _typecheck _build", "reset": "npx rimraf coverage dist embarkjs-*.tgz package", "solo": "embark-solo" }, + "eslintConfig": { + "extends": "../../../.eslintrc.json" + }, "dependencies": { "@babel/runtime-corejs3": "7.7.4", "core-js": "3.4.3", "rxjs": "6.4.0", - "web3": "1.2.6" + "web3": "1.2.6", + "web3-core-requestmanager": "1.2.6" }, "devDependencies": { "ajv": "6.10.2", "embark-solo": "^5.1.1", + "eslint": "6.8.0", "lodash.clonedeep": "4.5.0", "npm-run-all": "4.1.5", "rimraf": "3.0.0" diff --git a/packages/embarkjs/whisper/src/communicationFunctions.js b/packages/embarkjs/whisper/src/communicationFunctions.js index 4470e3d70..f64e2df0f 100644 --- a/packages/embarkjs/whisper/src/communicationFunctions.js +++ b/packages/embarkjs/whisper/src/communicationFunctions.js @@ -1,5 +1,3 @@ -/* global module require */ - const {fromEvent, merge, throwError} = require('rxjs'); const {map, mergeMap} = require('rxjs/operators'); diff --git a/packages/embarkjs/whisper/src/index.js b/packages/embarkjs/whisper/src/index.js index 7e6acb1ec..e52171e45 100644 --- a/packages/embarkjs/whisper/src/index.js +++ b/packages/embarkjs/whisper/src/index.js @@ -1,4 +1,3 @@ -/* global EmbarkJS Web3 listenTo sendMessage */ let Web3 = require('web3'); let { Manager } = require('web3-core-requestmanager'); diff --git a/packages/plugins/accounts-manager/index.js b/packages/plugins/accounts-manager/index.js new file mode 100644 index 000000000..cce693358 --- /dev/null +++ b/packages/plugins/accounts-manager/index.js @@ -0,0 +1 @@ +module.exports = require('./dist'); diff --git a/packages/plugins/accounts-manager/package.json b/packages/plugins/accounts-manager/package.json index e7c9e66a9..8e39782be 100644 --- a/packages/plugins/accounts-manager/package.json +++ b/packages/plugins/accounts-manager/package.json @@ -16,7 +16,8 @@ "solidity" ], "files": [ - "dist" + "dist", + "index.js" ], "license": "MIT", "repository": { @@ -24,7 +25,7 @@ "type": "git", "url": "https://github.com/embarklabs/embark.git" }, - "main": "./dist/index.js", + "main": "./index.js", "types": "./dist/index.d.ts", "embark-collective": { "build:node": true, @@ -56,7 +57,7 @@ }, "devDependencies": { "embark-solo": "^5.1.1", - "eslint": "5.7.0", + "eslint": "6.8.0", "npm-run-all": "4.1.5", "rimraf": "3.0.0", "tslint": "5.20.1", diff --git a/packages/plugins/basic-pipeline/index.js b/packages/plugins/basic-pipeline/index.js new file mode 100644 index 000000000..cce693358 --- /dev/null +++ b/packages/plugins/basic-pipeline/index.js @@ -0,0 +1 @@ +module.exports = require('./dist'); diff --git a/packages/plugins/basic-pipeline/package.json b/packages/plugins/basic-pipeline/package.json index 3367b28c2..27e7673fe 100644 --- a/packages/plugins/basic-pipeline/package.json +++ b/packages/plugins/basic-pipeline/package.json @@ -16,7 +16,8 @@ "solidity" ], "files": [ - "dist" + "dist", + "index.js" ], "license": "MIT", "repository": { @@ -24,7 +25,7 @@ "type": "git", "url": "https://github.com/embarklabs/embark.git" }, - "main": "./dist/index.js", + "main": "./index.js", "types": "./dist/index.d.ts", "embark-collective": { "build:node": true, @@ -40,14 +41,18 @@ "_typecheck": "npm run solo -- typecheck", "ci": "npm run qa", "clean": "npm run reset", - "lint": "eslint src/", + "lint": "eslint src/ test/", "qa": "npm-run-all lint _typecheck _build test", "reset": "npx rimraf dist embark-*.tgz package", "solo": "embark-solo", "test": "jest" }, "eslintConfig": { - "extends": "../../../.eslintrc.json" + "extends": [ + "../../../.eslintrc.json", + "plugin:jest/recommended", + "plugin:jest/style" + ] }, "dependencies": { "@babel/core": "7.7.4", @@ -90,7 +95,8 @@ "babel-jest": "24.9.0", "embark-solo": "^5.1.1", "embark-testing": "^5.2.0", - "eslint": "5.7.0", + "eslint": "6.8.0", + "eslint-plugin-jest": "22.5.1", "jest": "24.9.0", "npm-run-all": "4.1.5", "rimraf": "3.0.0" diff --git a/packages/plugins/basic-pipeline/src/env.js b/packages/plugins/basic-pipeline/src/env.js index fa38459c9..ab70062f1 100644 --- a/packages/plugins/basic-pipeline/src/env.js +++ b/packages/plugins/basic-pipeline/src/env.js @@ -1,5 +1,3 @@ -/* global __dirname process require */ - const {sync: findUp} = require('find-up'); const {delimiter, dirname, join} = require('path'); diff --git a/packages/plugins/basic-pipeline/src/webpack.config.js b/packages/plugins/basic-pipeline/src/webpack.config.js index 58e6bd091..4978681fd 100644 --- a/packages/plugins/basic-pipeline/src/webpack.config.js +++ b/packages/plugins/basic-pipeline/src/webpack.config.js @@ -1,5 +1,3 @@ -/* global __dirname module process require */ - const fs = require('fs'); const path = require('path'); diff --git a/packages/plugins/basic-pipeline/test/index.js b/packages/plugins/basic-pipeline/test/index.js index 5add1df94..c359fb04d 100644 --- a/packages/plugins/basic-pipeline/test/index.js +++ b/packages/plugins/basic-pipeline/test/index.js @@ -1,3 +1,4 @@ +// eslint-disable-next-line no-unused-vars import BasicPipeline from '../src/index'; describe('needs tests', () => { diff --git a/packages/plugins/coverage/index.js b/packages/plugins/coverage/index.js new file mode 100644 index 000000000..ac2ea1322 --- /dev/null +++ b/packages/plugins/coverage/index.js @@ -0,0 +1 @@ +module.exports = require('./dist/lib'); diff --git a/packages/plugins/coverage/package.json b/packages/plugins/coverage/package.json index 31daf72cb..aa9aea7f0 100644 --- a/packages/plugins/coverage/package.json +++ b/packages/plugins/coverage/package.json @@ -16,7 +16,8 @@ "solidity" ], "files": [ - "dist" + "dist", + "index.js" ], "license": "MIT", "repository": { @@ -24,11 +25,15 @@ "type": "git", "url": "https://github.com/embarklabs/embark.git" }, - "main": "./dist/lib/index.js", + "main": "./index.js", "types": "./dist/lib/index.d.ts", "embark-collective": { "build:node": true, - "typecheck": true + "typecheck": { + "include": [ + "src/lib/**/*" + ] + } }, "scripts": { "_build": "npm run solo -- build", @@ -36,6 +41,7 @@ "ci": "npm run qa", "clean": "npm run reset", "lint": "npm-run-all lint:*", + "lint:js": "eslint src/", "lint:ts": "tslint -c tslint.json \"src/**/*.ts\"", "qa": "npm-run-all lint _typecheck _build test", "reset": "npx rimraf dist embark-*.tgz package", @@ -54,6 +60,7 @@ "embark-utils": "^5.2.0", "fs-extra": "8.1.0", "globule": "1.2.1", + "prettier": "1.18.2", "prettier-plugin-solidity": "1.0.0-alpha.25", "semver": "5.6.0", "solidity-parser-antlr": "0.4.5", @@ -65,7 +72,7 @@ "@babel/core": "7.7.4", "cross-env": "5.2.0", "embark-solo": "^5.1.1", - "eslint": "5.7.0", + "eslint": "6.8.0", "mocha": "6.2.2", "npm-run-all": "4.1.5", "rimraf": "3.0.0", diff --git a/packages/plugins/coverage/src/test/printer.spec.ts b/packages/plugins/coverage/src/test/printer.spec.js similarity index 86% rename from packages/plugins/coverage/src/test/printer.spec.ts rename to packages/plugins/coverage/src/test/printer.spec.js index c22a6df3e..835b45e34 100644 --- a/packages/plugins/coverage/src/test/printer.spec.ts +++ b/packages/plugins/coverage/src/test/printer.spec.js @@ -1,8 +1,9 @@ +/* global describe it */ + import assert from "assert"; import fs from "fs"; -import { describe, it } from "mocha"; import path from "path"; -import parser, { SourceUnit } from "solidity-parser-antlr"; +import parser from "solidity-parser-antlr"; import { Printer } from "../lib/printer"; @@ -13,7 +14,7 @@ const FIXTURES = fs.readdirSync(FIXTURE_PATH).map((f) => { return { basename: f, path: fp, - source: fs.readFileSync(fp, "utf8"), + source: fs.readFileSync(fp, "utf8") }; }); @@ -22,11 +23,11 @@ describe("Printer", () => { describe("prints equivalent code", () => { for (const fixture of FIXTURES) { it(fixture.basename, () => { - const astBefore = parser.parse(fixture.source, {loc: false, range: false}) as SourceUnit; + const astBefore = parser.parse(fixture.source, {loc: false, range: false}); const printer = new Printer(astBefore); const source = printer.print(); - const astAfter = parser.parse(source, {loc: false, range: false}) as SourceUnit; + const astAfter = parser.parse(source, {loc: false, range: false}); // Remove .tokens from the AST as it gets walked and processed by // prettier. This is not consequential for anything else. Also, the diff --git a/packages/plugins/debugger/index.js b/packages/plugins/debugger/index.js new file mode 100644 index 000000000..cce693358 --- /dev/null +++ b/packages/plugins/debugger/index.js @@ -0,0 +1 @@ +module.exports = require('./dist'); diff --git a/packages/plugins/debugger/package.json b/packages/plugins/debugger/package.json index 4f4f79af8..9af0908e5 100644 --- a/packages/plugins/debugger/package.json +++ b/packages/plugins/debugger/package.json @@ -16,7 +16,8 @@ "solidity" ], "files": [ - "dist" + "dist", + "index.js" ], "license": "MIT", "repository": { @@ -24,7 +25,7 @@ "type": "git", "url": "https://github.com/embarklabs/embark.git" }, - "main": "./dist/index.js", + "main": "./index.js", "types": "./dist/index.d.ts", "embark-collective": { "build:node": true, diff --git a/packages/plugins/deploy-tracker/index.js b/packages/plugins/deploy-tracker/index.js new file mode 100644 index 000000000..cce693358 --- /dev/null +++ b/packages/plugins/deploy-tracker/index.js @@ -0,0 +1 @@ +module.exports = require('./dist'); diff --git a/packages/plugins/deploy-tracker/package.json b/packages/plugins/deploy-tracker/package.json index ba5784e73..e8c3abf17 100644 --- a/packages/plugins/deploy-tracker/package.json +++ b/packages/plugins/deploy-tracker/package.json @@ -16,7 +16,8 @@ "solidity" ], "files": [ - "dist/" + "dist", + "index.js" ], "license": "MIT", "repository": { @@ -24,11 +25,15 @@ "type": "git", "url": "https://github.com/embarklabs/embark.git" }, - "main": "./dist/index.js", + "main": "./index.js", "types": "./dist/index.d.ts", "embark-collective": { "build:node": true, - "typecheck": true + "typecheck": { + "exclude": [ + "src/test" + ] + } }, "scripts": { "_build": "npm run solo -- build", @@ -46,6 +51,7 @@ }, "dependencies": { "colors": "1.3.2", + "embark-i18n": "^5.1.1", "embark-logger": "^5.2.0", "embark-utils": "^5.2.0", "fs-extra": "8.1.0", @@ -53,7 +59,7 @@ }, "devDependencies": { "embark-solo": "^5.1.1", - "eslint": "5.7.0", + "eslint": "6.8.0", "expect.js": "0.3.1", "mocha": "6.2.2", "npm-run-all": "4.1.5", diff --git a/packages/plugins/deploy-tracker/tsconfig.json b/packages/plugins/deploy-tracker/tsconfig.json index c3a0600ae..a320748dd 100644 --- a/packages/plugins/deploy-tracker/tsconfig.json +++ b/packages/plugins/deploy-tracker/tsconfig.json @@ -5,11 +5,17 @@ "rootDir": "./src", "tsBuildInfoFile": "./node_modules/.cache/tsc/tsconfig.embark-deploy-tracker.tsbuildinfo" }, + "exclude": [ + "src/test" + ], "extends": "../../../tsconfig.base.json", "include": [ "src/**/*" ], "references": [ + { + "path": "../../core/i18n" + }, { "path": "../../core/logger" }, diff --git a/packages/plugins/ens/index.js b/packages/plugins/ens/index.js new file mode 100644 index 000000000..cce693358 --- /dev/null +++ b/packages/plugins/ens/index.js @@ -0,0 +1 @@ +module.exports = require('./dist'); diff --git a/packages/plugins/ens/package.json b/packages/plugins/ens/package.json index f60024678..ca5669b26 100644 --- a/packages/plugins/ens/package.json +++ b/packages/plugins/ens/package.json @@ -17,7 +17,8 @@ "ens" ], "files": [ - "dist" + "dist", + "index.js" ], "license": "MIT", "repository": { @@ -25,7 +26,7 @@ "type": "git", "url": "https://github.com/embarklabs/embark.git" }, - "main": "./dist/index.js", + "main": "./index.js", "types": "./dist/index.d.ts", "embark-collective": { "build:node": true, @@ -36,7 +37,7 @@ "_typecheck": "npm run solo -- typecheck", "ci": "npm run qa", "clean": "npm run reset", - "lint": "eslint src/", + "lint": "eslint src/ test/", "qa": "npm-run-all lint _typecheck _build test", "reset": "npx rimraf dist embark-*.tgz package", "solo": "embark-solo", @@ -61,7 +62,7 @@ "babel-jest": "24.9.0", "embark-solo": "^5.1.1", "embark-testing": "^5.2.0", - "eslint": "5.7.0", + "eslint": "6.8.0", "eslint-plugin-jest": "22.5.1", "jest": "24.9.0", "npm-run-all": "4.1.5", diff --git a/packages/plugins/ens/src/index.js b/packages/plugins/ens/src/index.js index d82c87b7b..6488aca12 100644 --- a/packages/plugins/ens/src/index.js +++ b/packages/plugins/ens/src/index.js @@ -224,33 +224,34 @@ class ENS { return cb(); } - await Promise.all(Object.keys(this.config.namesystemConfig.register.subdomains || {}).map((subDomainName) => { - return new Promise(async (resolve, _reject) => { - const address = this.config.namesystemConfig.register.subdomains[subDomainName]; - const directivesRegExp = new RegExp(/\$(\w+\[?\d?\]?)/g); + await Promise.all(Object.keys(this.config.namesystemConfig.register.subdomains || {}).map(async (subDomainName) => { + const address = this.config.namesystemConfig.register.subdomains[subDomainName]; + const directivesRegExp = new RegExp(/\$(\w+\[?\d?\]?)/g); - const directives = directivesRegExp.exec(address); - if (!directives || !directives.length || directives[0].includes('accounts')) { - return resolve(); - } + const directives = directivesRegExp.exec(address); + if (!directives || !directives.length || directives[0].includes('accounts')) { + return; + } - const contract = await this.events.request2("contracts:contract", directives[1]); - if (!contract) { - // if the contract is not registered in the config, it will be undefined here - this.logger.error(__('Tried to register the subdomain "{{subdomain}}" as contract "{{contractName}}", ' + - 'but "{{contractName}}" does not exist. Is it configured in your contract configuration?', { - contractName: directives[1], - subdomain: subDomainName - })); - return resolve(); + const contract = await this.events.request2("contracts:contract", directives[1]); + if (!contract) { + // if the contract is not registered in the config, it will be undefined here + this.logger.error(__('Tried to register the subdomain "{{subdomain}}" as contract "{{contractName}}", ' + + 'but "{{contractName}}" does not exist. Is it configured in your contract configuration?', { + contractName: directives[1], + subdomain: subDomainName + })); + return; + } + let resolve; + const promise = new Promise(res => { resolve = res; }); + this.safeRegisterSubDomain(subDomainName, contract.deployedAddress, defaultAccount, (err) => { + if (err) { + this.logger.error(err); } - this.safeRegisterSubDomain(subDomainName, contract.deployedAddress, defaultAccount, (err) => { - if (err) { - this.logger.error(err); - } - resolve(); - }); + resolve(); }); + return promise; })); cb(); diff --git a/packages/plugins/ens/test/index.js b/packages/plugins/ens/test/index.js index e45dfcc64..3fc3b6050 100644 --- a/packages/plugins/ens/test/index.js +++ b/packages/plugins/ens/test/index.js @@ -24,7 +24,7 @@ describe('embark-ens', () => { dappConnection: [] }, contractsConfig: {dappAutoEnable: true} - } + }; }); afterEach(() => { @@ -53,7 +53,7 @@ describe('embark-ens', () => { describe('safeRegisterSubDomain', () => { it('should register if the name is not registered', (done) => { - ens.ensResolve = jest.fn((name, cb) => {cb(null, null)}); + ens.ensResolve = jest.fn((name, cb) => { cb(null, null); }); ens.registerSubDomain = jest.fn((defaultAccount, subDomainName, reverseNode, address, secureSend, callback) => callback()); ens.safeRegisterSubDomain('test.eth', '0x0123', '0x4321', () => { @@ -63,7 +63,7 @@ describe('embark-ens', () => { }); it('should not register if the name is already registered', (done) => { - ens.ensResolve = jest.fn((name, cb) => {cb(null, '0x0123')}); + ens.ensResolve = jest.fn((name, cb) => { cb(null, '0x0123'); }); ens.registerSubDomain = jest.fn((defaultAccount, subDomainName, reverseNode, address, secureSend, callback) => callback()); ens.safeRegisterSubDomain('test.eth', '0x0123', '0x4321', () => { diff --git a/packages/plugins/ethereum-blockchain-client/index.js b/packages/plugins/ethereum-blockchain-client/index.js new file mode 100644 index 000000000..cce693358 --- /dev/null +++ b/packages/plugins/ethereum-blockchain-client/index.js @@ -0,0 +1 @@ +module.exports = require('./dist'); diff --git a/packages/plugins/ethereum-blockchain-client/package.json b/packages/plugins/ethereum-blockchain-client/package.json index 00769fcc2..d78299f86 100644 --- a/packages/plugins/ethereum-blockchain-client/package.json +++ b/packages/plugins/ethereum-blockchain-client/package.json @@ -16,7 +16,8 @@ "solidity" ], "files": [ - "dist" + "dist", + "index.js" ], "license": "MIT", "repository": { @@ -24,7 +25,7 @@ "type": "git", "url": "https://github.com/embarklabs/embark.git" }, - "main": "./dist/index.js", + "main": "./index.js", "types": "./dist/index.d.ts", "embark-collective": { "build:node": true, @@ -52,12 +53,13 @@ "embark-utils": "^5.2.0", "embarkjs": "^5.2.3-nightly.0", "ethereumjs-util": "6.0.0", + "ethers": "4.0.0-beta.3", "web3": "1.2.6", "web3-core-requestmanager": "1.2.6" }, "devDependencies": { "embark-solo": "^5.1.1", - "eslint": "5.7.0", + "eslint": "6.8.0", "npm-run-all": "4.1.5", "rimraf": "3.0.0" }, diff --git a/packages/plugins/ganache/index.js b/packages/plugins/ganache/index.js new file mode 100644 index 000000000..cce693358 --- /dev/null +++ b/packages/plugins/ganache/index.js @@ -0,0 +1 @@ +module.exports = require('./dist'); diff --git a/packages/plugins/ganache/package.json b/packages/plugins/ganache/package.json index 1ee0077e6..68adc4093 100644 --- a/packages/plugins/ganache/package.json +++ b/packages/plugins/ganache/package.json @@ -16,7 +16,8 @@ "solidity" ], "files": [ - "dist" + "dist", + "index.js" ], "license": "MIT", "repository": { @@ -24,7 +25,7 @@ "type": "git", "url": "https://github.com/embarklabs/embark.git" }, - "main": "./dist/index.js", + "main": "./index.js", "types": "./dist/index.d.ts", "embark-collective": { "build:node": true, @@ -53,7 +54,7 @@ }, "devDependencies": { "embark-solo": "^5.1.1", - "eslint": "5.7.0", + "eslint": "6.8.0", "npm-run-all": "4.1.5", "rimraf": "3.0.0" }, diff --git a/packages/plugins/geth/index.js b/packages/plugins/geth/index.js new file mode 100644 index 000000000..cce693358 --- /dev/null +++ b/packages/plugins/geth/index.js @@ -0,0 +1 @@ +module.exports = require('./dist'); diff --git a/packages/plugins/geth/package.json b/packages/plugins/geth/package.json index f94ac3bcf..60423e242 100644 --- a/packages/plugins/geth/package.json +++ b/packages/plugins/geth/package.json @@ -16,7 +16,8 @@ "solidity" ], "files": [ - "dist" + "dist", + "index.js" ], "license": "MIT", "repository": { @@ -24,7 +25,7 @@ "type": "git", "url": "https://github.com/embarklabs/embark.git" }, - "main": "./dist/index.js", + "main": "./index.js", "types": "./dist/index.d.ts", "embark-collective": { "build:node": true, @@ -62,7 +63,7 @@ }, "devDependencies": { "embark-solo": "^5.1.1", - "eslint": "5.7.0", + "eslint": "6.8.0", "npm-run-all": "4.1.5", "rimraf": "3.0.0", "tslint": "5.20.1", diff --git a/packages/plugins/graph/index.js b/packages/plugins/graph/index.js new file mode 100644 index 000000000..cce693358 --- /dev/null +++ b/packages/plugins/graph/index.js @@ -0,0 +1 @@ +module.exports = require('./dist'); diff --git a/packages/plugins/graph/package.json b/packages/plugins/graph/package.json index b438fa6f0..7686a8c6f 100644 --- a/packages/plugins/graph/package.json +++ b/packages/plugins/graph/package.json @@ -16,7 +16,8 @@ "solidity" ], "files": [ - "dist" + "dist", + "index.js" ], "license": "MIT", "repository": { @@ -24,7 +25,7 @@ "type": "git", "url": "https://github.com/embarklabs/embark.git" }, - "main": "./dist/index.js", + "main": "./index.js", "types": "./dist/index.d.ts", "embark-collective": { "build:node": true, @@ -52,7 +53,7 @@ }, "devDependencies": { "embark-solo": "^5.1.1", - "eslint": "5.7.0", + "eslint": "6.8.0", "npm-run-all": "4.1.5", "rimraf": "3.0.0" }, diff --git a/packages/plugins/ipfs/index.js b/packages/plugins/ipfs/index.js new file mode 100644 index 000000000..cce693358 --- /dev/null +++ b/packages/plugins/ipfs/index.js @@ -0,0 +1 @@ +module.exports = require('./dist'); diff --git a/packages/plugins/ipfs/package.json b/packages/plugins/ipfs/package.json index 972527c44..153c10972 100644 --- a/packages/plugins/ipfs/package.json +++ b/packages/plugins/ipfs/package.json @@ -18,6 +18,7 @@ ], "files": [ "dist", + "index.js", "process.js" ], "license": "MIT", @@ -26,7 +27,7 @@ "type": "git", "url": "https://github.com/embarklabs/embark.git" }, - "main": "./dist/index.js", + "main": "./index.js", "types": "./dist/index.d.ts", "embark-collective": { "build:node": true, @@ -37,7 +38,7 @@ "_typecheck": "npm run solo -- typecheck", "ci": "npm run qa", "clean": "npm run reset", - "lint": "eslint process.js src/", + "lint": "eslint src/", "qa": "npm-run-all lint _typecheck _build", "reset": "npx rimraf dist embark-*.tgz package", "solo": "embark-solo" @@ -50,6 +51,7 @@ "async": "2.6.1", "colors": "1.3.2", "core-js": "3.4.3", + "ejs": "2.6.1", "embark-core": "^5.2.2", "embark-i18n": "^5.1.1", "embark-storage": "^5.2.2", @@ -57,11 +59,12 @@ "embarkjs": "^5.2.3-nightly.0", "embarkjs-ipfs": "^5.1.1", "ipfs-http-client": "40.0.0", + "lodash.clonedeep": "4.5.0", "shelljs": "0.8.3" }, "devDependencies": { "embark-solo": "^5.1.1", - "eslint": "5.7.0", + "eslint": "6.8.0", "npm-run-all": "4.1.5", "rimraf": "3.0.0" }, diff --git a/packages/plugins/mocha-tests/index.js b/packages/plugins/mocha-tests/index.js new file mode 100644 index 000000000..ac2ea1322 --- /dev/null +++ b/packages/plugins/mocha-tests/index.js @@ -0,0 +1 @@ +module.exports = require('./dist/lib'); diff --git a/packages/plugins/mocha-tests/package.json b/packages/plugins/mocha-tests/package.json index 5313e0284..72aa79cf0 100644 --- a/packages/plugins/mocha-tests/package.json +++ b/packages/plugins/mocha-tests/package.json @@ -21,13 +21,18 @@ "solidity" ], "files": [ - "dist" + "dist", + "index.js" ], - "main": "./dist/lib/index.js", + "main": "./index.js", "types": "./dist/lib/index.d.ts", "embark-collective": { "build:node": true, - "typecheck": true + "typecheck": { + "include": [ + "src/lib/**/*" + ] + } }, "scripts": { "_build": "npm run solo -- build", @@ -60,7 +65,7 @@ }, "devDependencies": { "embark-solo": "^5.1.1", - "eslint": "5.7.0", + "eslint": "6.8.0", "npm-run-all": "4.1.5", "nyc": "13.1.0", "refute": "1.0.2", diff --git a/packages/plugins/nethermind/index.js b/packages/plugins/nethermind/index.js new file mode 100644 index 000000000..cce693358 --- /dev/null +++ b/packages/plugins/nethermind/index.js @@ -0,0 +1 @@ +module.exports = require('./dist'); diff --git a/packages/plugins/nethermind/package.json b/packages/plugins/nethermind/package.json index c78ebd747..39e012869 100644 --- a/packages/plugins/nethermind/package.json +++ b/packages/plugins/nethermind/package.json @@ -14,7 +14,8 @@ "nethermind" ], "files": [ - "dist" + "dist", + "index.js" ], "license": "MIT", "repository": { @@ -22,7 +23,7 @@ "type": "git", "url": "https://github.com/embarklabs/embark.git" }, - "main": "./dist/index.js", + "main": "./index.js", "types": "./dist/index.d.ts", "embark-collective": { "build:node": true, @@ -47,6 +48,7 @@ "core-js": "3.4.3", "embark-core": "^5.2.2", "embark-i18n": "^5.1.1", + "embark-logger": "^5.2.0", "embark-utils": "^5.2.0", "fs-extra": "8.1.0", "netcat": "1.3.5", @@ -55,7 +57,7 @@ }, "devDependencies": { "embark-solo": "^5.1.1", - "eslint": "5.7.0", + "eslint": "6.8.0", "npm-run-all": "4.1.5", "rimraf": "3.0.0" }, diff --git a/packages/plugins/nethermind/tsconfig.json b/packages/plugins/nethermind/tsconfig.json index 9fb3eb55c..e389b3cbb 100644 --- a/packages/plugins/nethermind/tsconfig.json +++ b/packages/plugins/nethermind/tsconfig.json @@ -16,6 +16,9 @@ { "path": "../../core/i18n" }, + { + "path": "../../core/logger" + }, { "path": "../../core/utils" } diff --git a/packages/plugins/parity/index.js b/packages/plugins/parity/index.js new file mode 100644 index 000000000..cce693358 --- /dev/null +++ b/packages/plugins/parity/index.js @@ -0,0 +1 @@ +module.exports = require('./dist'); diff --git a/packages/plugins/parity/package.json b/packages/plugins/parity/package.json index ccc096db9..78dff0116 100644 --- a/packages/plugins/parity/package.json +++ b/packages/plugins/parity/package.json @@ -16,7 +16,8 @@ "solidity" ], "files": [ - "dist" + "dist", + "index.js" ], "license": "MIT", "repository": { @@ -24,7 +25,7 @@ "type": "git", "url": "https://github.com/embarklabs/embark.git" }, - "main": "./dist/index.js", + "main": "./index.js", "types": "./dist/index.d.ts", "embark-collective": { "build:node": true, @@ -48,6 +49,7 @@ "async": "2.6.1", "core-js": "3.4.3", "embark-core": "^5.2.2", + "embark-logger": "^5.2.0", "embark-i18n": "^5.1.1", "embark-utils": "^5.2.0", "fs-extra": "8.1.0", @@ -57,7 +59,7 @@ }, "devDependencies": { "embark-solo": "^5.1.1", - "eslint": "5.7.0", + "eslint": "6.8.0", "npm-run-all": "4.1.5", "rimraf": "3.0.0" }, diff --git a/packages/plugins/parity/tsconfig.json b/packages/plugins/parity/tsconfig.json index a69fef8a7..f32573b1b 100644 --- a/packages/plugins/parity/tsconfig.json +++ b/packages/plugins/parity/tsconfig.json @@ -16,6 +16,9 @@ { "path": "../../core/i18n" }, + { + "path": "../../core/logger" + }, { "path": "../../core/utils" } diff --git a/packages/plugins/plugin-cmd/index.js b/packages/plugins/plugin-cmd/index.js new file mode 100644 index 000000000..cce693358 --- /dev/null +++ b/packages/plugins/plugin-cmd/index.js @@ -0,0 +1 @@ +module.exports = require('./dist'); diff --git a/packages/plugins/plugin-cmd/package.json b/packages/plugins/plugin-cmd/package.json index e1a92ca08..2abf9f36e 100644 --- a/packages/plugins/plugin-cmd/package.json +++ b/packages/plugins/plugin-cmd/package.json @@ -13,9 +13,10 @@ "url": "https://github.com/embarklabs/embark.git" }, "files": [ - "dist" + "dist", + "index.js" ], - "main": "./dist/index.js", + "main": "./index.js", "types": "./dist/index.d.ts", "embark-collective": { "build:node": true, @@ -43,7 +44,7 @@ }, "devDependencies": { "embark-solo": "^5.1.1", - "eslint": "5.7.0", + "eslint": "6.8.0", "npm-run-all": "4.1.5", "rimraf": "3.0.0" }, diff --git a/packages/plugins/profiler/index.js b/packages/plugins/profiler/index.js new file mode 100644 index 000000000..cce693358 --- /dev/null +++ b/packages/plugins/profiler/index.js @@ -0,0 +1 @@ +module.exports = require('./dist'); diff --git a/packages/plugins/profiler/package.json b/packages/plugins/profiler/package.json index 07c98aaf1..c027ca2a7 100644 --- a/packages/plugins/profiler/package.json +++ b/packages/plugins/profiler/package.json @@ -16,7 +16,8 @@ "solidity" ], "files": [ - "dist" + "dist", + "index.js" ], "license": "MIT", "repository": { @@ -24,7 +25,7 @@ "type": "git", "url": "https://github.com/embarklabs/embark.git" }, - "main": "./dist/index.js", + "main": "./index.js", "types": "./dist/index.d.ts", "embark-collective": { "build:node": true, @@ -54,7 +55,7 @@ }, "devDependencies": { "embark-solo": "^5.1.1", - "eslint": "5.7.0", + "eslint": "6.8.0", "npm-run-all": "4.1.5", "rimraf": "3.0.0" }, diff --git a/packages/plugins/rpc-manager/index.js b/packages/plugins/rpc-manager/index.js new file mode 100644 index 000000000..ac2ea1322 --- /dev/null +++ b/packages/plugins/rpc-manager/index.js @@ -0,0 +1 @@ +module.exports = require('./dist/lib'); diff --git a/packages/plugins/rpc-manager/package.json b/packages/plugins/rpc-manager/package.json index 65b4d4bf3..e57bfbc8d 100644 --- a/packages/plugins/rpc-manager/package.json +++ b/packages/plugins/rpc-manager/package.json @@ -20,13 +20,18 @@ "solidity" ], "files": [ - "dist/" + "dist", + "index.js" ], - "main": "./dist/lib/index.js", + "main": "./index.js", "types": "./dist/lib/index.d.ts", "embark-collective": { "build:node": true, - "typecheck": true + "typecheck": { + "include": [ + "src/lib/**/*" + ] + } }, "scripts": { "_build": "npm run solo -- build", @@ -58,7 +63,7 @@ "devDependencies": { "cross-env": "5.2.0", "embark-solo": "^5.1.1", - "eslint": "5.7.0", + "eslint": "6.8.0", "mocha": "6.2.2", "npm-run-all": "4.1.5", "nyc": "13.1.0", diff --git a/packages/plugins/scaffolding/index.js b/packages/plugins/scaffolding/index.js new file mode 100644 index 000000000..cce693358 --- /dev/null +++ b/packages/plugins/scaffolding/index.js @@ -0,0 +1 @@ +module.exports = require('./dist'); diff --git a/packages/plugins/scaffolding/package.json b/packages/plugins/scaffolding/package.json index a4e2ed97b..1a5ab63d1 100644 --- a/packages/plugins/scaffolding/package.json +++ b/packages/plugins/scaffolding/package.json @@ -16,7 +16,8 @@ "solidity" ], "files": [ - "dist" + "dist", + "index.js" ], "license": "MIT", "repository": { @@ -24,7 +25,7 @@ "type": "git", "url": "https://github.com/embarklabs/embark.git" }, - "main": "./dist/index.js", + "main": "./index.js", "types": "./dist/index.d.ts", "embark-collective": { "build:node": true, @@ -54,7 +55,7 @@ }, "devDependencies": { "embark-solo": "^5.1.1", - "eslint": "5.7.0", + "eslint": "6.8.0", "fs-extra": "8.1.0", "glob": "7.1.4", "lodash.clonedeep": "4.5.0", diff --git a/packages/plugins/scripts-runner/index.js b/packages/plugins/scripts-runner/index.js new file mode 100644 index 000000000..cce693358 --- /dev/null +++ b/packages/plugins/scripts-runner/index.js @@ -0,0 +1 @@ +module.exports = require('./dist'); diff --git a/packages/plugins/scripts-runner/package.json b/packages/plugins/scripts-runner/package.json index 250516a8a..57b83d8e2 100644 --- a/packages/plugins/scripts-runner/package.json +++ b/packages/plugins/scripts-runner/package.json @@ -12,9 +12,10 @@ "bugs": "https://github.com/embarklabs/embark/issues", "keywords": [], "files": [ - "dist/" + "dist", + "index.js" ], - "main": "./dist/index.js", + "main": "./index.js", "types": "./dist/index.d.ts", "embark-collective": { "build:node": true, @@ -26,12 +27,20 @@ "ci": "npm run qa", "clean": "npm run reset", "lint": "npm-run-all lint:*", + "lint:js": "eslint test/", "lint:ts": "tslint -c tslint.json \"src/**/*.ts\"", "qa": "npm-run-all lint _typecheck _build test", "reset": "npx rimraf dist embark-*.tgz package", "solo": "embark-solo", "test": "jest" }, + "eslintConfig": { + "extends": [ + "../../../.eslintrc.json", + "plugin:jest/recommended", + "plugin:jest/style" + ] + }, "dependencies": { "@babel/runtime-corejs3": "7.7.4", "async": "2.6.1", @@ -41,7 +50,8 @@ "embark-logger": "^5.2.0", "embark-utils": "^5.2.0", "fs-extra": "8.1.0", - "web3": "1.2.4" + "web3": "1.2.6", + "web3-eth": "1.2.6" }, "devDependencies": { "@babel/core": "7.7.4", @@ -49,10 +59,15 @@ "babel-jest": "24.9.0", "embark-solo": "^5.1.1-nightly.2", "embark-testing": "^5.2.0", + "eslint": "6.8.0", + "eslint-plugin-jest": "22.5.1", "jest": "24.9.0", "npm-run-all": "4.1.5", "rimraf": "3.0.0", - "tmp-promise": "1.1.0" + "sinon": "7.4.2", + "tmp-promise": "1.1.0", + "tslint": "5.20.1", + "typescript": "3.7.2" }, "engines": { "node": ">=10.17.0", diff --git a/packages/plugins/scripts-runner/test/script-runner.spec.js b/packages/plugins/scripts-runner/test/script-runner.spec.js index 5717d0ab0..04d2a4c97 100644 --- a/packages/plugins/scripts-runner/test/script-runner.spec.js +++ b/packages/plugins/scripts-runner/test/script-runner.spec.js @@ -2,7 +2,7 @@ import sinon from 'sinon'; import assert from 'assert'; import path from 'path'; import { fakeEmbark } from 'embark-testing'; -import ScriptsRunnerPlugin, { ScriptsRunnerCommand, ScriptsRunnerEvent } from '../src/'; +import ScriptsRunnerPlugin, { ScriptsRunnerCommand } from '../src/'; import { file as tmpFile, dir as tmpDir } from 'tmp-promise'; import { promises } from 'fs'; @@ -18,19 +18,19 @@ async function prepareScriptFile(content, dir) { const web3Mock = { eth: { - getBlock: sinon.spy((number, flag) => { hash: 'testhash'}) + getBlock: sinon.spy((_number, _flag) => 'testhash') } -} +}; describe('plugins/scripts-runner', () => { + // eslint-disable-next-line no-unused-vars let scriptRunner, testTracker, runCodeCommandHandler, blockchainClientProviderCommandHandler, contractsListCommandHandler, - embark, - plugins; + embark; beforeEach(async () => { const testBed = fakeEmbark({ @@ -43,15 +43,15 @@ describe('plugins/scripts-runner', () => { testTracker = { web3: web3Mock, - ensureTrackingFile: sinon.spy((hash, env) => {}), - track: sinon.spy(config => {}), + ensureTrackingFile: sinon.spy((_hash, _env) => {}), + track: sinon.spy(_config => {}), isTracked: sinon.spy(() => false), - setWeb3: sinon.spy(web3 => {}) + setWeb3: sinon.spy(_web3 => {}) }; embark = testBed.embark; - scriptRunner = new ScriptsRunnerPlugin(embark, { tracker: testTracker }) + scriptRunner = new ScriptsRunnerPlugin(embark, { tracker: testTracker }); runCodeCommandHandler = sinon.spy((code, cb) => { // `ScriptsRunnerPlugin` requests code evaluation two times. @@ -72,7 +72,7 @@ describe('plugins/scripts-runner', () => { { className: 'SimpleStorage' }, { className: 'AnotherOne' }, { className: 'Foo' } - ]) + ]); }); embark.events.setCommandHandler('contracts:list', contractsListCommandHandler); @@ -99,11 +99,13 @@ describe('plugins/scripts-runner', () => { it('should execute all scripts in a directory', async (done) => { const scriptsDir = await tmpDir(); + // eslint-disable-next-line no-unused-vars const scriptFile1 = await prepareScriptFile( `module.exports = () => { return 'done' }`, scriptsDir.path ); + // eslint-disable-next-line no-unused-vars const scriptFile2 = await prepareScriptFile( `module.exports = () => { return 'done2' }`, scriptsDir.path @@ -123,7 +125,7 @@ describe('plugins/scripts-runner', () => { const expectedResult = { scriptName: path.basename(scriptFile.path), scriptDirectory: path.basename(path.dirname(scriptFile.path)), - forceTracking: true, + forceTracking: true }; embark.events.request(ScriptsRunnerCommand.Execute, scriptFile.path, true, (err, result) => { @@ -137,7 +139,7 @@ describe('plugins/scripts-runner', () => { it('should track automatically if script directory equals migrations directory', async (done) => { const scriptsDir = await tmpDir(); - const migrationsDir = path.join(scriptsDir.path, embark.config.embarkConfig.migrations) + const migrationsDir = path.join(scriptsDir.path, embark.config.embarkConfig.migrations); await promises.mkdir(migrationsDir); @@ -149,7 +151,7 @@ describe('plugins/scripts-runner', () => { const expectedResult = { scriptName: path.basename(scriptFile.path), scriptDirectory: path.basename(migrationsDir), - forceTracking: false, + forceTracking: false }; embark.events.request(ScriptsRunnerCommand.Execute, scriptFile.path, false, (err, result) => { diff --git a/packages/plugins/snark/index.js b/packages/plugins/snark/index.js new file mode 100644 index 000000000..cce693358 --- /dev/null +++ b/packages/plugins/snark/index.js @@ -0,0 +1 @@ +module.exports = require('./dist'); diff --git a/packages/plugins/snark/package.json b/packages/plugins/snark/package.json index 9e621d4e1..5b1d3ec86 100644 --- a/packages/plugins/snark/package.json +++ b/packages/plugins/snark/package.json @@ -29,9 +29,10 @@ "url": "https://github.com/embarklabs/embark.git" }, "files": [ - "dist" + "dist", + "index.js" ], - "main": "./dist/index.js", + "main": "./index.js", "types": "./dist/index.d.ts", "embark-collective": { "build:node": true, @@ -58,15 +59,16 @@ }, "devDependencies": { "@babel/core": "7.7.4", + "@typescript-eslint/parser": "2.20.0", "babel-eslint": "10.0.3", "babel-jest": "24.9.0", "embark-solo": "^5.1.1", - "eslint": "6.2.2", + "eslint": "6.8.0", "eslint-config-prettier": "6.1.0", + "eslint-plugin-import": "2.18.2", "eslint-plugin-jest": "22.5.1", "eslint-plugin-prettier": "3.1.0", "jest": "24.9.0", - "lodash.clonedeep": "4.5.0", "npm-run-all": "4.1.5", "prettier": "1.18.2", "rimraf": "3.0.0" @@ -78,11 +80,19 @@ }, "extends": [ "eslint:recommended", + "plugin:import/typescript", "plugin:jest/recommended", "plugin:jest/style", "plugin:prettier/recommended" ], - "parser": "babel-eslint" + "parser": "babel-eslint", + "plugins": [ + "import" + ], + "rules": { + "import/no-extraneous-dependencies": "error", + "import/no-unresolved": [2, { "commonjs": true }] + } }, "jest": { "collectCoverage": true, diff --git a/packages/plugins/solc/index.js b/packages/plugins/solc/index.js new file mode 100644 index 000000000..cce693358 --- /dev/null +++ b/packages/plugins/solc/index.js @@ -0,0 +1 @@ +module.exports = require('./dist'); diff --git a/packages/plugins/solc/package.json b/packages/plugins/solc/package.json index 5f5e47565..59b829033 100644 --- a/packages/plugins/solc/package.json +++ b/packages/plugins/solc/package.json @@ -16,7 +16,8 @@ "solidity" ], "files": [ - "dist" + "dist", + "index.js" ], "license": "MIT", "repository": { @@ -24,7 +25,7 @@ "type": "git", "url": "https://github.com/embarklabs/embark.git" }, - "main": "./dist/index.js", + "main": "./index.js", "types": "./dist/index.d.ts", "embark-collective": { "build:node": true, @@ -52,7 +53,7 @@ }, "devDependencies": { "embark-solo": "^5.1.1", - "eslint": "5.7.0", + "eslint": "6.8.0", "npm-run-all": "4.1.5", "rimraf": "3.0.0" }, diff --git a/packages/plugins/solc/src/index.js b/packages/plugins/solc/src/index.js index f7f978499..ca6fb4fa1 100644 --- a/packages/plugins/solc/src/index.js +++ b/packages/plugins/solc/src/index.js @@ -1,4 +1,3 @@ -/*global require, module*/ const Compiler = require("./lib/Compiler"); const semver = require('semver'); diff --git a/packages/plugins/solidity-tests/index.js b/packages/plugins/solidity-tests/index.js new file mode 100644 index 000000000..ac2ea1322 --- /dev/null +++ b/packages/plugins/solidity-tests/index.js @@ -0,0 +1 @@ +module.exports = require('./dist/lib'); diff --git a/packages/plugins/solidity-tests/package.json b/packages/plugins/solidity-tests/package.json index 26adb7281..2f13bbbfb 100644 --- a/packages/plugins/solidity-tests/package.json +++ b/packages/plugins/solidity-tests/package.json @@ -21,13 +21,18 @@ "solidity" ], "files": [ - "dist" + "dist", + "index.js" ], - "main": "./dist/lib/index.js", + "main": "./index.js", "types": "./dist/lib/index.d.ts", "embark-collective": { "build:node": true, - "typecheck": true + "typecheck": { + "include": [ + "src/lib/**/*" + ] + } }, "scripts": { "_build": "npm run solo -- build", @@ -55,7 +60,7 @@ }, "devDependencies": { "embark-solo": "^5.1.1", - "eslint": "5.7.0", + "eslint": "6.8.0", "mocha": "6.2.2", "npm-run-all": "4.1.5", "nyc": "13.1.0", diff --git a/packages/plugins/solidity/index.js b/packages/plugins/solidity/index.js new file mode 100644 index 000000000..cce693358 --- /dev/null +++ b/packages/plugins/solidity/index.js @@ -0,0 +1 @@ +module.exports = require('./dist'); diff --git a/packages/plugins/solidity/package.json b/packages/plugins/solidity/package.json index b0e9d1ad3..c4701fe12 100644 --- a/packages/plugins/solidity/package.json +++ b/packages/plugins/solidity/package.json @@ -16,7 +16,8 @@ "solidity" ], "files": [ - "dist" + "dist", + "index.js" ], "license": "MIT", "repository": { @@ -24,7 +25,7 @@ "type": "git", "url": "https://github.com/embarklabs/embark.git" }, - "main": "./dist/index.js", + "main": "./index.js", "types": "./dist/index.d.ts", "embark-collective": { "build:node": true, @@ -52,13 +53,14 @@ "embark-utils": "^5.2.0", "find-up": "4.1.0", "fs-extra": "8.1.0", + "lodash.clonedeep": "4.5.0", "semver": "5.6.0", "solc": "0.6.1", "uuid": "3.3.2" }, "devDependencies": { "embark-solo": "^5.1.1", - "eslint": "5.7.0", + "eslint": "6.8.0", "npm-run-all": "4.1.5", "rimraf": "3.0.0" }, diff --git a/packages/plugins/specialconfigs/index.js b/packages/plugins/specialconfigs/index.js new file mode 100644 index 000000000..cce693358 --- /dev/null +++ b/packages/plugins/specialconfigs/index.js @@ -0,0 +1 @@ +module.exports = require('./dist'); diff --git a/packages/plugins/specialconfigs/package.json b/packages/plugins/specialconfigs/package.json index 82d2752bd..dd14089e3 100644 --- a/packages/plugins/specialconfigs/package.json +++ b/packages/plugins/specialconfigs/package.json @@ -16,7 +16,8 @@ "solidity" ], "files": [ - "dist" + "dist", + "index.js" ], "license": "MIT", "repository": { @@ -24,7 +25,7 @@ "type": "git", "url": "https://github.com/embarklabs/embark.git" }, - "main": "./dist/index.js", + "main": "./index.js", "types": "./dist/index.d.ts", "embark-collective": { "build:node": true, @@ -48,11 +49,12 @@ "async": "2.6.1", "core-js": "3.4.3", "embark-i18n": "^5.1.1", + "string-replace-async": "1.2.1", "viz.js": "1.8.2" }, "devDependencies": { "embark-solo": "^5.1.1", - "eslint": "5.7.0", + "eslint": "6.8.0", "npm-run-all": "4.1.5", "rimraf": "3.0.0" }, diff --git a/packages/plugins/specialconfigs/src/functionConfigs.js b/packages/plugins/specialconfigs/src/functionConfigs.js index 3292a5f08..0de9a6e21 100644 --- a/packages/plugins/specialconfigs/src/functionConfigs.js +++ b/packages/plugins/specialconfigs/src/functionConfigs.js @@ -78,33 +78,31 @@ class FunctionConfigs { } } - getDependenciesObject(logger) { - return new Promise(async (resolve, _reject) => { - let contracts = await this.events.request2("contracts:list"); + async getDependenciesObject(logger) { + let contracts = await this.events.request2("contracts:list"); - let args = { contracts: {}, logger}; - for (let contract of contracts) { - // TODO: for this to work correctly we need to add a default from address to the contract - if (contract.deploy === false) continue; + let args = { contracts: {}, logger}; + for (let contract of contracts) { + // TODO: for this to work correctly we need to add a default from address to the contract + if (contract.deploy === false) continue; + // eslint-disable-next-line no-await-in-loop + const contractRegisteredInVM = await this.checkContractRegisteredInVM(contract); + if (!contractRegisteredInVM) { // eslint-disable-next-line no-await-in-loop - const contractRegisteredInVM = await this.checkContractRegisteredInVM(contract); - if (!contractRegisteredInVM) { - // eslint-disable-next-line no-await-in-loop - await this.events.request2("embarkjs:contract:runInVm", contract); - } - // eslint-disable-next-line no-await-in-loop - let contractInstance = await this.events.request2("runcode:eval", contract.className); - args.contracts[contract.className] = contractInstance; + await this.events.request2("embarkjs:contract:runInVm", contract); } + // eslint-disable-next-line no-await-in-loop + let contractInstance = await this.events.request2("runcode:eval", contract.className); + args.contracts[contract.className] = contractInstance; + } - try { - let web3Instance = await this.events.request2("runcode:eval", "web3"); - args.web3 = web3Instance; + try { + let web3Instance = await this.events.request2("runcode:eval", "web3"); + args.web3 = web3Instance; // eslint-disable-next-line no-empty - } catch (_err) {} + } catch (_err) {} - resolve(args); - }); + return args; } async checkContractRegisteredInVM(contract) { diff --git a/packages/plugins/specialconfigs/src/index.js b/packages/plugins/specialconfigs/src/index.js index ba02492b7..f3d112405 100644 --- a/packages/plugins/specialconfigs/src/index.js +++ b/packages/plugins/specialconfigs/src/index.js @@ -1,5 +1,3 @@ -/* global module require */ - import {__} from 'embark-i18n'; const ListConfigs = require('./listConfigs.js'); const FunctionConfigs = require('./functionConfigs.js'); diff --git a/packages/plugins/suggestions/index.js b/packages/plugins/suggestions/index.js new file mode 100644 index 000000000..cce693358 --- /dev/null +++ b/packages/plugins/suggestions/index.js @@ -0,0 +1 @@ +module.exports = require('./dist'); diff --git a/packages/plugins/suggestions/package.json b/packages/plugins/suggestions/package.json index f96cf5512..25a4e5cbd 100644 --- a/packages/plugins/suggestions/package.json +++ b/packages/plugins/suggestions/package.json @@ -9,6 +9,7 @@ "keywords": [], "files": [ "dist", + "index.js", "suggestions.json" ], "license": "MIT", @@ -17,7 +18,7 @@ "type": "git", "url": "https://github.com/embark-framework/embark.git" }, - "main": "./dist/index.js", + "main": "./index.js", "types": "./dist/index.d.ts", "embark-collective": { "build:node": true, @@ -29,12 +30,20 @@ "ci": "npm run qa", "clean": "npm run reset", "lint": "npm-run-all lint:*", + "lint:js": "eslint test/", "lint:ts": "tslint -c tslint.json \"src/**/*.ts\"", "qa": "npm-run-all lint _typecheck _build test", "reset": "npx rimraf dist embark-*.tgz package", "solo": "embark-solo", "test": "jest" }, + "eslintConfig": { + "extends": [ + "../../../.eslintrc.json", + "plugin:jest/recommended", + "plugin:jest/style" + ] + }, "dependencies": { "@babel/runtime-corejs3": "7.7.4", "core-js": "3.4.3", @@ -47,7 +56,8 @@ "babel-jest": "24.9.0", "embark-solo": "^5.1.1", "embark-testing": "^5.2.0", - "eslint": "5.7.0", + "eslint": "6.8.0", + "eslint-plugin-jest": "22.5.1", "npm-run-all": "4.1.5", "rimraf": "3.0.0", "tslint": "5.20.1", diff --git a/packages/plugins/swarm/index.js b/packages/plugins/swarm/index.js new file mode 100644 index 000000000..cce693358 --- /dev/null +++ b/packages/plugins/swarm/index.js @@ -0,0 +1 @@ +module.exports = require('./dist'); diff --git a/packages/plugins/swarm/package.json b/packages/plugins/swarm/package.json index a70b27af0..4729439e1 100644 --- a/packages/plugins/swarm/package.json +++ b/packages/plugins/swarm/package.json @@ -19,6 +19,7 @@ ], "files": [ "dist", + "index.js", "process.js" ], "license": "MIT", @@ -27,7 +28,7 @@ "type": "git", "url": "https://github.com/embarklabs/embark.git" }, - "main": "./dist/index.js", + "main": "./index.js", "types": "./dist/index.d.ts", "embark-collective": { "build:node": true, @@ -38,7 +39,7 @@ "_typecheck": "npm run solo -- typecheck", "ci": "npm run qa", "clean": "npm run reset", - "lint": "eslint process.js src/", + "lint": "eslint src/", "qa": "npm-run-all lint _typecheck _build", "reset": "npx rimraf dist embark-*.tgz package", "solo": "embark-solo" @@ -57,11 +58,13 @@ "embark-utils": "^5.2.0", "embarkjs": "^5.2.3-nightly.0", "embarkjs-swarm": "^5.1.1", + "lodash.clonedeep": "4.5.0", + "shelljs": "0.8.3", "swarm-api": "0.1.2" }, "devDependencies": { "embark-solo": "^5.1.1", - "eslint": "5.7.0", + "eslint": "6.8.0", "npm-run-all": "4.1.5", "rimraf": "3.0.0" }, diff --git a/packages/plugins/transaction-logger/index.js b/packages/plugins/transaction-logger/index.js new file mode 100644 index 000000000..cce693358 --- /dev/null +++ b/packages/plugins/transaction-logger/index.js @@ -0,0 +1 @@ +module.exports = require('./dist'); diff --git a/packages/plugins/transaction-logger/package.json b/packages/plugins/transaction-logger/package.json index 94ab7ccc1..a52dbb7fb 100644 --- a/packages/plugins/transaction-logger/package.json +++ b/packages/plugins/transaction-logger/package.json @@ -16,7 +16,8 @@ "solidity" ], "files": [ - "dist" + "dist", + "index.js" ], "license": "MIT", "repository": { @@ -24,7 +25,7 @@ "type": "git", "url": "https://github.com/embarklabs/embark.git" }, - "main": "./dist/index.js", + "main": "./index.js", "types": "./dist/index.d.ts", "embark-collective": { "build:node": true, @@ -59,7 +60,7 @@ }, "devDependencies": { "embark-solo": "^5.1.1", - "eslint": "5.7.0", + "eslint": "6.8.0", "npm-run-all": "4.1.5", "rimraf": "3.0.0", "tslint": "5.20.1", diff --git a/packages/plugins/transaction-tracker/index.js b/packages/plugins/transaction-tracker/index.js new file mode 100644 index 000000000..cce693358 --- /dev/null +++ b/packages/plugins/transaction-tracker/index.js @@ -0,0 +1 @@ +module.exports = require('./dist'); diff --git a/packages/plugins/transaction-tracker/package.json b/packages/plugins/transaction-tracker/package.json index e84f085ea..2843d7f64 100644 --- a/packages/plugins/transaction-tracker/package.json +++ b/packages/plugins/transaction-tracker/package.json @@ -16,7 +16,8 @@ "solidity" ], "files": [ - "dist" + "dist", + "index.js" ], "license": "MIT", "repository": { @@ -24,7 +25,7 @@ "type": "git", "url": "https://github.com/embarklabs/embark.git" }, - "main": "./dist/index.js", + "main": "./index.js", "types": "./dist/index.d.ts", "embark-collective": { "build:node": true, @@ -47,11 +48,12 @@ "@babel/runtime-corejs3": "7.7.4", "async": "2.6.1", "core-js": "3.4.3", - "viz.js": "1.8.2" + "viz.js": "1.8.2", + "web3": "1.2.6" }, "devDependencies": { "embark-solo": "^5.1.1", - "eslint": "5.7.0", + "eslint": "6.8.0", "npm-run-all": "4.1.5", "rimraf": "3.0.0" }, diff --git a/packages/plugins/vyper/index.js b/packages/plugins/vyper/index.js new file mode 100644 index 000000000..cce693358 --- /dev/null +++ b/packages/plugins/vyper/index.js @@ -0,0 +1 @@ +module.exports = require('./dist'); diff --git a/packages/plugins/vyper/package.json b/packages/plugins/vyper/package.json index 1f3879773..ba06a857e 100644 --- a/packages/plugins/vyper/package.json +++ b/packages/plugins/vyper/package.json @@ -22,9 +22,10 @@ "url": "https://github.com/embarklabs/embark.git" }, "files": [ - "dist" + "dist", + "index.js" ], - "main": "./dist/index.js", + "main": "./index.js", "types": "./dist/index.d.ts", "embark-collective": { "build:node": true, @@ -52,7 +53,7 @@ }, "devDependencies": { "embark-solo": "^5.1.1", - "eslint": "5.7.0", + "eslint": "6.8.0", "npm-run-all": "4.1.5", "rimraf": "3.0.0" }, diff --git a/packages/plugins/web3/index.js b/packages/plugins/web3/index.js new file mode 100644 index 000000000..cce693358 --- /dev/null +++ b/packages/plugins/web3/index.js @@ -0,0 +1 @@ +module.exports = require('./dist'); diff --git a/packages/plugins/web3/package.json b/packages/plugins/web3/package.json index 28c44d92d..2b3e3d0bc 100644 --- a/packages/plugins/web3/package.json +++ b/packages/plugins/web3/package.json @@ -16,7 +16,8 @@ "solidity" ], "files": [ - "dist" + "dist", + "index.js" ], "license": "MIT", "repository": { @@ -24,7 +25,7 @@ "type": "git", "url": "https://github.com/embarklabs/embark.git" }, - "main": "./dist/index.js", + "main": "./index.js", "types": "./dist/index.d.ts", "embark-collective": { "build:node": true, @@ -48,12 +49,14 @@ "core-js": "3.4.3", "ejs": "2.6.1", "embark-core": "^5.2.2", + "embark-i18n": "^5.1.1", "embark-utils": "^5.2.0", - "embarkjs-web3": "^5.2.0" + "embarkjs-web3": "^5.2.0", + "web3": "1.2.6" }, "devDependencies": { "embark-solo": "^5.1.1", - "eslint": "5.7.0", + "eslint": "6.8.0", "fs-extra": "8.1.0", "glob": "7.1.4", "lodash.clonedeep": "4.5.0", diff --git a/packages/plugins/web3/tsconfig.json b/packages/plugins/web3/tsconfig.json index 81e2cddc2..94c353895 100644 --- a/packages/plugins/web3/tsconfig.json +++ b/packages/plugins/web3/tsconfig.json @@ -13,6 +13,9 @@ { "path": "../../core/core" }, + { + "path": "../../core/i18n" + }, { "path": "../../core/utils" }, diff --git a/packages/plugins/whisper-geth/index.js b/packages/plugins/whisper-geth/index.js new file mode 100644 index 000000000..cce693358 --- /dev/null +++ b/packages/plugins/whisper-geth/index.js @@ -0,0 +1 @@ +module.exports = require('./dist'); diff --git a/packages/plugins/whisper-geth/package.json b/packages/plugins/whisper-geth/package.json index 5b4f071b3..4bacc8ceb 100644 --- a/packages/plugins/whisper-geth/package.json +++ b/packages/plugins/whisper-geth/package.json @@ -16,7 +16,8 @@ "solidity" ], "files": [ - "dist" + "dist", + "index.js" ], "license": "MIT", "repository": { @@ -24,7 +25,7 @@ "type": "git", "url": "https://github.com/embarklabs/embark.git" }, - "main": "./dist/index.js", + "main": "./index.js", "types": "./dist/index.d.ts", "embark-collective": { "build:node": true, @@ -49,13 +50,17 @@ "core-js": "3.4.3", "embark-core": "^5.2.2", "embark-i18n": "^5.1.1", + "embark-logger": "^5.2.0", "embark-utils": "^5.2.0", + "embarkjs": "^5.2.3-nightly.0", "embarkjs-whisper": "^5.1.1", - "rxjs": "6.4.0" + "rxjs": "6.4.0", + "semver": "5.6.0", + "ws": "7.1.2" }, "devDependencies": { "embark-solo": "^5.1.1", - "eslint": "5.7.0", + "eslint": "6.8.0", "npm-run-all": "4.1.5", "rimraf": "3.0.0", "web3": "1.2.6" diff --git a/packages/plugins/whisper-geth/src/blockchain.js b/packages/plugins/whisper-geth/src/blockchain.js index 2cf4bbb07..49704778a 100644 --- a/packages/plugins/whisper-geth/src/blockchain.js +++ b/packages/plugins/whisper-geth/src/blockchain.js @@ -1,6 +1,5 @@ import { __ } from "embark-i18n"; const async = require("async"); -// eslint-disable-next-line security/detect-child-process const {spawn, exec} = require("child_process"); const path = require("path"); const constants = require("embark-core/constants"); diff --git a/packages/plugins/whisper-geth/src/whisperGethClient.js b/packages/plugins/whisper-geth/src/whisperGethClient.js index 606877cca..7869483f2 100644 --- a/packages/plugins/whisper-geth/src/whisperGethClient.js +++ b/packages/plugins/whisper-geth/src/whisperGethClient.js @@ -67,7 +67,6 @@ class WhisperGethClient { try { let v = semver(parsedVersion); v = `${v.major}.${v.minor}.${v.patch}`; - // eslint-disable-next-line no-cap test = semver.Range(this.versSupported).test(semver(v)); if (typeof test !== "boolean") { // eslint-disable-next-line no-undefined diff --git a/packages/plugins/whisper-geth/tsconfig.json b/packages/plugins/whisper-geth/tsconfig.json index 513dfff42..2f4050224 100644 --- a/packages/plugins/whisper-geth/tsconfig.json +++ b/packages/plugins/whisper-geth/tsconfig.json @@ -16,9 +16,15 @@ { "path": "../../core/i18n" }, + { + "path": "../../core/logger" + }, { "path": "../../core/utils" }, + { + "path": "../../embarkjs/embarkjs" + }, { "path": "../../embarkjs/whisper" } diff --git a/packages/plugins/whisper-parity/index.js b/packages/plugins/whisper-parity/index.js new file mode 100644 index 000000000..cce693358 --- /dev/null +++ b/packages/plugins/whisper-parity/index.js @@ -0,0 +1 @@ +module.exports = require('./dist'); diff --git a/packages/plugins/whisper-parity/package.json b/packages/plugins/whisper-parity/package.json index 4b04c7948..0325c6dea 100644 --- a/packages/plugins/whisper-parity/package.json +++ b/packages/plugins/whisper-parity/package.json @@ -16,7 +16,8 @@ "solidity" ], "files": [ - "dist" + "dist", + "index.js" ], "license": "MIT", "repository": { @@ -24,7 +25,7 @@ "type": "git", "url": "https://github.com/embarklabs/embark.git" }, - "main": "./dist/index.js", + "main": "./index.js", "types": "./dist/index.d.ts", "embark-collective": { "build:node": true, @@ -50,12 +51,13 @@ "embark-core": "^5.2.2", "embark-i18n": "^5.1.1", "embark-utils": "^5.2.0", + "embarkjs": "^5.2.3-nightly.0", "embarkjs-whisper": "^5.1.1", "rxjs": "6.4.0" }, "devDependencies": { "embark-solo": "^5.1.1", - "eslint": "5.7.0", + "eslint": "6.8.0", "npm-run-all": "4.1.5", "rimraf": "3.0.0", "web3": "1.2.6" diff --git a/packages/plugins/whisper-parity/tsconfig.json b/packages/plugins/whisper-parity/tsconfig.json index 6961db734..1d0fa8e2d 100644 --- a/packages/plugins/whisper-parity/tsconfig.json +++ b/packages/plugins/whisper-parity/tsconfig.json @@ -19,6 +19,9 @@ { "path": "../../core/utils" }, + { + "path": "../../embarkjs/embarkjs" + }, { "path": "../../embarkjs/whisper" } diff --git a/packages/stack/api/index.js b/packages/stack/api/index.js new file mode 100644 index 000000000..cce693358 --- /dev/null +++ b/packages/stack/api/index.js @@ -0,0 +1 @@ +module.exports = require('./dist'); diff --git a/packages/stack/api/package.json b/packages/stack/api/package.json index f037bba9b..ab4968b25 100644 --- a/packages/stack/api/package.json +++ b/packages/stack/api/package.json @@ -21,10 +21,11 @@ "type": "git", "url": "https://github.com/embarklabs/embark.git" }, - "main": "./dist/index.js", + "main": "./index.js", "types": "./dist/index.d.ts", "files": [ - "dist" + "dist", + "index.js" ], "embark-collective": { "build:node": true, @@ -59,7 +60,8 @@ "express": "4.17.1", "express-ws": "4.0.0", "find-up": "4.1.0", - "helmet": "3.13.0" + "helmet": "3.13.0", + "ws": "7.1.2" }, "devDependencies": { "embark-solo": "^5.1.1", diff --git a/packages/stack/authenticator/index.js b/packages/stack/authenticator/index.js new file mode 100644 index 000000000..cce693358 --- /dev/null +++ b/packages/stack/authenticator/index.js @@ -0,0 +1 @@ +module.exports = require('./dist'); diff --git a/packages/stack/authenticator/package.json b/packages/stack/authenticator/package.json index 25be52a7b..d17f75d0b 100644 --- a/packages/stack/authenticator/package.json +++ b/packages/stack/authenticator/package.json @@ -16,7 +16,8 @@ "solidity" ], "files": [ - "dist" + "dist", + "index.js" ], "license": "MIT", "repository": { @@ -24,7 +25,7 @@ "type": "git", "url": "https://github.com/embarklabs/embark.git" }, - "main": "./dist/index.js", + "main": "./index.js", "types": "./dist/index.d.ts", "embark-collective": { "build:node": true, @@ -53,7 +54,7 @@ }, "devDependencies": { "embark-solo": "^5.1.1", - "eslint": "5.7.0", + "eslint": "6.8.0", "npm-run-all": "4.1.5", "rimraf": "3.0.0" }, diff --git a/packages/stack/blockchain/index.js b/packages/stack/blockchain/index.js new file mode 100644 index 000000000..cce693358 --- /dev/null +++ b/packages/stack/blockchain/index.js @@ -0,0 +1 @@ +module.exports = require('./dist'); diff --git a/packages/stack/blockchain/package.json b/packages/stack/blockchain/package.json index d69fbb34e..304cb5c5e 100644 --- a/packages/stack/blockchain/package.json +++ b/packages/stack/blockchain/package.json @@ -16,7 +16,8 @@ "solidity" ], "files": [ - "dist" + "dist", + "index.js" ], "license": "MIT", "repository": { @@ -24,7 +25,7 @@ "type": "git", "url": "https://github.com/embarklabs/embark.git" }, - "main": "./dist/index.js", + "main": "./index.js", "types": "./dist/index.d.ts", "embark-collective": { "build:node": true, @@ -36,7 +37,7 @@ "ci": "npm run qa", "clean": "npm run reset", "lint": "npm-run-all lint:*", - "lint:js": "eslint src/", + "lint:js": "eslint src/ test/", "lint:ts": "tslint -c tslint.json \"src/**/*.ts\"", "qa": "npm-run-all lint _typecheck _build test", "reset": "npx rimraf dist embark-*.tgz package", @@ -44,7 +45,11 @@ "test": "jest" }, "eslintConfig": { - "extends": "../../../.eslintrc.json" + "extends": [ + "../../../.eslintrc.json", + "plugin:jest/recommended", + "plugin:jest/style" + ] }, "dependencies": { "@babel/runtime-corejs3": "7.7.4", @@ -54,14 +59,16 @@ "embark-core": "^5.2.2", "embark-i18n": "^5.1.1", "embark-logger": "^5.2.0", - "embark-utils": "^5.2.0" + "embark-utils": "^5.2.0", + "web3": "1.2.6" }, "devDependencies": { "@babel/core": "7.7.4", "babel-jest": "24.9.0", "embark-solo": "^5.1.1", "embark-testing": "^5.2.0", - "eslint": "5.7.0", + "eslint": "6.8.0", + "eslint-plugin-jest": "22.5.1", "jest": "24.9.0", "npm-run-all": "4.1.5", "rimraf": "3.0.0", diff --git a/packages/stack/blockchain/test/index.js b/packages/stack/blockchain/test/index.js index 44c4727e6..35c4c4beb 100644 --- a/packages/stack/blockchain/test/index.js +++ b/packages/stack/blockchain/test/index.js @@ -1,3 +1,4 @@ +// eslint-disable-next-line no-unused-vars import Blockchain from '../src/index'; describe('needs tests', () => { diff --git a/packages/stack/communication/index.js b/packages/stack/communication/index.js new file mode 100644 index 000000000..cce693358 --- /dev/null +++ b/packages/stack/communication/index.js @@ -0,0 +1 @@ +module.exports = require('./dist'); diff --git a/packages/stack/communication/package.json b/packages/stack/communication/package.json index ac4105b99..3d0edaf63 100644 --- a/packages/stack/communication/package.json +++ b/packages/stack/communication/package.json @@ -16,7 +16,8 @@ "solidity" ], "files": [ - "dist" + "dist", + "index.js" ], "license": "MIT", "repository": { @@ -24,7 +25,7 @@ "type": "git", "url": "https://github.com/embarklabs/embark.git" }, - "main": "./dist/index.js", + "main": "./index.js", "types": "./dist/index.d.ts", "embark-collective": { "build:node": true, @@ -35,14 +36,18 @@ "_typecheck": "npm run solo -- typecheck", "ci": "npm run qa", "clean": "npm run reset", - "lint": "eslint src/", + "lint": "eslint src/ test/", "qa": "npm-run-all lint _typecheck _build test", "reset": "npx rimraf dist embark-*.tgz package", "solo": "embark-solo", "test": "jest" }, "eslintConfig": { - "extends": "../../../.eslintrc.json" + "extends": [ + "../../../.eslintrc.json", + "plugin:jest/recommended", + "plugin:jest/style" + ] }, "dependencies": { "@babel/runtime-corejs3": "7.8.3", @@ -57,8 +62,10 @@ "embark-testing": "^5.2.0", "eslint": "6.8.0", "jest": "25.1.0", + "eslint-plugin-jest": "22.5.1", "npm-run-all": "4.1.5", - "rimraf": "3.0.0" + "rimraf": "3.0.0", + "sinon": "7.4.2" }, "engines": { "node": ">=10.17.0", diff --git a/packages/stack/communication/test/communication.spec.js b/packages/stack/communication/test/communication.spec.js index 3f95ebc35..93117f0dd 100644 --- a/packages/stack/communication/test/communication.spec.js +++ b/packages/stack/communication/test/communication.spec.js @@ -1,10 +1,11 @@ import sinon from 'sinon'; import assert from 'assert'; -import { fakeEmbark, Plugins } from 'embark-testing'; +import { fakeEmbark } from 'embark-testing'; import Communication from '../src/'; describe('stack/communication', () => { + // eslint-disable-next-line no-unused-vars let communication, communicationNodeLaunchFn, doneCb; const { embark } = fakeEmbark(); @@ -13,7 +14,7 @@ describe('stack/communication', () => { embark.setConfig({ communicationConfig: { connection: { - host: 'localhost', + host: 'localhost' } }, embarkConfig: {} @@ -24,10 +25,10 @@ describe('stack/communication', () => { communicationNodeLaunchFn = sinon.spy(done => { embark.events.request('processes:register', 'communication', { launchFn: cb => cb(), - stopFn: cb => cb(), + stopFn: cb => cb() }); - embark.events.request('processes:launch', 'communication', err => { + embark.events.request('processes:launch', 'communication', _err => { done(); }); }); @@ -46,8 +47,8 @@ describe('stack/communication', () => { enabled: true }; - const processRegisterHandler = sinon.spy((name, fns) => {}); - const processLaunchHandler = sinon.spy((name, fn) => fn()); + const processRegisterHandler = sinon.spy((_name, _fns) => {}); + const processLaunchHandler = sinon.spy((_name, fn) => fn()); embark.events.setCommandHandler('processes:register', processRegisterHandler); embark.events.setCommandHandler('processes:launch', processLaunchHandler); diff --git a/packages/stack/compiler/index.js b/packages/stack/compiler/index.js new file mode 100644 index 000000000..cce693358 --- /dev/null +++ b/packages/stack/compiler/index.js @@ -0,0 +1 @@ +module.exports = require('./dist'); diff --git a/packages/stack/compiler/package.json b/packages/stack/compiler/package.json index d3af8d809..db59bf04a 100644 --- a/packages/stack/compiler/package.json +++ b/packages/stack/compiler/package.json @@ -21,10 +21,11 @@ "type": "git", "url": "https://github.com/embarklabs/embark.git" }, - "main": "./dist/index.js", + "main": "./index.js", "types": "./dist/index.d.ts", "files": [ - "dist" + "dist", + "index.js" ], "embark-collective": { "build:node": true, @@ -36,12 +37,20 @@ "ci": "npm run qa", "clean": "npm run reset", "lint": "npm-run-all lint:*", + "lint:js": "eslint test/", "lint:ts": "tslint -c tslint.json \"src/**/*.ts\"", "qa": "npm-run-all lint _typecheck _build test", "reset": "npx rimraf dist embark-*.tgz package", "solo": "embark-solo", "test": "jest" }, + "eslintConfig": { + "extends": [ + "../../../.eslintrc.json", + "plugin:jest/recommended", + "plugin:jest/style" + ] + }, "dependencies": { "@babel/runtime-corejs3": "7.7.4", "core-js": "3.4.3", @@ -56,9 +65,12 @@ "cross-env": "5.2.0", "embark-solo": "^5.1.1", "embark-testing": "^5.2.0", + "eslint": "6.8.0", + "eslint-plugin-jest": "22.5.1", "jest": "24.9.0", "npm-run-all": "4.1.5", "rimraf": "3.0.0", + "sinon": "7.4.2", "tslint": "5.20.1", "typescript": "3.7.2" }, diff --git a/packages/stack/compiler/src/index.ts b/packages/stack/compiler/src/index.ts index 4d753b444..c9fadb217 100644 --- a/packages/stack/compiler/src/index.ts +++ b/packages/stack/compiler/src/index.ts @@ -1,11 +1,10 @@ import { Callback, CompilerPluginObject, Embark, EmbarkPlugins } from "embark-core"; import { __ } from "embark-i18n"; +import { File, Types, dappPath } from "embark-utils"; import * as os from "os"; import * as path from "path"; import { promisify } from "util"; -const { File, Types, dappPath } = require("embark-utils"); - export default class Compiler { private fs: any; private logger: any; diff --git a/packages/stack/compiler/test/compiler.spec.js b/packages/stack/compiler/test/compiler.spec.js index 71fb57768..cf54ba6fe 100644 --- a/packages/stack/compiler/test/compiler.spec.js +++ b/packages/stack/compiler/test/compiler.spec.js @@ -12,7 +12,8 @@ process.env.DAPP_PATH = 'something'; describe('stack/compiler', () => { - let compiler, doneCb; + // eslint-disable-next-line no-unused-vars + let compiler; beforeEach(() => { compiler = new Compiler(embark, { plugins }); @@ -27,7 +28,7 @@ describe('stack/compiler', () => { const fooCompiler = sinon.spy((files, options, cb) => cb(null, { contractA: 'someResultA', contractB: 'someResultB', - contractC: 'someResultC', + contractC: 'someResultC' })); embark.plugins.createPlugin('fooCompiler').registerCompiler('.foo', fooCompiler); @@ -35,7 +36,7 @@ describe('stack/compiler', () => { embark.events.request('compiler:contracts:compile', [ new File({filename: 'foo.foo', type: Types.dappFile, path: 'foo.foo'}), new File({filename: 'foo2.foo', type: Types.dappFile, path: 'foo2.foo'}), - new File({filename: 'foo3.foo', type: Types.dappFile, path: 'foo3.foo'}), + new File({filename: 'foo3.foo', type: Types.dappFile, path: 'foo3.foo'}) ], () => { assert(fooCompiler.called); done(); @@ -43,15 +44,13 @@ describe('stack/compiler', () => { }); test('it should iterate over available compilers to find a match for a given source file', done => { - const fooCompiler = sinon.spy((files, options, cb) => cb(null, { fooContract: 'foo', })); - const barCompiler = sinon.spy((files, options, cb) => cb(null, { barContract: 'bar', })); + const fooCompiler = sinon.spy((files, options, cb) => cb(null, { fooContract: 'foo' })); + const barCompiler = sinon.spy((files, options, cb) => cb(null, { barContract: 'bar' })); embark.plugins.createPlugin('fooCompiler').registerCompiler('.foo', fooCompiler); embark.plugins.createPlugin('barCompiler').registerCompiler('.bar', barCompiler); - embark.events.request('compiler:contracts:compile', [ - new File({filename: 'foo.bar', type: Types.dappFile, path: 'foo.bar'}), - ], () => { + embark.events.request('compiler:contracts:compile', [new File({filename: 'foo.bar', type: Types.dappFile, path: 'foo.bar'})], () => { assert(fooCompiler.notCalled); assert(barCompiler.called); done(); @@ -59,12 +58,10 @@ describe('stack/compiler', () => { }); test('it should not compile source files if there is no matching compiler', done => { - const fooCompiler = sinon.spy((files, options, cb) => cb(null, { fooContract: 'foo', })); + const fooCompiler = sinon.spy((files, options, cb) => cb(null, { fooContract: 'foo' })); embark.plugins.createPlugin('fooCompiler').registerCompiler('.foo', fooCompiler); - const files = [ - new File({filename: 'foo.bar', type: Types.dappFile, path: 'foo.bar'}) - ]; + const files = [new File({filename: 'foo.bar', type: Types.dappFile, path: 'foo.bar'})]; embark.events.request('compiler:contracts:compile', files, () => { files.forEach(file => assert(!file.compiled)); diff --git a/packages/stack/contracts-manager/index.js b/packages/stack/contracts-manager/index.js new file mode 100644 index 000000000..cce693358 --- /dev/null +++ b/packages/stack/contracts-manager/index.js @@ -0,0 +1 @@ +module.exports = require('./dist'); diff --git a/packages/stack/contracts-manager/package.json b/packages/stack/contracts-manager/package.json index 913bf0db1..7d08271d1 100644 --- a/packages/stack/contracts-manager/package.json +++ b/packages/stack/contracts-manager/package.json @@ -16,7 +16,8 @@ "solidity" ], "files": [ - "dist" + "dist", + "index.js" ], "license": "MIT", "repository": { @@ -24,7 +25,7 @@ "type": "git", "url": "https://github.com/embarklabs/embark.git" }, - "main": "./dist/index.js", + "main": "./index.js", "types": "./dist/index.d.ts", "embark-collective": { "build:node": true, diff --git a/packages/stack/deployment/index.js b/packages/stack/deployment/index.js new file mode 100644 index 000000000..cce693358 --- /dev/null +++ b/packages/stack/deployment/index.js @@ -0,0 +1 @@ +module.exports = require('./dist'); diff --git a/packages/stack/deployment/package.json b/packages/stack/deployment/package.json index 6f1d34980..7bd2b2805 100644 --- a/packages/stack/deployment/package.json +++ b/packages/stack/deployment/package.json @@ -16,7 +16,8 @@ "solidity" ], "files": [ - "dist" + "dist", + "index.js" ], "license": "MIT", "repository": { @@ -24,7 +25,7 @@ "type": "git", "url": "https://github.com/embarklabs/embark.git" }, - "main": "./dist/index.js", + "main": "./index.js", "types": "./dist/index.d.ts", "embark-collective": { "build:node": true, @@ -35,19 +36,25 @@ "_typecheck": "npm run solo -- typecheck", "ci": "npm run qa", "clean": "npm run reset", - "lint": "eslint src/", + "lint": "eslint src/ test/", "qa": "npm-run-all lint _typecheck _build test", "reset": "npx rimraf dist embark-*.tgz package", "solo": "embark-solo", "test": "jest" }, "eslintConfig": { - "extends": "../../../.eslintrc.json" + "extends": [ + "../../../.eslintrc.json", + "plugin:jest/recommended", + "plugin:jest/style" + ] }, "dependencies": { "@babel/runtime-corejs3": "7.7.4", "async": "2.6.1", + "clone-deep": "4.0.0", "core-js": "3.4.3", + "embark-core": "^5.2.2", "embark-i18n": "^5.1.1", "embark-utils": "^5.2.0" }, @@ -57,9 +64,11 @@ "embark-solo": "^5.1.1", "embark-testing": "^5.2.0", "eslint": "6.8.0", + "eslint-plugin-jest": "22.5.1", "jest": "25.1.0", "npm-run-all": "4.1.5", - "rimraf": "3.0.0" + "rimraf": "3.0.0", + "sinon": "7.4.2" }, "engines": { "node": ">=10.17.0", diff --git a/packages/stack/deployment/test/deployment.spec.js b/packages/stack/deployment/test/deployment.spec.js index 6af7f35a6..f393cf5f6 100644 --- a/packages/stack/deployment/test/deployment.spec.js +++ b/packages/stack/deployment/test/deployment.spec.js @@ -1,12 +1,13 @@ import sinon from 'sinon'; import assert from 'assert'; -import { fakeEmbark, Plugins } from 'embark-testing'; +import { fakeEmbark } from 'embark-testing'; import Deployment from '../src/'; describe('stack/deployment', () => { const { embark, plugins } = fakeEmbark(); + // eslint-disable-next-line no-unused-vars let deployment; let deployedContracts = []; @@ -49,8 +50,8 @@ describe('stack/deployment', () => { embark.events.request('deployment:deployer:register', 'ethereum', deployFn); embark.events.request('deployment:contract:deploy', testContract, doneCb); - assert(beforeDeployAction.calledOnce) - assert(shouldDeployAction.calledOnce) + assert(beforeDeployAction.calledOnce); + assert(shouldDeployAction.calledOnce); assert(deployFn.calledWith(testContract)); assert.equal(deployedContracts[0], testContract); assert(doneCb.calledOnce); diff --git a/packages/stack/deployment/tsconfig.json b/packages/stack/deployment/tsconfig.json index 1dde8c4db..2271c1bb9 100644 --- a/packages/stack/deployment/tsconfig.json +++ b/packages/stack/deployment/tsconfig.json @@ -10,6 +10,9 @@ "src/**/*" ], "references": [ + { + "path": "../../core/core" + }, { "path": "../../core/i18n" }, diff --git a/packages/stack/embarkjs/index.js b/packages/stack/embarkjs/index.js new file mode 100644 index 000000000..cce693358 --- /dev/null +++ b/packages/stack/embarkjs/index.js @@ -0,0 +1 @@ +module.exports = require('./dist'); diff --git a/packages/stack/embarkjs/package.json b/packages/stack/embarkjs/package.json index 822a461df..edda822c8 100644 --- a/packages/stack/embarkjs/package.json +++ b/packages/stack/embarkjs/package.json @@ -16,7 +16,8 @@ "solidity" ], "files": [ - "dist" + "dist", + "index.js" ], "license": "MIT", "repository": { @@ -24,7 +25,7 @@ "type": "git", "url": "https://github.com/embarklabs/embark.git" }, - "main": "./dist/index.js", + "main": "./index.js", "types": "./dist/index.d.ts", "embark-collective": { "build:node": true, @@ -48,11 +49,12 @@ "core-js": "3.4.3", "ejs": "2.6.1", "embark-core": "^5.2.2", - "embark-i18n": "^5.1.1" + "embark-i18n": "^5.1.1", + "embarkjs": "^5.2.3-nightly.0" }, "devDependencies": { "embark-solo": "^5.1.1", - "eslint": "5.7.0", + "eslint": "6.8.0", "npm-run-all": "4.1.5", "rimraf": "3.0.0" }, diff --git a/packages/stack/embarkjs/tsconfig.json b/packages/stack/embarkjs/tsconfig.json index fe0588b71..15fe4eac5 100644 --- a/packages/stack/embarkjs/tsconfig.json +++ b/packages/stack/embarkjs/tsconfig.json @@ -15,6 +15,9 @@ }, { "path": "../../core/i18n" + }, + { + "path": "../../embarkjs/embarkjs" } ] } diff --git a/packages/stack/library-manager/index.js b/packages/stack/library-manager/index.js new file mode 100644 index 000000000..cce693358 --- /dev/null +++ b/packages/stack/library-manager/index.js @@ -0,0 +1 @@ +module.exports = require('./dist'); diff --git a/packages/stack/library-manager/package.json b/packages/stack/library-manager/package.json index 8caa666e7..c42f5ee4a 100644 --- a/packages/stack/library-manager/package.json +++ b/packages/stack/library-manager/package.json @@ -16,7 +16,8 @@ "solidity" ], "files": [ - "dist" + "dist", + "index.js" ], "license": "MIT", "repository": { @@ -24,7 +25,7 @@ "type": "git", "url": "https://github.com/embarklabs/embark.git" }, - "main": "./dist/index.js", + "main": "./index.js", "types": "./dist/index.d.ts", "embark-collective": { "build:node": true, @@ -54,7 +55,7 @@ }, "devDependencies": { "embark-solo": "^5.1.1", - "eslint": "5.7.0", + "eslint": "6.8.0", "npm-run-all": "4.1.5", "rimraf": "3.0.0", "web3": "1.2.6" diff --git a/packages/stack/namesystem/index.js b/packages/stack/namesystem/index.js new file mode 100644 index 000000000..cce693358 --- /dev/null +++ b/packages/stack/namesystem/index.js @@ -0,0 +1 @@ +module.exports = require('./dist'); diff --git a/packages/stack/namesystem/package.json b/packages/stack/namesystem/package.json index 40bc04232..ccb8bb8ac 100644 --- a/packages/stack/namesystem/package.json +++ b/packages/stack/namesystem/package.json @@ -17,7 +17,8 @@ "ens" ], "files": [ - "dist" + "dist", + "index.js" ], "license": "MIT", "repository": { @@ -25,7 +26,7 @@ "type": "git", "url": "https://github.com/embarklabs/embark.git" }, - "main": "./dist/index.js", + "main": "./index.js", "types": "./dist/index.d.ts", "embark-collective": { "build:node": true, @@ -51,7 +52,7 @@ }, "devDependencies": { "embark-solo": "^5.1.1", - "eslint": "5.7.0", + "eslint": "6.8.0", "npm-run-all": "4.1.5", "rimraf": "3.0.0" }, diff --git a/packages/stack/pipeline/index.js b/packages/stack/pipeline/index.js new file mode 100644 index 000000000..cce693358 --- /dev/null +++ b/packages/stack/pipeline/index.js @@ -0,0 +1 @@ +module.exports = require('./dist'); diff --git a/packages/stack/pipeline/package.json b/packages/stack/pipeline/package.json index 226dd79d0..56705e975 100644 --- a/packages/stack/pipeline/package.json +++ b/packages/stack/pipeline/package.json @@ -16,7 +16,8 @@ "solidity" ], "files": [ - "dist" + "dist", + "index.js" ], "license": "MIT", "repository": { @@ -24,7 +25,7 @@ "type": "git", "url": "https://github.com/embarklabs/embark.git" }, - "main": "./dist/index.js", + "main": "./index.js", "types": "./dist/index.d.ts", "embark-collective": { "build:node": true, @@ -35,7 +36,7 @@ "_typecheck": "npm run solo -- typecheck", "ci": "npm run qa", "clean": "npm run reset", - "lint": "eslint src/", + "lint": "eslint src/ test/", "qa": "npm-run-all lint _typecheck _build", "reset": "npx rimraf dist embark-*.tgz package", "solo": "embark-solo", @@ -53,10 +54,12 @@ "devDependencies": { "babel-jest": "24.9.0", "embark-solo": "^5.1.1", - "eslint": "5.7.0", + "embark-testing": "^5.2.0", + "eslint": "6.8.0", "jest": "24.9.0", "npm-run-all": "4.1.5", - "rimraf": "3.0.0" + "rimraf": "3.0.0", + "sinon": "7.4.2" }, "engines": { "node": ">=10.17.0", diff --git a/packages/stack/pipeline/tsconfig.json b/packages/stack/pipeline/tsconfig.json index dac886458..0ce111b8d 100644 --- a/packages/stack/pipeline/tsconfig.json +++ b/packages/stack/pipeline/tsconfig.json @@ -12,6 +12,9 @@ "references": [ { "path": "../../core/utils" + }, + { + "path": "../../utils/testing" } ] } diff --git a/packages/stack/process-logs-api-manager/index.js b/packages/stack/process-logs-api-manager/index.js new file mode 100644 index 000000000..cce693358 --- /dev/null +++ b/packages/stack/process-logs-api-manager/index.js @@ -0,0 +1 @@ +module.exports = require('./dist'); diff --git a/packages/stack/process-logs-api-manager/package.json b/packages/stack/process-logs-api-manager/package.json index c1c2e9239..6bf3ed74c 100644 --- a/packages/stack/process-logs-api-manager/package.json +++ b/packages/stack/process-logs-api-manager/package.json @@ -16,7 +16,8 @@ "solidity" ], "files": [ - "dist" + "dist", + "index.js" ], "license": "MIT", "repository": { @@ -24,7 +25,7 @@ "type": "git", "url": "https://github.com/embarklabs/embark.git" }, - "main": "./dist/index.js", + "main": "./index.js", "types": "./dist/index.d.ts", "embark-collective": { "build:node": true, @@ -50,7 +51,7 @@ }, "devDependencies": { "embark-solo": "^5.1.1", - "eslint": "5.7.0", + "eslint": "6.8.0", "npm-run-all": "4.1.5", "rimraf": "3.0.0" }, diff --git a/packages/stack/proxy/index.js b/packages/stack/proxy/index.js new file mode 100644 index 000000000..cce693358 --- /dev/null +++ b/packages/stack/proxy/index.js @@ -0,0 +1 @@ +module.exports = require('./dist'); diff --git a/packages/stack/proxy/package.json b/packages/stack/proxy/package.json index 7a9adec9e..82420eef3 100644 --- a/packages/stack/proxy/package.json +++ b/packages/stack/proxy/package.json @@ -16,7 +16,8 @@ "solidity" ], "files": [ - "dist" + "dist", + "index.js" ], "license": "MIT", "repository": { @@ -24,7 +25,7 @@ "type": "git", "url": "https://github.com/embarklabs/embark.git" }, - "main": "./dist/index.js", + "main": "./index.js", "types": "./dist/index.d.ts", "embark-collective": { "build:node": true, @@ -36,6 +37,7 @@ "ci": "npm run qa", "clean": "npm run reset", "lint": "npm-run-all lint:*", + "lint:js": "eslint src/", "lint:ts": "tslint -c tslint.json \"src/**/*.ts\"", "qa": "npm-run-all lint _typecheck _build", "reset": "npx rimraf dist embark-*.tgz package", @@ -62,7 +64,7 @@ }, "devDependencies": { "embark-solo": "^5.1.1", - "eslint": "5.7.0", + "eslint": "6.8.0", "npm-run-all": "4.1.5", "rimraf": "3.0.0", "tslint": "5.20.1", diff --git a/packages/stack/proxy/src/proxy.js b/packages/stack/proxy/src/proxy.js index 817fb6d92..4a1e311c5 100644 --- a/packages/stack/proxy/src/proxy.js +++ b/packages/stack/proxy/src/proxy.js @@ -1,4 +1,3 @@ -/* global Buffer exports require */ import { __ } from 'embark-i18n'; import express from 'express'; import expressWs from 'express-ws'; @@ -163,16 +162,17 @@ export class Proxy { } } - forwardRequestToNode(request) { - return new Promise(async (resolve, reject) => { - const reqMgr = await this.requestManager; - reqMgr.send(request, (fwdReqErr, result) => { - if (fwdReqErr) { - return reject(fwdReqErr); - } - resolve(result); - }); + async forwardRequestToNode(request) { + const reqMgr = await this.requestManager; + let reject, resolve; + const promise = new Promise((res, rej) => { resolve = res; reject = rej; }); + reqMgr.send(request, (fwdReqErr, result) => { + if (fwdReqErr) { + return reject(fwdReqErr); + } + resolve(result); }); + return promise; } async handleSubscribe(clientSocket, request, response, cb) { diff --git a/packages/stack/storage/index.js b/packages/stack/storage/index.js new file mode 100644 index 000000000..cce693358 --- /dev/null +++ b/packages/stack/storage/index.js @@ -0,0 +1 @@ +module.exports = require('./dist'); diff --git a/packages/stack/storage/package.json b/packages/stack/storage/package.json index a0164da9c..36af59cf0 100644 --- a/packages/stack/storage/package.json +++ b/packages/stack/storage/package.json @@ -18,7 +18,7 @@ ], "files": [ "dist", - "processes.js" + "index.js" ], "license": "MIT", "repository": { @@ -26,7 +26,7 @@ "type": "git", "url": "https://github.com/embarklabs/embark.git" }, - "main": "./dist/index.js", + "main": "./index.js", "types": "./dist/index.d.ts", "embark-collective": { "build:node": true, @@ -37,7 +37,7 @@ "_typecheck": "npm run solo -- typecheck", "ci": "npm run qa", "clean": "npm run reset", - "lint": "eslint processes.js src/", + "lint": "eslint src/", "qa": "npm-run-all lint _typecheck _build", "reset": "npx rimraf dist embark-*.tgz package", "solo": "embark-solo" @@ -56,7 +56,7 @@ }, "devDependencies": { "embark-solo": "^5.1.1", - "eslint": "5.7.0", + "eslint": "6.8.0", "npm-run-all": "4.1.5", "rimraf": "3.0.0" }, diff --git a/packages/stack/storage/processes.js b/packages/stack/storage/processes.js deleted file mode 100644 index 173ed917b..000000000 --- a/packages/stack/storage/processes.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./dist/storageProcessesLauncher'); diff --git a/packages/stack/test-runner/index.js b/packages/stack/test-runner/index.js new file mode 100644 index 000000000..ac2ea1322 --- /dev/null +++ b/packages/stack/test-runner/index.js @@ -0,0 +1 @@ +module.exports = require('./dist/lib'); diff --git a/packages/stack/test-runner/package.json b/packages/stack/test-runner/package.json index ee9a28aba..1f5927f53 100644 --- a/packages/stack/test-runner/package.json +++ b/packages/stack/test-runner/package.json @@ -16,7 +16,8 @@ "solidity" ], "files": [ - "dist" + "dist", + "index.js" ], "license": "MIT", "repository": { @@ -24,11 +25,15 @@ "type": "git", "url": "https://github.com/embarklabs/embark.git" }, - "main": "./dist/lib/index.js", + "main": "./index.js", "types": "./dist/lib/index.d.ts", "embark-collective": { "build:node": true, - "typecheck": true + "typecheck": { + "include": [ + "src/lib/**/*" + ] + } }, "scripts": { "_build": "npm run solo -- build", @@ -53,6 +58,7 @@ "chalk": "2.4.2", "core-js": "3.4.3", "deep-equal": "1.0.1", + "embark-core": "^5.2.2", "embark-i18n": "^5.1.1", "embark-testing": "^5.2.0", "embark-utils": "^5.2.0", @@ -60,13 +66,13 @@ "istanbul-lib-coverage": "2.0.5", "istanbul-lib-report": "2.0.8", "istanbul-reports": "2.2.4", - "mocha": "6.2.2", + "lodash.clonedeep": "4.5.0", "open": "6.4.0", "web3": "1.2.6" }, "devDependencies": { "embark-solo": "^5.1.1", - "eslint": "5.7.0", + "eslint": "6.8.0", "mocha": "6.2.2", "npm-run-all": "4.1.5", "nyc": "13.1.0", diff --git a/packages/stack/test-runner/src/lib/index.js b/packages/stack/test-runner/src/lib/index.js index 8bac68505..7dbd410ed 100644 --- a/packages/stack/test-runner/src/lib/index.js +++ b/packages/stack/test-runner/src/lib/index.js @@ -366,25 +366,26 @@ class TestRunner { })(); } - evmMethod(method, params = []) { - return new Promise(async (resolve, reject) => { - const web3 = await this.web3; - const sendMethod = (web3.currentProvider.sendAsync) ? web3.currentProvider.sendAsync.bind(web3.currentProvider) : web3.currentProvider.send.bind(web3.currentProvider); - sendMethod( - { - jsonrpc: '2.0', - method, - params, - id: Date.now().toString().substring(9) - }, - (error, res) => { - if (error) { - return reject(error); - } - resolve(res.result); + async evmMethod(method, params = []) { + const web3 = await this.web3; + const sendMethod = (web3.currentProvider.sendAsync) ? web3.currentProvider.sendAsync.bind(web3.currentProvider) : web3.currentProvider.send.bind(web3.currentProvider); + let resolve, reject; + const promise = new Promise((res, rej) => { resolve = res; reject = rej; }); + sendMethod( + { + jsonrpc: '2.0', + method, + params, + id: Date.now().toString().substring(9) + }, + (error, res) => { + if (error) { + return reject(error); } - ); - }); + resolve(res.result); + } + ); + return promise; } } diff --git a/packages/stack/test-runner/tsconfig.json b/packages/stack/test-runner/tsconfig.json index d3608dac8..59643cb19 100644 --- a/packages/stack/test-runner/tsconfig.json +++ b/packages/stack/test-runner/tsconfig.json @@ -10,6 +10,9 @@ "src/lib/**/*" ], "references": [ + { + "path": "../../core/core" + }, { "path": "../../core/i18n" }, diff --git a/packages/stack/watcher/index.js b/packages/stack/watcher/index.js new file mode 100644 index 000000000..cce693358 --- /dev/null +++ b/packages/stack/watcher/index.js @@ -0,0 +1 @@ +module.exports = require('./dist'); diff --git a/packages/stack/watcher/package.json b/packages/stack/watcher/package.json index 6f51778d7..23e2be524 100644 --- a/packages/stack/watcher/package.json +++ b/packages/stack/watcher/package.json @@ -16,7 +16,8 @@ "solidity" ], "files": [ - "dist" + "dist", + "index.js" ], "license": "MIT", "repository": { @@ -24,7 +25,7 @@ "type": "git", "url": "https://github.com/embarklabs/embark.git" }, - "main": "./dist/index.js", + "main": "./index.js", "types": "./dist/index.d.ts", "embark-collective": { "build:node": true, @@ -52,7 +53,7 @@ }, "devDependencies": { "embark-solo": "^5.1.1", - "eslint": "5.7.0", + "eslint": "6.8.0", "npm-run-all": "4.1.5", "rimraf": "3.0.0" }, diff --git a/packages/stack/webserver/index.js b/packages/stack/webserver/index.js new file mode 100644 index 000000000..cce693358 --- /dev/null +++ b/packages/stack/webserver/index.js @@ -0,0 +1 @@ +module.exports = require('./dist'); diff --git a/packages/stack/webserver/package.json b/packages/stack/webserver/package.json index abf17c1bb..e803eb978 100644 --- a/packages/stack/webserver/package.json +++ b/packages/stack/webserver/package.json @@ -16,7 +16,8 @@ "solidity" ], "files": [ - "dist" + "dist", + "index.js" ], "license": "MIT", "repository": { @@ -24,7 +25,7 @@ "type": "git", "url": "https://github.com/embarklabs/embark.git" }, - "main": "./dist/index.js", + "main": "./index.js", "types": "./dist/index.d.ts", "embark-collective": { "build:node": true, @@ -47,6 +48,7 @@ "@babel/runtime-corejs3": "7.7.4", "async": "2.6.1", "core-js": "3.4.3", + "ejs": "2.6.1", "embark-i18n": "^5.1.1", "embark-utils": "^5.2.0", "express": "4.17.1", @@ -56,7 +58,7 @@ }, "devDependencies": { "embark-solo": "^5.1.1", - "eslint": "5.7.0", + "eslint": "6.8.0", "fs-extra": "8.1.0", "glob": "7.1.4", "lodash.clonedeep": "4.5.0", diff --git a/packages/utils/collective/bin/collective b/packages/utils/collective/bin/collective index 547bf1c3c..053f87b62 100755 --- a/packages/utils/collective/bin/collective +++ b/packages/utils/collective/bin/collective @@ -1,5 +1,3 @@ #!/usr/bin/env node -/* global process require */ - require('..')(process.argv.slice(2)); diff --git a/packages/utils/collective/package.json b/packages/utils/collective/package.json index 9c56d51a1..dbd8d032d 100644 --- a/packages/utils/collective/package.json +++ b/packages/utils/collective/package.json @@ -12,9 +12,10 @@ "keywords": [], "license": "MIT", "bin": "./bin/collective", - "main": "index.js", + "main": "./src/index.js", "files": [], "scripts": { + "_lint": "eslint bin/collective src/", "build": "run-p build:node build:browser", "build:browser": "node bin/collective build:browser", "build:browser:watch": "node bin/collective build:browser --verbose --watch", @@ -40,9 +41,13 @@ "// watch:test": "npm run test -- --watch", "watch:typecheck": "npm run typecheck -- --preserveWatchOutput --watch" }, + "eslintConfig": { + "extends": "../../../.eslintrc.json" + }, "devDependencies": { "@lerna/filter-packages": "3.16.0", "embark-inside-monorepo": "^5.1.0", + "eslint": "6.8.0", "find-up": "4.1.0", "fs-extra": "8.1.0", "glob": "7.1.4", diff --git a/packages/utils/collective/index.js b/packages/utils/collective/src/index.js similarity index 93% rename from packages/utils/collective/index.js rename to packages/utils/collective/src/index.js index ed0072519..b967b223c 100644 --- a/packages/utils/collective/index.js +++ b/packages/utils/collective/src/index.js @@ -1,7 +1,5 @@ -/* global Buffer __dirname module process require */ - const filterPackages = require('@lerna/filter-packages'); -const {fork, spawn} = require('child_process'); +const {spawn} = require('child_process'); const {sync: findUp} = require('find-up'); const {existsSync, readJsonSync, writeJsonSync} = require('fs-extra'); const {sync: glob} = require('glob'); @@ -213,7 +211,7 @@ function typecheck(cliArgs, filteredPkgJsonDict, allPkgJsonDict, solo) { const baseTsConfigPath = join(rootPath, 'tsconfig.base.json'); const collectiveTsConfigPath = join(rootPath, '.tsconfig.collective.json'); const typecheckCmd = process.platform === 'win32' ? 'tsc.cmd': 'tsc'; - const typecheckBinPath = join(__dirname, 'node_modules', '.bin', typecheckCmd); + const typecheckBinPath = join(__dirname, '..', 'node_modules', '.bin', typecheckCmd); const allPkgNames = new Set(Object.keys(allPkgJsonDict)); const seen = {}; @@ -242,18 +240,23 @@ function typecheck(cliArgs, filteredPkgJsonDict, allPkgJsonDict, solo) { }; pkgTsConfig.compilerOptions.rootDir = './src'; - if (basename(dirname(_pkgJson.main)) === 'lib' || - basename(dirname(dirname(_pkgJson.main))) === 'lib') { + if (_pkgJson.main && + (basename(dirname(_pkgJson.main)) === 'lib' || + basename(dirname(dirname(_pkgJson.main))) === 'lib')) { pkgTsConfig.include.push('src/lib/**/*'); } else { pkgTsConfig.include.push('src/**/*'); } let refs; - for (const pkgName of [...new Set([ - ...Object.keys(_pkgJson.dependencies), - ...Object.keys(_pkgJson.devDependencies) - ])].filter(n => n !== 'embark-solo')) { + for (const pkgName of [ + ...new Set( + [ + ...Object.keys(_pkgJson.dependencies), + ...Object.keys(_pkgJson.devDependencies) + ] + ) + ].filter(n => n !== 'embark-solo')) { if (allPkgNames.has(pkgName)) { if (!refs) { refs = true; @@ -262,7 +265,7 @@ function typecheck(cliArgs, filteredPkgJsonDict, allPkgJsonDict, solo) { const depPkgJson = allPkgJsonDict[pkgName]; const depPkgJsonTsConfig = (depPkgJson[EMBARK_COLLECTIVE] && - depPkgJson[EMBARK_COLLECTIVE].typecheck); + depPkgJson[EMBARK_COLLECTIVE].typecheck); if (depPkgJsonTsConfig) { pkgTsConfig.references.push({ @@ -272,6 +275,7 @@ function typecheck(cliArgs, filteredPkgJsonDict, allPkgJsonDict, solo) { ).replace(/\\/g, '/') }); + // eslint-disable-next-line max-depth if (!seen[pkgName]) { packages.push(depPkgJson); } @@ -333,7 +337,11 @@ function typecheck(cliArgs, filteredPkgJsonDict, allPkgJsonDict, solo) { } if (solo) { - const packagePath = dirname(Object.values(filteredPkgJsonDict)[0]._path); + let packagePath = Object.values(filteredPkgJsonDict)[0]; + packagePath = packagePath && dirname(packagePath._path); + if (!packagePath) { + process.exit(0); + } const doSolo = () => { const subp = spawn(typecheckBinPath, [ @@ -429,9 +437,8 @@ function refPathSort({path: pathA}, {path: pathB}) { return -1; } else if (pathA > pathB) { return 1; - } else { - return 0; } + return 0; } const embarkInsidePkg = 'embark-inside-monorepo'; diff --git a/packages/utils/inside-monorepo/package.json b/packages/utils/inside-monorepo/package.json index f2f4c9177..943bbadaa 100644 --- a/packages/utils/inside-monorepo/package.json +++ b/packages/utils/inside-monorepo/package.json @@ -5,12 +5,19 @@ "author": "Michael Bradley (https://github.com/michaelsbradleyjr/)", "description": "If a package from the monorepo can resolve this package then the first package is inside the monorepo", "license": "MIT", - "main": "index.js", + "main": "./src/index.js", "scripts": { + "ci": "npm run qa", "clean": "npm run reset", + "lint": "eslint src/", + "qa": "npm-run-all lint", "reset": "npx rimraf embark-*.tgz package" }, + "eslintConfig": { + "extends": "../../../.eslintrc.json" + }, "devDependencies": { + "eslint": "6.8.0", "rimraf": "3.0.0" }, "engines": { diff --git a/packages/utils/inside-monorepo/index.js b/packages/utils/inside-monorepo/src/index.js similarity index 100% rename from packages/utils/inside-monorepo/index.js rename to packages/utils/inside-monorepo/src/index.js diff --git a/packages/utils/solo/bin/solo b/packages/utils/solo/bin/solo index 547bf1c3c..053f87b62 100755 --- a/packages/utils/solo/bin/solo +++ b/packages/utils/solo/bin/solo @@ -1,5 +1,3 @@ #!/usr/bin/env node -/* global process require */ - require('..')(process.argv.slice(2)); diff --git a/packages/utils/solo/package.json b/packages/utils/solo/package.json index ad3367b39..2894ca80b 100644 --- a/packages/utils/solo/package.json +++ b/packages/utils/solo/package.json @@ -6,14 +6,21 @@ "description": "Resistance is not futile?", "license": "MIT", "bin": "./bin/solo", - "main": "index.js", + "main": "./src/index.js", "files": [], "scripts": { + "ci": "npm run qa", "clean": "npm run reset", + "lint": "eslint bin/solo src/", + "qa": "npm-run-all lint", "reset": "npx rimraf embark-*.tgz package" }, + "eslintConfig": { + "extends": "../../../.eslintrc.json" + }, "devDependencies": { "embark-collective": "^5.1.1", + "eslint": "6.8.0", "find-up": "4.1.0", "fs-extra": "8.1.0", "rimraf": "3.0.0" diff --git a/packages/utils/solo/index.js b/packages/utils/solo/src/index.js similarity index 81% rename from packages/utils/solo/index.js rename to packages/utils/solo/src/index.js index 26922cf8a..8a252f859 100644 --- a/packages/utils/solo/index.js +++ b/packages/utils/solo/src/index.js @@ -1,9 +1,6 @@ -/* global __dirname module process require */ - const {spawn} = require('child_process'); const {sync: findUp} = require('find-up'); const {readJsonSync, realpathSync} = require('fs-extra'); -const {join} = require('path'); module.exports = function (cliArgs) { process.env.EMBARK_SOLO='t'; @@ -20,10 +17,6 @@ module.exports = function (cliArgs) { 'node_modules/embark-collective', {cwd: __dirname, type: 'directory'} )); - const embarkCollectivePkgJson = readJsonSync( - join(embarkCollectivePath, 'package.json') - ); - const npmCmd = process.platform === 'win32' ? 'npm.cmd': 'npm'; const subp = spawn(npmCmd, [ 'run', diff --git a/packages/utils/testing/index.js b/packages/utils/testing/index.js new file mode 100644 index 000000000..cce693358 --- /dev/null +++ b/packages/utils/testing/index.js @@ -0,0 +1 @@ +module.exports = require('./dist'); diff --git a/packages/utils/testing/package.json b/packages/utils/testing/package.json index 4db4cd012..53434821d 100644 --- a/packages/utils/testing/package.json +++ b/packages/utils/testing/package.json @@ -3,8 +3,8 @@ "version": "5.2.0", "description": "Testing", "homepage": "https://github.com/embarklabs/embark/tree/master/packages/utils/testing#readme", - "main": "dist/lib/index.js", - "types": "./dist/lib/index.d.ts", + "main": "./index.js", + "types": "./dist/index.d.ts", "repository": { "directory": "packages/utils/testing", "type": "git", @@ -23,7 +23,8 @@ "solidity" ], "files": [ - "dist" + "dist", + "index.js" ], "embark-collective": { "build:node": true, @@ -35,7 +36,7 @@ "ci": "npm run qa", "clean": "npm run reset", "lint": "npm-run-all lint:*", - "lint:js": "eslint src/", + "lint:js": "eslint src/ test/", "lint:ts": "tslint -c tslint.json \"src/**/*.ts\"", "qa": "npm-run-all lint _typecheck _build test", "reset": "npx rimraf dist embark-*.tgz package", @@ -43,7 +44,11 @@ "test": "jest" }, "eslintConfig": { - "extends": "../../../.eslintrc.json" + "extends": [ + "../../../.eslintrc.json", + "plugin:jest/recommended", + "plugin:jest/style" + ] }, "dependencies": { "@babel/runtime-corejs3": "7.7.4", @@ -58,7 +63,8 @@ "@babel/core": "7.7.4", "babel-jest": "24.9.0", "embark-solo": "^5.1.1", - "eslint": "5.7.0", + "eslint": "6.8.0", + "eslint-plugin-jest": "22.5.1", "jest": "24.9.0", "lodash.clonedeep": "4.5.0", "npm-run-all": "4.1.5", diff --git a/packages/utils/testing/src/lib/embark.js b/packages/utils/testing/src/embark.js similarity index 100% rename from packages/utils/testing/src/lib/embark.js rename to packages/utils/testing/src/embark.js diff --git a/packages/utils/testing/src/lib/events.js b/packages/utils/testing/src/events.js similarity index 100% rename from packages/utils/testing/src/lib/events.js rename to packages/utils/testing/src/events.js diff --git a/packages/utils/testing/src/lib/httpServer.ts b/packages/utils/testing/src/httpServer.ts similarity index 98% rename from packages/utils/testing/src/lib/httpServer.ts rename to packages/utils/testing/src/httpServer.ts index 2c019c238..c3996cd5f 100644 --- a/packages/utils/testing/src/lib/httpServer.ts +++ b/packages/utils/testing/src/httpServer.ts @@ -1,5 +1,3 @@ -import { string } from "prop-types"; - import http from "http"; import net from "net"; import { waterfall } from "async"; diff --git a/packages/utils/testing/src/lib/index.js b/packages/utils/testing/src/index.js similarity index 100% rename from packages/utils/testing/src/lib/index.js rename to packages/utils/testing/src/index.js diff --git a/packages/utils/testing/src/lib/plugin.js b/packages/utils/testing/src/plugin.js similarity index 100% rename from packages/utils/testing/src/lib/plugin.js rename to packages/utils/testing/src/plugin.js diff --git a/packages/utils/testing/test/testing_test.js b/packages/utils/testing/test/testing_test.js index 14b2a906a..8e48a904c 100644 --- a/packages/utils/testing/test/testing_test.js +++ b/packages/utils/testing/test/testing_test.js @@ -1,6 +1,3 @@ -/* globals describe, it */ -const assert = require('assert').strict; - describe('Testing', () => { it('should have tests, please write them', (done) => { expect(true).toBe(true); diff --git a/packages/utils/testing/tsconfig.json b/packages/utils/testing/tsconfig.json index 0559c743a..43691378f 100644 --- a/packages/utils/testing/tsconfig.json +++ b/packages/utils/testing/tsconfig.json @@ -7,6 +7,6 @@ }, "extends": "../../../tsconfig.base.json", "include": [ - "src/lib/**/*" + "src/**/*" ] } diff --git a/scripts/check-working-tree.js b/scripts/check-working-tree.js index c0159082a..a933ca28b 100644 --- a/scripts/check-working-tree.js +++ b/scripts/check-working-tree.js @@ -1,5 +1,3 @@ -/* global process require */ - const {execSync} = require('child_process'); try { diff --git a/scripts/check-yarn-lock.js b/scripts/check-yarn-lock.js new file mode 100644 index 000000000..8573c32ab --- /dev/null +++ b/scripts/check-yarn-lock.js @@ -0,0 +1,33 @@ +const {readFileSync} = require('fs'); +const {join} = require('path'); + +try { + const yarnLock = readFileSync(join(__dirname, '..', 'yarn.lock')).toString(); + const embarkPkgs = yarnLock.match(/embark(js)?(-\S+)?@|@embarklabs\/\S+@/g); + const badSpecTest = spec => ( + !(spec.startsWith('embark-test-contract-') || + spec.startsWith('@embarklabs/ethereumjs-wallet')) + ); + if (embarkPkgs && + embarkPkgs.some(badSpecTest)) { + let badSpecs = [...(new Set(embarkPkgs))] + .filter(badSpecTest) + .map(spec => spec.slice(0, -1)); + const plur = badSpecs.length > 1; + console.error(); + console.error( + [ + `Found specifier${plur ? 's' : ''} for ${badSpecs.join(', ')} in the`, + `root yarn.lock file.\n\nThis probably happened because some package's`, + `version and/or dev/Deps specifiers need to be adjusted relative to`, + `the current versions in the master branch.` + ].join(' ') + ); + console.error(); + process.exit(1); + } + process.exit(0); +} catch(e) { + console.error(e); + process.exit(1); +} diff --git a/scripts/coverage-collect.js b/scripts/coverage-collect.js index d0e4e37fd..19a6c10e5 100644 --- a/scripts/coverage-collect.js +++ b/scripts/coverage-collect.js @@ -1,5 +1,3 @@ -/* global __dirname require */ - const fs = require('fs-extra'); const {execSync} = require('child_process'); const path = require('path'); diff --git a/scripts/coverage-collector.js b/scripts/coverage-collector.js index be80318b5..6c401d7a1 100644 --- a/scripts/coverage-collector.js +++ b/scripts/coverage-collector.js @@ -1,5 +1,3 @@ -/* global process require */ - const fs = require('fs'); const path = require('path'); diff --git a/scripts/coverage-report.js b/scripts/coverage-report.js index 0be22606b..c3d6a5157 100644 --- a/scripts/coverage-report.js +++ b/scripts/coverage-report.js @@ -1,5 +1,3 @@ -/* global __dirname require */ - const fs = require('fs-extra'); const {execSync} = require('child_process'); const path = require('path'); diff --git a/scripts/coveralls-branch-name.js b/scripts/coveralls-branch-name.js index 25c2787fc..4827aaadc 100644 --- a/scripts/coveralls-branch-name.js +++ b/scripts/coveralls-branch-name.js @@ -1,5 +1,3 @@ -/* global process require */ - const {execSync} = require('child_process'); const nameRevCmd = 'git name-rev --name-only HEAD'; diff --git a/scripts/coveralls-pr-id.js b/scripts/coveralls-pr-id.js index ae768346d..66390b3ac 100644 --- a/scripts/coveralls-pr-id.js +++ b/scripts/coveralls-pr-id.js @@ -1,5 +1,3 @@ -/* global process require */ - const {execSync} = require('child_process'); let branchName = execSync('git name-rev --name-only HEAD').toString().trim(); diff --git a/scripts/globalize.js b/scripts/globalize.js index c0d5aa5e6..ac0e55ca0 100644 --- a/scripts/globalize.js +++ b/scripts/globalize.js @@ -1,5 +1,3 @@ -/* global __dirname process require */ - const {execSync} = require('child_process'); const fs = require('fs'); const {EOL} = require('os'); @@ -15,7 +13,7 @@ const getStdout = (cmd) => { try { out = execSync( cmd, - {stdio: ['ignore', 'pipe', 'ignore']}, + {stdio: ['ignore', 'pipe', 'ignore']} ).toString().trim(); } catch (e) { process.exit(1); diff --git a/scripts/monorun.js b/scripts/monorun.js index 9020aa52d..20b75e4c5 100644 --- a/scripts/monorun.js +++ b/scripts/monorun.js @@ -1,5 +1,3 @@ -/* global process require */ - // there seems to be a bug in yarn whereby forwarding arguments with -- like so: // $ yarn monorun [...] -- --foo // results in [...] being stripped away; can workaround with: diff --git a/scripts/nightly-release.js b/scripts/nightly-release.js index 431736a73..51f8a4be7 100644 --- a/scripts/nightly-release.js +++ b/scripts/nightly-release.js @@ -1,5 +1,3 @@ -/* global __dirname process require */ - const chalk = require('chalk'); const {execSync} = require('child_process'); const path = require('path'); diff --git a/scripts/release.js b/scripts/release.js index 34b85b992..c91988fa2 100644 --- a/scripts/release.js +++ b/scripts/release.js @@ -1,5 +1,3 @@ -/* global __dirname process require */ - const chalk = require('chalk'); const {execSync} = require('child_process'); const minimist = require('minimist'); @@ -110,6 +108,7 @@ const runCommand = (cmd, inherit = true, display) => { return out; }; +// eslint-disable-next-line complexity (async () => { if (!noPush && createRelease && !process.env.GH_TOKEN) { logError( diff --git a/scripts/stable-release.js b/scripts/stable-release.js index 754f8c69b..c6912a7f4 100644 --- a/scripts/stable-release.js +++ b/scripts/stable-release.js @@ -1,5 +1,3 @@ -/* global __dirname process require */ - const chalk = require('chalk'); const {execSync} = require('child_process'); const minimist = require('minimist'); @@ -40,6 +38,7 @@ const runCommand = (cmd, inherit = true, display) => { return out; }; +// eslint-disable-next-line complexity (async () => { if (!process.env.GH_TOKEN) { logError( diff --git a/tslint.json b/tslint.json index 7501f818a..153cfa9ac 100644 --- a/tslint.json +++ b/tslint.json @@ -7,19 +7,20 @@ "rules": { "arrow-parens": false, "interface-name": [true, "never-prefix"], + "max-classes-per-file": false, "max-line-length": [true, 200], "member-ordering": [false], "member-access": false, "no-empty": false, "no-console": false, + "no-implicit-dependencies": true, + "no-irregular-whitespace": false, "no-var-requires": false, - "variable-name": ["allow-leading-underscore"], "object-literal-sort-keys": false, "ordered-imports": false, "quotemark": [false, "single"], "trailing-comma": false, - "no-irregular-whitespace": false, - "max-classes-per-file": false + "variable-name": ["allow-leading-underscore"] }, "rulesDirectory": [] } diff --git a/yarn.lock b/yarn.lock index e8c632728..5bb434724 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4702,6 +4702,15 @@ regexpp "^2.0.1" tsutils "^3.17.1" +"@typescript-eslint/experimental-utils@2.20.0": + version "2.20.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-2.20.0.tgz#3b6fa5a6b8885f126d5a4280e0d44f0f41e73e32" + integrity sha512-fEBy9xYrwG9hfBLFEwGW2lKwDRTmYzH3DwTmYbT+SMycmxAoPl0eGretnBFj/s+NfYBG63w/5c3lsvqqz5mYag== + dependencies: + "@types/json-schema" "^7.0.3" + "@typescript-eslint/typescript-estree" "2.20.0" + eslint-scope "^5.0.0" + "@typescript-eslint/experimental-utils@2.3.1": version "2.3.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-2.3.1.tgz#92f2531d3e7c22e64a2cc10cfe89935deaf00f7c" @@ -4711,6 +4720,16 @@ "@typescript-eslint/typescript-estree" "2.3.1" eslint-scope "^5.0.0" +"@typescript-eslint/parser@2.20.0": + version "2.20.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-2.20.0.tgz#608e5bb06ba98a415b64ace994c79ab20f9772a9" + integrity sha512-o8qsKaosLh2qhMZiHNtaHKTHyCHc3Triq6aMnwnWj7budm3xAY9owSZzV1uon5T9cWmJRJGzTFa90aex4m77Lw== + dependencies: + "@types/eslint-visitor-keys" "^1.0.0" + "@typescript-eslint/experimental-utils" "2.20.0" + "@typescript-eslint/typescript-estree" "2.20.0" + eslint-visitor-keys "^1.1.0" + "@typescript-eslint/parser@^2.2.0": version "2.3.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-2.3.1.tgz#f2b93b614d9b338825c44e75552a433e2ebf8c33" @@ -4721,6 +4740,19 @@ "@typescript-eslint/typescript-estree" "2.3.1" eslint-visitor-keys "^1.1.0" +"@typescript-eslint/typescript-estree@2.20.0": + version "2.20.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-2.20.0.tgz#90a0f5598826b35b966ca83483b1a621b1a4d0c9" + integrity sha512-WlFk8QtI8pPaE7JGQGxU7nGcnk1ccKAJkhbVookv94ZcAef3m6oCE/jEDL6dGte3JcD7reKrA0o55XhBRiVT3A== + dependencies: + debug "^4.1.1" + eslint-visitor-keys "^1.1.0" + glob "^7.1.6" + is-glob "^4.0.1" + lodash "^4.17.15" + semver "^6.3.0" + tsutils "^3.17.1" + "@typescript-eslint/typescript-estree@2.3.1": version "2.3.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-2.3.1.tgz#62c64f149948473d06a129dc33b4fc76e6c051f9" @@ -5048,7 +5080,7 @@ acorn@^5.0.0, acorn@^5.5.0, acorn@^5.5.3: resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.3.tgz#67aa231bf8812974b85235a96771eb6bd07ea279" integrity sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw== -acorn@^6.0.1, acorn@^6.0.2, acorn@^6.0.4, acorn@^6.0.7, acorn@^6.2.1: +acorn@^6.0.1, acorn@^6.0.4, acorn@^6.0.7, acorn@^6.2.1: version "6.3.0" resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.3.0.tgz#0087509119ffa4fc0a0041d1e93a417e68cb856e" integrity sha512-/czfa8BwS88b9gWQVhc8eknunSA2DoJpJyTQkhheIf5E48u1N0R4q/YxxsAeqRrmK9TQ/uYfgLDfZo91UlANIA== @@ -5156,7 +5188,7 @@ ajv-keywords@^3.1.0, ajv-keywords@^3.4.1: resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.4.1.tgz#ef916e271c64ac12171fd8384eaae6b2345854da" integrity sha512-RO1ibKvd27e6FEShVFfPALuHI3WjSVNeK5FIsmme/LYRNxjKuNj+Dt7bucLa6NdSv3JcVTyMlm9kGR84z1XpaQ== -ajv@6.10.2, ajv@^6.1.0, ajv@^6.10.0, ajv@^6.10.2, ajv@^6.5.3, ajv@^6.5.5, ajv@^6.9.1: +ajv@6.10.2, ajv@^6.1.0, ajv@^6.10.0, ajv@^6.10.2, ajv@^6.5.5, ajv@^6.9.1: version "6.10.2" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.10.2.tgz#d3cea04d6b017b2894ad69040fec8b623eb4bd52" integrity sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw== @@ -9640,7 +9672,7 @@ eslint-plugin-standard@~3.0.1: resolved "https://registry.yarnpkg.com/eslint-plugin-standard/-/eslint-plugin-standard-3.0.1.tgz#34d0c915b45edc6f010393c7eef3823b08565cf2" integrity sha1-NNDJFbRe3G8BA5PH7vOCOwhWXPI= -eslint-scope@^4.0.0, eslint-scope@^4.0.3: +eslint-scope@^4.0.3: version "4.0.3" resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-4.0.3.tgz#ca03833310f6889a3264781aa82e63eb9cfe7848" integrity sha512-p7VutNr1O/QrxysMo3E45FjYDTeXBy0iTltPFNSqKAIfjDSXC+4dj+qfyuD8bfAXrW/y6lW3O76VaYNPKfpKrg== @@ -9675,93 +9707,6 @@ eslint-visitor-keys@^1.0.0, eslint-visitor-keys@^1.1.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.1.0.tgz#e2a82cea84ff246ad6fb57f9bde5b46621459ec2" integrity sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A== -eslint@5.7.0: - version "5.7.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-5.7.0.tgz#55c326d6fb2ad45fcbd0ce17c3846f025d1d819c" - integrity sha512-zYCeFQahsxffGl87U2aJ7DPyH8CbWgxBC213Y8+TCanhUTf2gEvfq3EKpHmEcozTLyPmGe9LZdMAwC/CpJBM5A== - dependencies: - "@babel/code-frame" "^7.0.0" - ajv "^6.5.3" - chalk "^2.1.0" - cross-spawn "^6.0.5" - debug "^4.0.1" - doctrine "^2.1.0" - eslint-scope "^4.0.0" - eslint-utils "^1.3.1" - eslint-visitor-keys "^1.0.0" - espree "^4.0.0" - esquery "^1.0.1" - esutils "^2.0.2" - file-entry-cache "^2.0.0" - functional-red-black-tree "^1.0.1" - glob "^7.1.2" - globals "^11.7.0" - ignore "^4.0.6" - imurmurhash "^0.1.4" - inquirer "^6.1.0" - is-resolvable "^1.1.0" - js-yaml "^3.12.0" - json-stable-stringify-without-jsonify "^1.0.1" - levn "^0.3.0" - lodash "^4.17.5" - minimatch "^3.0.4" - mkdirp "^0.5.1" - natural-compare "^1.4.0" - optionator "^0.8.2" - path-is-inside "^1.0.2" - pluralize "^7.0.0" - progress "^2.0.0" - regexpp "^2.0.1" - require-uncached "^1.0.3" - semver "^5.5.1" - strip-ansi "^4.0.0" - strip-json-comments "^2.0.1" - table "^5.0.2" - text-table "^0.2.0" - -eslint@6.2.2: - version "6.2.2" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-6.2.2.tgz#03298280e7750d81fcd31431f3d333e43d93f24f" - integrity sha512-mf0elOkxHbdyGX1IJEUsNBzCDdyoUgljF3rRlgfyYh0pwGnreLc0jjD6ZuleOibjmnUWZLY2eXwSooeOgGJ2jw== - dependencies: - "@babel/code-frame" "^7.0.0" - ajv "^6.10.0" - chalk "^2.1.0" - cross-spawn "^6.0.5" - debug "^4.0.1" - doctrine "^3.0.0" - eslint-scope "^5.0.0" - eslint-utils "^1.4.2" - eslint-visitor-keys "^1.1.0" - espree "^6.1.1" - esquery "^1.0.1" - esutils "^2.0.2" - file-entry-cache "^5.0.1" - functional-red-black-tree "^1.0.1" - glob-parent "^5.0.0" - globals "^11.7.0" - ignore "^4.0.6" - import-fresh "^3.0.0" - imurmurhash "^0.1.4" - inquirer "^6.4.1" - is-glob "^4.0.0" - js-yaml "^3.13.1" - json-stable-stringify-without-jsonify "^1.0.1" - levn "^0.3.0" - lodash "^4.17.14" - minimatch "^3.0.4" - mkdirp "^0.5.1" - natural-compare "^1.4.0" - optionator "^0.8.2" - progress "^2.0.0" - regexpp "^2.0.1" - semver "^6.1.2" - strip-ansi "^5.2.0" - strip-json-comments "^3.0.1" - table "^5.2.3" - text-table "^0.2.0" - v8-compile-cache "^2.0.3" - eslint@6.8.0: version "6.8.0" resolved "https://registry.yarnpkg.com/eslint/-/eslint-6.8.0.tgz#62262d6729739f9275723824302fb227c8c93ffb" @@ -9939,15 +9884,6 @@ espree@^3.4.0: acorn "^5.5.0" acorn-jsx "^3.0.0" -espree@^4.0.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/espree/-/espree-4.1.0.tgz#728d5451e0fd156c04384a7ad89ed51ff54eb25f" - integrity sha512-I5BycZW6FCVIub93TeVY1s7vjhP9CY6cXCznIRfiig7nRviKZYdRnj/sHEWC6A7WE9RDWOFq9+7OsWSYz8qv2w== - dependencies: - acorn "^6.0.2" - acorn-jsx "^5.0.0" - eslint-visitor-keys "^1.0.0" - espree@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/espree/-/espree-5.0.1.tgz#5d6526fa4fc7f0788a5cf75b15f30323e2f81f7a" @@ -12068,12 +12004,7 @@ hoist-non-react-statics@^3.1.0, hoist-non-react-statics@^3.3.0: dependencies: react-is "^16.7.0" -hosted-git-info@2.7.1: - version "2.7.1" - resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.7.1.tgz#97f236977bd6e125408930ff6de3eec6281ec047" - integrity sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w== - -hosted-git-info@^2.1.4, hosted-git-info@^2.7.1: +hosted-git-info@2.8.4, hosted-git-info@^2.1.4, hosted-git-info@^2.7.1: version "2.8.4" resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.4.tgz#44119abaf4bc64692a16ace34700fed9c03e2546" integrity sha512-pzXIvANXEFrc5oFFXRMkbLPQ2rXRoDERwDLyrcUxGhaZhgP54BBSl9Oheh7Vv0T090cszWBxPjkQQ5Sq1PbBRQ== @@ -12603,7 +12534,7 @@ inquirer@^0.12.0: strip-ansi "^3.0.0" through "^2.3.6" -inquirer@^6.1.0, inquirer@^6.2.0, inquirer@^6.2.2, inquirer@^6.4.1: +inquirer@^6.2.0, inquirer@^6.2.2, inquirer@^6.4.1: version "6.5.2" resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-6.5.2.tgz#ad50942375d036d327ff528c08bd5fab089928ca" integrity sha512-cntlB5ghuB0iuO65Ovoi8ogLHiWGs/5yNrtUcKjFhSSiVeAIVpD7koaSU9RM8mpXw5YDi9RdYXGQMaOURB7ycQ== @@ -13219,7 +13150,7 @@ is-regexp@^1.0.0: resolved "https://registry.yarnpkg.com/is-regexp/-/is-regexp-1.0.0.tgz#fd2d883545c46bac5a633e7b9a09e87fa2cb5069" integrity sha1-/S2INUXEa6xaYz57mgnof6LLUGk= -is-resolvable@^1.0.0, is-resolvable@^1.1.0: +is-resolvable@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-resolvable/-/is-resolvable-1.1.0.tgz#fb18f87ce1feb925169c9a407c19318a3206ed88" integrity sha512-qgDYXFSR5WvEfuS5dMj6oTMEbrrSaM0CrFk2Yiq/gXnBvD9pMa2jGXxyhGLfvhZpuMZe18CJpFxAt3CRs42NMg== @@ -14348,7 +14279,7 @@ js-tokens@^3.0.2: resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" integrity sha1-mGbfOVECEw449/mWvOtlRDIJwls= -js-yaml@3.13.1, js-yaml@3.x, js-yaml@^3.12.0, js-yaml@^3.13.0, js-yaml@^3.13.1, js-yaml@^3.5.1: +js-yaml@3.13.1, js-yaml@3.x, js-yaml@^3.13.0, js-yaml@^3.13.1, js-yaml@^3.5.1: version "3.13.1" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847" integrity sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw== @@ -17688,11 +17619,6 @@ pluralize@^1.2.1: resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-1.2.1.tgz#d1a21483fd22bb41e58a12fa3421823140897c45" integrity sha1-0aIUg/0iu0HlihL6NCGCMUCJfEU= -pluralize@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-7.0.0.tgz#298b89df8b93b0221dbf421ad2b1b1ea23fc6777" - integrity sha512-ARhBOdzS3e41FbkW/XWrTEtukqqLoK5+Z/4UeDaLuSW+39JPeFgs4gCGqsrJHVZX0fUrx//4OF0K1CUGwlIFow== - pn@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/pn/-/pn-1.1.0.tgz#e2f4cef0e219f463c179ab37463e4e1ecdccbafb" @@ -20110,7 +20036,7 @@ require-main-filename@^2.0.0: resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b" integrity sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg== -require-uncached@^1.0.2, require-uncached@^1.0.3: +require-uncached@^1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/require-uncached/-/require-uncached-1.0.3.tgz#4e0d56d6c9662fd31e43011c4b95aa49955421d3" integrity sha1-Tg1W1slmL9MeQwEcS5WqSZVUIdM= @@ -22004,7 +21930,7 @@ table@^3.7.8: slice-ansi "0.0.4" string-width "^2.0.0" -table@^5.0.2, table@^5.2.3: +table@^5.2.3: version "5.4.6" resolved "https://registry.yarnpkg.com/table/-/table-5.4.6.tgz#1292d19500ce3f86053b05f0e8e7e4a3bb21079e" integrity sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug== @@ -23623,20 +23549,6 @@ web3-utils@1.2.6: underscore "1.9.1" utf8 "3.0.0" -web3@1.2.4, web3@^1.2.4: - version "1.2.4" - resolved "https://registry.yarnpkg.com/web3/-/web3-1.2.4.tgz#6e7ab799eefc9b4648c2dab63003f704a1d5e7d9" - integrity sha512-xPXGe+w0x0t88Wj+s/dmAdASr3O9wmA9mpZRtixGZxmBexAF0MjfqYM+MS4tVl5s11hMTN3AZb8cDD4VLfC57A== - dependencies: - "@types/node" "^12.6.1" - web3-bzz "1.2.4" - web3-core "1.2.4" - web3-eth "1.2.4" - web3-eth-personal "1.2.4" - web3-net "1.2.4" - web3-shh "1.2.4" - web3-utils "1.2.4" - web3@1.2.6: version "1.2.6" resolved "https://registry.yarnpkg.com/web3/-/web3-1.2.6.tgz#c497dcb14cdd8d6d9fb6b445b3b68ff83f8ccf68" @@ -23651,6 +23563,20 @@ web3@1.2.6: web3-shh "1.2.6" web3-utils "1.2.6" +web3@^1.2.4: + version "1.2.4" + resolved "https://registry.yarnpkg.com/web3/-/web3-1.2.4.tgz#6e7ab799eefc9b4648c2dab63003f704a1d5e7d9" + integrity sha512-xPXGe+w0x0t88Wj+s/dmAdASr3O9wmA9mpZRtixGZxmBexAF0MjfqYM+MS4tVl5s11hMTN3AZb8cDD4VLfC57A== + dependencies: + "@types/node" "^12.6.1" + web3-bzz "1.2.4" + web3-core "1.2.4" + web3-eth "1.2.4" + web3-eth-personal "1.2.4" + web3-net "1.2.4" + web3-shh "1.2.4" + web3-utils "1.2.4" + webidl-conversions@^4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-4.0.2.tgz#a855980b1f0b6b359ba1d5d9fb39ae941faa63ad"