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`).
This commit is contained in:
Michael Bradley, Jr 2020-02-20 17:47:01 -06:00 committed by Michael Bradley
parent ad19b9b8dc
commit 3693ebd90d
232 changed files with 985 additions and 723 deletions

View File

@ -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"
]
}
}
}
}

View File

@ -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', {
[
'@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', {
[
'@babel/plugin-proposal-class-properties', {
loose: true
}],
}
],
'@babel/plugin-proposal-nullish-coalescing-operator',
'@babel/plugin-proposal-optional-chaining',
['@babel/plugin-transform-runtime', {
[
'@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], {
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], {
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;

View File

@ -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"
}

View File

@ -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/*",

View File

@ -0,0 +1 @@
module.exports = require('./dist');

View File

@ -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"
},

View File

@ -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",

View File

@ -1,5 +1,3 @@
/* global __dirname process require */
const findUp = require('find-up');
const {copy, ensureDir} = require('fs-extra');
const path = require('path');

View File

@ -0,0 +1 @@
module.exports = require('./dist');

View File

@ -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"
},

View File

@ -1,4 +1,3 @@
/* global module process require */
const fs = require('fs-extra');
const os = require('os');
const parseJson = require('parse-json');

View File

@ -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';`);
});
});

View File

@ -19,6 +19,9 @@
{
"path": "../core"
},
{
"path": "../i18n"
},
{
"path": "../logger"
},

View File

@ -0,0 +1 @@
module.exports = require('./dist');

View File

@ -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",

View File

@ -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;

View File

@ -0,0 +1 @@
module.exports = require('./dist');

View File

@ -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",

View File

@ -1,5 +1,3 @@
/* global module process require */
const ipc = require('node-ipc');
const {parse, stringify} = require('flatted/cjs');
const path = require('path');

View File

@ -0,0 +1 @@
module.exports = require('./dist');

View File

@ -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,

View File

@ -0,0 +1 @@
module.exports = require('./dist');

View File

@ -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,

View File

@ -0,0 +1 @@
module.exports = require('./dist');

View File

@ -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",

View File

@ -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';

View File

@ -1,5 +0,0 @@
#!/usr/bin/env node
/* global module require */
require('./src').reset();

3
packages/core/reset/bin/reset Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env node
require('..').reset();

View File

@ -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": {

View File

@ -1,5 +1,3 @@
/* global exports process require */
const {join} = require('path');
const {promisify} = require('util');
const rimraf = promisify(require('rimraf'));

View File

@ -0,0 +1 @@
module.exports = require('./dist');

View File

@ -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",

View File

@ -1,5 +1,3 @@
/* global __dirname module require */
const findUp = require('find-up');
const {readJson, readJsonSync} = require('fs-extra');

View File

@ -1,5 +1,3 @@
/* global __dirname module require */
const cloneDeep = require('lodash.clonedeep');
const {copySync, ensureDirSync} = require('fs-extra');
const glob = require('glob');

View File

@ -1,4 +1,5 @@
#!/usr/bin/env node
require('source-map-support/register');
// eslint-disable-next-line import/no-unresolved
require('../dist/bin/embark');

View File

@ -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"
},

View File

@ -1,5 +1,3 @@
/* global __dirname process require */
const fs = require('fs-extra');
const os = require('os');
const path = require('path');

View File

@ -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

View File

@ -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);
});
});

View File

@ -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;
}
}

View File

@ -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

View File

@ -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 () {

View File

@ -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';

View File

@ -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;
}

View File

@ -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);

View File

@ -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) => {

View File

@ -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();
});

View File

@ -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';

View File

@ -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();

View File

@ -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');

View File

@ -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);

View File

@ -0,0 +1 @@
module.exports = require('./dist/lib/node');

View File

@ -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",

View File

@ -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;
}

View File

@ -1,5 +1,3 @@
/* global Buffer global module require */
const async = require('async');
const http = require('http');
const net = require('net');

View File

@ -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);

View File

@ -0,0 +1 @@
module.exports = require('./dist/node');

View File

@ -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"

View File

@ -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);

View File

@ -0,0 +1 @@
module.exports = require('./dist/node');

View File

@ -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"

View File

@ -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);

View File

@ -0,0 +1 @@
module.exports = require('./dist/node');

View File

@ -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"

View File

@ -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);

View File

@ -0,0 +1 @@
module.exports = require('./dist/node');

View File

@ -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"

View File

@ -1,5 +1,3 @@
/* global global require */
const Web3 = require('web3');
const __embarkWeb3 = {};

View File

@ -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);

View File

@ -0,0 +1 @@
module.exports = require('./dist/node');

View File

@ -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"

View File

@ -1,5 +1,3 @@
/* global module require */
const {fromEvent, merge, throwError} = require('rxjs');
const {map, mergeMap} = require('rxjs/operators');

View File

@ -1,4 +1,3 @@
/* global EmbarkJS Web3 listenTo sendMessage */
let Web3 = require('web3');
let { Manager } = require('web3-core-requestmanager');

View File

@ -0,0 +1 @@
module.exports = require('./dist');

View File

@ -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",

View File

@ -0,0 +1 @@
module.exports = require('./dist');

View File

@ -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"

View File

@ -1,5 +1,3 @@
/* global __dirname process require */
const {sync: findUp} = require('find-up');
const {delimiter, dirname, join} = require('path');

View File

@ -1,5 +1,3 @@
/* global __dirname module process require */
const fs = require('fs');
const path = require('path');

View File

@ -1,3 +1,4 @@
// eslint-disable-next-line no-unused-vars
import BasicPipeline from '../src/index';
describe('needs tests', () => {

View File

@ -0,0 +1 @@
module.exports = require('./dist/lib');

View File

@ -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",

View File

@ -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

View File

@ -0,0 +1 @@
module.exports = require('./dist');

View File

@ -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,

View File

@ -0,0 +1 @@
module.exports = require('./dist');

View File

@ -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",

View File

@ -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"
},

View File

@ -0,0 +1 @@
module.exports = require('./dist');

View File

@ -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",

View File

@ -224,14 +224,13 @@ class ENS {
return cb();
}
await Promise.all(Object.keys(this.config.namesystemConfig.register.subdomains || {}).map((subDomainName) => {
return new Promise(async (resolve, _reject) => {
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();
return;
}
const contract = await this.events.request2("contracts:contract", directives[1]);
@ -242,15 +241,17 @@ class ENS {
contractName: directives[1],
subdomain: subDomainName
}));
return resolve();
return;
}
let resolve;
const promise = new Promise(res => { resolve = res; });
this.safeRegisterSubDomain(subDomainName, contract.deployedAddress, defaultAccount, (err) => {
if (err) {
this.logger.error(err);
}
resolve();
});
});
return promise;
}));
cb();

View File

@ -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', () => {

View File

@ -0,0 +1 @@
module.exports = require('./dist');

View File

@ -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"
},

View File

@ -0,0 +1 @@
module.exports = require('./dist');

View File

@ -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"
},

View File

@ -0,0 +1 @@
module.exports = require('./dist');

View File

@ -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",

View File

@ -0,0 +1 @@
module.exports = require('./dist');

View File

@ -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"
},

Some files were not shown because too many files have changed in this diff Show More