aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-03-16 02:44:10 +0800
committerFabio Berger <me@fabioberger.com>2018-03-16 02:44:10 +0800
commit8d1e27a1a53f4c88ec9fefb5fd37b30c652782a6 (patch)
tree831b8d07c48d3700ec5662c7948ebab5e903b1b9
parentf9ad97b978ae4017adca032168ae7963c94e4157 (diff)
parent8137d41ce54b582032770c9b168016ce379711bf (diff)
downloaddexon-sol-tools-8d1e27a1a53f4c88ec9fefb5fd37b30c652782a6.tar
dexon-sol-tools-8d1e27a1a53f4c88ec9fefb5fd37b30c652782a6.tar.gz
dexon-sol-tools-8d1e27a1a53f4c88ec9fefb5fd37b30c652782a6.tar.bz2
dexon-sol-tools-8d1e27a1a53f4c88ec9fefb5fd37b30c652782a6.tar.lz
dexon-sol-tools-8d1e27a1a53f4c88ec9fefb5fd37b30c652782a6.tar.xz
dexon-sol-tools-8d1e27a1a53f4c88ec9fefb5fd37b30c652782a6.tar.zst
dexon-sol-tools-8d1e27a1a53f4c88ec9fefb5fd37b30c652782a6.zip
Merge branch 'development' into addExtraDocs
* development: Add changelog entry about pragma addition Add pragma above command-line script Keep console.log in monorepo-scripts Enable coverage for all other packages with tests Fix parallel coverage results reporting Fix linter issuesx Update CHANGELOGs Consolidate all console.log into the @0xproject/utils package # Conflicts: # packages/deployer/package.json
-rw-r--r--.circleci/config.yml74
-rw-r--r--package.json5
-rw-r--r--packages/0x.js/CHANGELOG.md4
-rw-r--r--packages/0x.js/coverage/.gitkeep0
-rw-r--r--packages/0x.js/package.json7
-rw-r--r--packages/0x.js/src/utils/utils.ts4
-rw-r--r--packages/abi-gen/CHANGELOG.md4
-rw-r--r--packages/abi-gen/src/index.ts17
-rw-r--r--packages/abi-gen/src/utils.ts3
-rw-r--r--packages/assert/coverage/.gitkeep0
-rw-r--r--packages/assert/package.json5
-rw-r--r--packages/connect/coverage/.gitkeep0
-rw-r--r--packages/connect/package.json5
-rw-r--r--packages/contracts/package.json6
-rw-r--r--packages/deployer/CHANGELOG.md2
-rw-r--r--packages/deployer/coverage/.gitkeep0
-rw-r--r--packages/deployer/package.json5
-rw-r--r--packages/deployer/src/compiler.ts20
-rw-r--r--packages/deployer/src/deployer.ts5
-rw-r--r--packages/deployer/src/utils/utils.ts5
-rw-r--r--packages/dev-utils/coverage/.gitkeep0
-rw-r--r--packages/dev-utils/package.json5
-rw-r--r--packages/json-schemas/coverage/.gitkeep0
-rw-r--r--packages/json-schemas/package.json5
-rw-r--r--packages/monorepo-scripts/src/deps_versions.ts10
-rw-r--r--packages/monorepo-scripts/tsconfig.json2
-rw-r--r--packages/react-docs/CHANGELOG.md3
-rw-r--r--packages/react-docs/package.json1
-rw-r--r--packages/react-docs/src/components/custom_enum.tsx3
-rw-r--r--packages/react-docs/src/utils/utils.ts5
-rw-r--r--packages/sra-report/CHANGELOG.md4
-rw-r--r--packages/sra-report/src/index.ts11
-rw-r--r--packages/sra-report/src/postman_environment_factory.ts4
-rw-r--r--packages/subproviders/coverage/.gitkeep0
-rw-r--r--packages/subproviders/package.json5
-rw-r--r--packages/testnet-faucets/src/ts/dispatch_queue.ts5
-rw-r--r--packages/testnet-faucets/src/ts/dispense_asset_tasks.ts15
-rw-r--r--packages/testnet-faucets/src/ts/error_reporter.ts6
-rw-r--r--packages/testnet-faucets/src/ts/handler.ts7
-rw-r--r--packages/testnet-faucets/src/ts/parameter_transformer.ts1
-rw-r--r--packages/testnet-faucets/src/ts/utils.ts7
-rw-r--r--packages/testnet-faucets/tsconfig.json1
-rw-r--r--packages/utils/CHANGELOG.md4
-rw-r--r--packages/utils/src/index.ts1
-rw-r--r--packages/utils/src/log_utils.ts (renamed from packages/sra-report/src/utils.ts)2
-rw-r--r--packages/website/ts/blockchain.ts8
-rw-r--r--packages/website/ts/blockchain_watcher.ts4
-rw-r--r--packages/website/ts/components/dialogs/ledger_config_dialog.tsx6
-rw-r--r--packages/website/ts/components/eth_weth_conversion_button.tsx6
-rw-r--r--packages/website/ts/components/fill_order.tsx10
-rw-r--r--packages/website/ts/components/generate_order/generate_order_form.tsx8
-rw-r--r--packages/website/ts/components/inputs/allowance_toggle.tsx6
-rw-r--r--packages/website/ts/components/order_json.tsx4
-rw-r--r--packages/website/ts/components/portal.tsx4
-rw-r--r--packages/website/ts/components/send_button.tsx6
-rw-r--r--packages/website/ts/components/token_balances.tsx8
-rw-r--r--packages/website/ts/pages/wiki/wiki.tsx3
-rw-r--r--packages/website/ts/utils/doc_utils.ts5
-rw-r--r--packages/website/ts/utils/error_reporter.ts3
-rw-r--r--packages/website/ts/utils/utils.ts5
-rw-r--r--yarn.lock170
61 files changed, 380 insertions, 154 deletions
diff --git a/.circleci/config.yml b/.circleci/config.yml
index 4143bd532..3b1f55656 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -40,6 +40,10 @@ jobs:
command: npm run testrpc -- --db testrpc_snapshot
background: true
- run: yarn lerna:run --scope 0x.js test:circleci
+ - save_cache:
+ key: coverage-0xjs-{{ .Environment.CIRCLE_SHA1 }}
+ paths:
+ - ~/repo/packages/0x.js/coverage/lcov.info
test-contracts:
docker:
- image: circleci/node:6.12
@@ -53,6 +57,10 @@ jobs:
command: npm run testrpc -- --db testrpc_snapshot
background: true
- run: yarn lerna:run --scope contracts test:circleci
+ - save_cache:
+ key: coverage-contracts-{{ .Environment.CIRCLE_SHA1 }}
+ paths:
+ - ~/repo/packages/contracts/coverage/lcov.info
test-deployer:
docker:
- image: circleci/node:6.12
@@ -66,6 +74,10 @@ jobs:
command: npm run testrpc -- --db testrpc_snapshot
background: true
- run: yarn lerna:run --scope @0xproject/deployer test:circleci
+ - save_cache:
+ key: coverage-deployer-{{ .Environment.CIRCLE_SHA1 }}
+ paths:
+ - ~/repo/packages/deployer/coverage/lcov.info
test-rest:
docker:
- image: circleci/node:6.12
@@ -79,6 +91,26 @@ jobs:
command: npm run testrpc -- --db testrpc_snapshot
background: true
- run: yarn lerna:run --ignore contracts --ignore 0x.js --ignore @0xproject/deployer test:circleci
+ - save_cache:
+ key: coverage-assert-{{ .Environment.CIRCLE_SHA1 }}
+ paths:
+ - ~/repo/packages/assert/coverage/lcov.info
+ - save_cache:
+ key: coverage-connect-{{ .Environment.CIRCLE_SHA1 }}
+ paths:
+ - ~/repo/packages/connect/coverage/lcov.info
+ - save_cache:
+ key: coverage-dev-utils-{{ .Environment.CIRCLE_SHA1 }}
+ paths:
+ - ~/repo/packages/dev-utils/coverage/lcov.info
+ - save_cache:
+ key: coverage-json-schemas-{{ .Environment.CIRCLE_SHA1 }}
+ paths:
+ - ~/repo/packages/json-schemas/coverage/lcov.info
+ - save_cache:
+ key: coverage-subproviders-{{ .Environment.CIRCLE_SHA1 }}
+ paths:
+ - ~/repo/packages/subproviders/coverage/lcov.info
lint:
working_directory: ~/repo
docker:
@@ -97,6 +129,39 @@ jobs:
keys:
- repo-{{ .Environment.CIRCLE_SHA1 }}
- run: yarn prettier:ci
+ submit-coverage:
+ docker:
+ - image: circleci/node:6.12
+ working_directory: ~/repo
+ steps:
+ - restore_cache:
+ keys:
+ - repo-{{ .Environment.CIRCLE_SHA1 }}
+ - restore_cache:
+ keys:
+ - coverage-contracts-{{ .Environment.CIRCLE_SHA1 }}
+ - restore_cache:
+ keys:
+ - coverage-assert-{{ .Environment.CIRCLE_SHA1 }}
+ - restore_cache:
+ keys:
+ - coverage-connect-{{ .Environment.CIRCLE_SHA1 }}
+ - restore_cache:
+ keys:
+ - coverage-dev-utils-{{ .Environment.CIRCLE_SHA1 }}
+ - restore_cache:
+ keys:
+ - coverage-json-schemas-{{ .Environment.CIRCLE_SHA1 }}
+ - restore_cache:
+ keys:
+ - coverage-subproviders-{{ .Environment.CIRCLE_SHA1 }}
+ - restore_cache:
+ keys:
+ - coverage-deployer-{{ .Environment.CIRCLE_SHA1 }}
+ - restore_cache:
+ keys:
+ - coverage-0xjs-{{ .Environment.CIRCLE_SHA1 }}
+ - run: yarn report_coverage
workflows:
version: 2
main:
@@ -120,6 +185,9 @@ workflows:
- lint:
requires:
- build
-notify:
- webhooks:
- - url: https://coveralls.io/webhook?repo_token=ZYESXQbPiGidXzn2qkajycWa42uZHZsMX
+ - submit-coverage:
+ requires:
+ - test-0xjs
+ - test-deployer
+ - test-rest
+ - test-contracts
diff --git a/package.json b/package.json
index b1e1bf626..77282f6b5 100644
--- a/package.json
+++ b/package.json
@@ -7,6 +7,7 @@
"testrpc": "testrpc -p 8545 --networkId 50 -m \"${npm_package_config_mnemonic}\"",
"prettier": "prettier --write '**/*.{ts,tsx,json,md}' --config .prettierrc",
"prettier:ci": "prettier --list-different '**/*.{ts,tsx,json,md}' --config .prettierrc",
+ "report_coverage": "lcov-result-merger 'packages/*/coverage/lcov.info' | coveralls",
"lerna:run": "lerna run",
"lerna:rebuild": "lerna run clean; lerna run build;",
"lerna:publish":
@@ -16,7 +17,11 @@
"mnemonic": "concert load couple harbor equip island argue ramp clarify fence smart topic"
},
"devDependencies": {
+ "@0xproject/utils": "^0.4.1",
+ "async-child-process": "^1.1.1",
+ "coveralls": "^3.0.0",
"ethereumjs-testrpc": "^6.0.3",
+ "lcov-result-merger": "^2.0.0",
"lerna": "^2.5.1",
"prettier": "^1.11.1"
}
diff --git a/packages/0x.js/CHANGELOG.md b/packages/0x.js/CHANGELOG.md
index 90d61a30f..78368d89b 100644
--- a/packages/0x.js/CHANGELOG.md
+++ b/packages/0x.js/CHANGELOG.md
@@ -1,5 +1,9 @@
# CHANGELOG
+## v0.33.2 - _TBD, 2018_
+
+ * Consolidate all `console.log` calls into `logUtils` in the `@0xproject/utils` package (#452)
+
## v0.33.1 - _March 8, 2018_
* Add missing EthersJs typescript typings as dependency
diff --git a/packages/0x.js/coverage/.gitkeep b/packages/0x.js/coverage/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/packages/0x.js/coverage/.gitkeep
diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json
index f99029b53..0cb01d352 100644
--- a/packages/0x.js/package.json
+++ b/packages/0x.js/package.json
@@ -19,10 +19,10 @@
"upload_docs_json": "aws s3 cp generated_docs/index.json $S3_URL --profile 0xproject --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type application/json",
"generate_contract_wrappers": "node ../abi-gen/lib/index.js --abis 'src/artifacts/@(Exchange|Token|TokenTransferProxy|EtherToken|TokenRegistry|DummyToken).json' --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/contract_wrappers/generated --backend ethers && prettier --write 'src/contract_wrappers/generated/**.ts'",
"lint": "tslint --project . 'src/**/*.ts' 'test/**/*.ts'",
- "test:circleci": "run-s test:coverage report_test_coverage",
+ "test:circleci": "run-s test:coverage",
"test": "run-s clean test:commonjs",
- "test:coverage": "nyc npm run test --all",
- "report_test_coverage": "nyc report --reporter=text-lcov | coveralls",
+ "test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
+ "coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info",
"update_contracts": "for i in ${npm_package_config_artifacts}; do copyfiles -u 4 ../contracts/build/contracts/$i.json ../0x.js/src/artifacts; done;",
"clean": "shx rm -rf _bundles lib test_temp scripts",
"build:umd:prod": "NODE_ENV=production webpack",
@@ -68,7 +68,6 @@
"chai-bignumber": "^2.0.1",
"chai-typescript-typings": "^0.0.4",
"copyfiles": "^1.2.0",
- "coveralls": "^3.0.0",
"dirty-chai": "^2.0.1",
"json-loader": "^0.5.4",
"mocha": "^4.0.1",
diff --git a/packages/0x.js/src/utils/utils.ts b/packages/0x.js/src/utils/utils.ts
index 74f2c5995..3e98de84f 100644
--- a/packages/0x.js/src/utils/utils.ts
+++ b/packages/0x.js/src/utils/utils.ts
@@ -17,10 +17,6 @@ export const utils = {
bigNumberToBN(value: BigNumber) {
return new BN(value.toString(), 10);
},
- consoleLog(message: string): void {
- // tslint:disable-next-line: no-console
- console.log(message);
- },
spawnSwitchErr(name: string, value: any): Error {
return new Error(`Unexpected switch value: ${value} encountered for ${name}`);
},
diff --git a/packages/abi-gen/CHANGELOG.md b/packages/abi-gen/CHANGELOG.md
index 90e82c632..e7581fb10 100644
--- a/packages/abi-gen/CHANGELOG.md
+++ b/packages/abi-gen/CHANGELOG.md
@@ -1,5 +1,9 @@
# CHANGELOG
+## v0.2.5 - _TBD, 2018_
+
+ * Consolidate all `console.log` calls into `logUtils` in the `@0xproject/utils` package (#452)
+
## v0.2.4 - _March 4, 2018_
* Add a `backend` parameter that allows you to specify the Ethereum library you use in your templates (`web3` or `ethers`). Ethers auto-converts small ints to numbers whereas Web3 doesn't. Defaults to `web3` (#413)
diff --git a/packages/abi-gen/src/index.ts b/packages/abi-gen/src/index.ts
index 7c29f7d1d..8932e4045 100644
--- a/packages/abi-gen/src/index.ts
+++ b/packages/abi-gen/src/index.ts
@@ -1,5 +1,6 @@
#!/usr/bin/env node
+import { logUtils } from '@0xproject/utils';
import chalk from 'chalk';
import * as fs from 'fs';
import { sync as globSync } from 'glob';
@@ -62,7 +63,7 @@ const args = yargs
function registerPartials(partialsGlob: string) {
const partialTemplateFileNames = globSync(partialsGlob);
- utils.log(`Found ${chalk.green(`${partialTemplateFileNames.length}`)} ${chalk.bold('partial')} templates`);
+ logUtils.log(`Found ${chalk.green(`${partialTemplateFileNames.length}`)} ${chalk.bold('partial')} templates`);
for (const partialTemplateFileName of partialTemplateFileNames) {
const namedContent = utils.getNamedContent(partialTemplateFileName);
Handlebars.registerPartial(namedContent.name, namedContent.content);
@@ -77,7 +78,7 @@ function writeOutputFile(name: string, renderedTsCode: string): void {
}
const filePath = `${args.output}/${fileName}.ts`;
fs.writeFileSync(filePath, renderedTsCode);
- utils.log(`Created: ${chalk.bold(filePath)}`);
+ logUtils.log(`Created: ${chalk.bold(filePath)}`);
}
Handlebars.registerHelper('parameterType', utils.solTypeToTsType.bind(utils, ParamKind.Input, args.backend));
@@ -91,17 +92,17 @@ const template = Handlebars.compile<ContextData>(mainTemplate.content);
const abiFileNames = globSync(args.abis);
if (_.isEmpty(abiFileNames)) {
- utils.log(`${chalk.red(`No ABI files found.`)}`);
- utils.log(`Please make sure you've passed the correct folder name and that the files have
+ logUtils.log(`${chalk.red(`No ABI files found.`)}`);
+ logUtils.log(`Please make sure you've passed the correct folder name and that the files have
${chalk.bold('*.json')} extensions`);
process.exit(1);
} else {
- utils.log(`Found ${chalk.green(`${abiFileNames.length}`)} ${chalk.bold('ABI')} files`);
+ logUtils.log(`Found ${chalk.green(`${abiFileNames.length}`)} ${chalk.bold('ABI')} files`);
mkdirp.sync(args.output);
}
for (const abiFileName of abiFileNames) {
const namedContent = utils.getNamedContent(abiFileName);
- utils.log(`Processing: ${chalk.bold(namedContent.name)}...`);
+ logUtils.log(`Processing: ${chalk.bold(namedContent.name)}...`);
const parsedContent = JSON.parse(namedContent.content);
let ABI;
if (_.isArray(parsedContent)) {
@@ -112,8 +113,8 @@ for (const abiFileName of abiFileNames) {
ABI = parsedContent.networks[args.networkId].abi; // 0x contracts package artifact
}
if (_.isUndefined(ABI)) {
- utils.log(`${chalk.red(`ABI not found in ${abiFileName}.`)}`);
- utils.log(
+ logUtils.log(`${chalk.red(`ABI not found in ${abiFileName}.`)}`);
+ logUtils.log(
`Please make sure your ABI file is either an array with ABI entries or a truffle artifact or 0x deployer artifact`,
);
process.exit(1);
diff --git a/packages/abi-gen/src/utils.ts b/packages/abi-gen/src/utils.ts
index 3e4ff619a..c4520ade0 100644
--- a/packages/abi-gen/src/utils.ts
+++ b/packages/abi-gen/src/utils.ts
@@ -73,9 +73,6 @@ export const utils = {
isObjectType(tsType: string): boolean {
return /^{.*}$/.test(tsType);
},
- log(...args: any[]): void {
- console.log(...args); // tslint:disable-line:no-console
- },
getPartialNameFromFileName(filename: string): string {
const name = path.parse(filename).name;
return name;
diff --git a/packages/assert/coverage/.gitkeep b/packages/assert/coverage/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/packages/assert/coverage/.gitkeep
diff --git a/packages/assert/package.json b/packages/assert/package.json
index be5f4902d..0c8c64e16 100644
--- a/packages/assert/package.json
+++ b/packages/assert/package.json
@@ -12,7 +12,9 @@
"run_mocha": "mocha lib/test/**/*_test.js",
"prepublishOnly": "run-p build",
"test": "run-s clean build run_mocha",
- "test:circleci": "yarn test"
+ "test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
+ "coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info",
+ "test:circleci": "yarn test:coverage"
},
"license": "Apache-2.0",
"repository": {
@@ -29,6 +31,7 @@
"@types/lodash": "^4.14.86",
"@types/mocha": "^2.2.42",
"@types/valid-url": "^1.0.2",
+ "nyc": "^11.0.1",
"chai": "^4.0.1",
"chai-typescript-typings": "^0.0.4",
"copyfiles": "^1.2.0",
diff --git a/packages/connect/coverage/.gitkeep b/packages/connect/coverage/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/packages/connect/coverage/.gitkeep
diff --git a/packages/connect/package.json b/packages/connect/package.json
index 8b3b24fcd..e0478b42a 100644
--- a/packages/connect/package.json
+++ b/packages/connect/package.json
@@ -21,7 +21,9 @@
"lint": "tslint --project . 'src/**/*.ts' 'test/**/*.ts'",
"run_mocha": "mocha lib/test/**/*_test.js",
"test": "run-s clean build copy_test_fixtures run_mocha",
- "test:circleci": "yarn test"
+ "test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
+ "coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info",
+ "test:circleci": "yarn test:coverage"
},
"config": {
"postpublish": {
@@ -62,6 +64,7 @@
"@types/mocha": "^2.2.42",
"@types/query-string": "^5.0.1",
"@types/websocket": "^0.0.34",
+ "nyc": "^11.0.1",
"async-child-process": "^1.1.1",
"chai": "^4.0.1",
"chai-as-promised": "^7.1.0",
diff --git a/packages/contracts/package.json b/packages/contracts/package.json
index b16ec3fd0..2bb3b2465 100644
--- a/packages/contracts/package.json
+++ b/packages/contracts/package.json
@@ -13,7 +13,7 @@
"copy_artifacts": "copyfiles './src/artifacts/**/*' ./lib",
"build": "tsc",
"test": "run-s build run_mocha",
- "test:coverage": "SOLIDITY_COVERAGE=true run-s build run_mocha coverage:report:text",
+ "test:coverage": "SOLIDITY_COVERAGE=true run-s build run_mocha coverage:report:text coverage:report:lcov",
"run_mocha": "mocha 'lib/test/**/*.js' --timeout 100000 --bail --exit",
"compile:comment": "Yarn workspaces do not link binaries correctly so we need to reference them directly https://github.com/yarnpkg/yarn/issues/3846",
"compile": "node ../deployer/lib/src/cli.js compile --contracts ${npm_package_config_contracts} --contracts-dir src/contracts --artifacts-dir src/artifacts",
@@ -24,8 +24,7 @@
"coverage:report:text": "istanbul report text",
"coverage:report:html": "istanbul report html && open coverage/index.html",
"coverage:report:lcov": "istanbul report lcov",
- "coverage:report:coveralls": "yarn coverage:report:lcov && cat coverage/lcov.info | coveralls",
- "test:circleci": "yarn test:coverage && yarn coverage:report:coveralls"
+ "test:circleci": "yarn test:coverage"
},
"config": {
"contracts": "Exchange,DummyToken,ZRXToken,Token,WETH9,TokenTransferProxy,MultiSigWallet,MultiSigWalletWithTimeLock,MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress,MaliciousToken,TokenRegistry,Arbitrage,EtherDelta,AccountLevels"
@@ -54,7 +53,6 @@
"chai-bignumber": "^2.0.1",
"chai-typescript-typings": "^0.0.4",
"copyfiles": "^1.2.0",
- "coveralls": "^3.0.0",
"dirty-chai": "^2.0.1",
"ethers-typescript-typings": "^0.0.2",
"mocha": "^4.0.1",
diff --git a/packages/deployer/CHANGELOG.md b/packages/deployer/CHANGELOG.md
index 4b4fd76c7..541e74ae0 100644
--- a/packages/deployer/CHANGELOG.md
+++ b/packages/deployer/CHANGELOG.md
@@ -10,6 +10,8 @@
* Add `bytecode`, `runtime_bytecode`, `source_map`, `source_map_runtime` and `sources` fields to artifacts (#426)
* Remove 0x-specific `migrate` command (#426)
* Allow deployer to accept a provider instead of port and host. This makes it possible to run it with in-process ganache-core (#426)
+ * Consolidate all `console.log` calls into `logUtils` in the `@0xproject/utils` package (#452)
+ * Add `#!/usr/bin/env node` pragma above `cli.ts` script to fix command-line error.
## v0.2.0 - _March 4, 2018_
diff --git a/packages/deployer/coverage/.gitkeep b/packages/deployer/coverage/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/packages/deployer/coverage/.gitkeep
diff --git a/packages/deployer/package.json b/packages/deployer/package.json
index d99f6a44a..64852e89d 100644
--- a/packages/deployer/package.json
+++ b/packages/deployer/package.json
@@ -8,11 +8,13 @@
"build:watch": "tsc -w",
"build": "yarn clean && copyfiles 'test/fixtures/contracts/**/*' ./lib && tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts",
"test": "npm run build; mocha lib/test/*_test.js",
+ "test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
+ "coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info",
"compile": "npm run build; node lib/src/cli.js compile",
"clean": "shx rm -rf lib scripts",
"migrate": "npm run build; node lib/src/cli.js migrate",
"lint": "tslint --project . 'src/**/*.ts' 'test/**/*.ts'",
- "test:circleci": "yarn test",
+ "test:circleci": "yarn test:coverage",
"docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES",
"upload_docs_json": "aws s3 cp generated_docs/index.json $S3_URL --profile 0xproject --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type application/json"
},
@@ -45,6 +47,7 @@
"@types/require-from-string": "^1.2.0",
"chai": "^4.0.1",
"copyfiles": "^1.2.0",
+ "nyc": "^11.0.1",
"ethers-typescript-typings": "^0.0.2",
"mocha": "^4.0.1",
"shx": "^0.2.2",
diff --git a/packages/deployer/src/compiler.ts b/packages/deployer/src/compiler.ts
index ced8063db..83977709b 100644
--- a/packages/deployer/src/compiler.ts
+++ b/packages/deployer/src/compiler.ts
@@ -1,4 +1,4 @@
-import { promisify } from '@0xproject/utils';
+import { logUtils, promisify } from '@0xproject/utils';
import * as ethUtil from 'ethereumjs-util';
import * as fs from 'fs';
import 'isomorphic-fetch';
@@ -59,9 +59,9 @@ export class Compiler {
};
const source = await fsWrapper.readFileAsync(contentPath, opts);
sources[fileName] = source;
- utils.consoleLog(`Reading ${fileName} source...`);
+ logUtils.log(`Reading ${fileName} source...`);
} catch (err) {
- utils.consoleLog(`Could not find file at ${contentPath}`);
+ logUtils.log(`Could not find file at ${contentPath}`);
}
} else {
try {
@@ -71,7 +71,7 @@ export class Compiler {
...nestedSources,
};
} catch (err) {
- utils.consoleLog(`${contentPath} is not a directory or ${constants.SOLIDITY_FILE_EXTENSION} file`);
+ logUtils.log(`${contentPath} is not a directory or ${constants.SOLIDITY_FILE_EXTENSION} file`);
}
}
}
@@ -164,7 +164,7 @@ export class Compiler {
});
await Promise.all(_.map(fileNames, async fileName => this._compileContractAsync(fileName)));
this._solcErrors.forEach(errMsg => {
- utils.consoleLog(errMsg);
+ logUtils.log(errMsg);
});
}
/**
@@ -195,7 +195,7 @@ export class Compiler {
if (isCompilerAvailableLocally) {
solcjs = fs.readFileSync(compilerBinFilename).toString();
} else {
- utils.consoleLog(`Downloading ${fullSolcVersion}...`);
+ logUtils.log(`Downloading ${fullSolcVersion}...`);
const url = `${constants.BASE_COMPILER_URL}${fullSolcVersion}`;
const response = await fetch(url);
if (response.status !== 200) {
@@ -206,7 +206,7 @@ export class Compiler {
}
const solcInstance = solc.setupMethods(requireFromString(solcjs, compilerBinFilename));
- utils.consoleLog(`Compiling ${fileName}...`);
+ logUtils.log(`Compiling ${fileName}...`);
const source = this._contractSources[fileName];
const input = {
[fileName]: source,
@@ -270,7 +270,7 @@ export class Compiler {
const artifactString = utils.stringifyWithFormatting(newArtifact);
const currentArtifactPath = `${this._artifactsDir}/${contractName}.json`;
await fsWrapper.writeFileAsync(currentArtifactPath, artifactString);
- utils.consoleLog(`${fileName} artifact saved!`);
+ logUtils.log(`${fileName} artifact saved!`);
}
/**
* Sets the source tree hash for a file and its dependencies.
@@ -323,7 +323,7 @@ export class Compiler {
*/
private async _createArtifactsDirIfDoesNotExistAsync(): Promise<void> {
if (!fsWrapper.doesPathExistSync(this._artifactsDir)) {
- utils.consoleLog('Creating artifacts directory...');
+ logUtils.log('Creating artifacts directory...');
await fsWrapper.mkdirAsync(this._artifactsDir);
}
}
@@ -344,7 +344,7 @@ export class Compiler {
contractArtifact = JSON.parse(contractArtifactString);
return contractArtifact;
} catch (err) {
- utils.consoleLog(`Artifact for ${fileName} does not exist`);
+ logUtils.log(`Artifact for ${fileName} does not exist`);
return undefined;
}
}
diff --git a/packages/deployer/src/deployer.ts b/packages/deployer/src/deployer.ts
index 27c346524..6c247d328 100644
--- a/packages/deployer/src/deployer.ts
+++ b/packages/deployer/src/deployer.ts
@@ -1,4 +1,5 @@
import { AbiType, TxData } from '@0xproject/types';
+import { logUtils } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as _ from 'lodash';
import * as Web3 from 'web3';
@@ -74,7 +75,7 @@ export class Deployer {
);
}
const web3ContractInstance = await this._deployFromAbiAsync(abi, args, txData);
- utils.consoleLog(`${contractName}.sol successfully deployed at ${web3ContractInstance.address}`);
+ logUtils.log(`${contractName}.sol successfully deployed at ${web3ContractInstance.address}`);
const contractInstance = new Contract(web3ContractInstance, this._defaults);
return contractInstance;
}
@@ -107,7 +108,7 @@ export class Deployer {
if (err) {
reject(err);
} else if (_.isUndefined(res.address) && !_.isUndefined(res.transactionHash)) {
- utils.consoleLog(`transactionHash: ${res.transactionHash}`);
+ logUtils.log(`transactionHash: ${res.transactionHash}`);
} else {
resolve(res);
}
diff --git a/packages/deployer/src/utils/utils.ts b/packages/deployer/src/utils/utils.ts
index 4390d8813..9b1e59f9d 100644
--- a/packages/deployer/src/utils/utils.ts
+++ b/packages/deployer/src/utils/utils.ts
@@ -1,9 +1,4 @@
export const utils = {
- consoleLog(message: string): void {
- /* tslint:disable */
- console.log(message);
- /* tslint:enable */
- },
stringifyWithFormatting(obj: any): string {
const jsonReplacer: null = null;
const numberOfJsonSpaces = 4;
diff --git a/packages/dev-utils/coverage/.gitkeep b/packages/dev-utils/coverage/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/packages/dev-utils/coverage/.gitkeep
diff --git a/packages/dev-utils/package.json b/packages/dev-utils/package.json
index f9fc4e619..bfe752982 100644
--- a/packages/dev-utils/package.json
+++ b/packages/dev-utils/package.json
@@ -8,8 +8,10 @@
"build:watch": "tsc -w",
"build": "tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts",
"test": "run-s clean build run_mocha",
- "test:circleci": "yarn test",
+ "test:circleci": "yarn test:coverage",
"run_mocha": "mocha lib/test/**/*_test.js --bail --exit",
+ "test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
+ "coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info",
"clean": "shx rm -rf lib scripts",
"lint": "tslint --project . 'src/**/*.ts' 'test/**/*.ts'"
},
@@ -28,6 +30,7 @@
"@0xproject/web3-wrapper": "^0.2.1",
"@types/lodash": "^4.14.86",
"@types/mocha": "^2.2.42",
+ "nyc": "^11.0.1",
"chai": "^4.0.1",
"chai-typescript-typings": "^0.0.4",
"copyfiles": "^1.2.0",
diff --git a/packages/json-schemas/coverage/.gitkeep b/packages/json-schemas/coverage/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/packages/json-schemas/coverage/.gitkeep
diff --git a/packages/json-schemas/package.json b/packages/json-schemas/package.json
index e775130cb..84ed0c209 100644
--- a/packages/json-schemas/package.json
+++ b/packages/json-schemas/package.json
@@ -8,7 +8,9 @@
"build:watch": "tsc -w",
"lint": "tslint --project . 'src/**/*.ts' 'test/**/*.ts'",
"test": "run-s clean build run_mocha",
- "test:circleci": "yarn test",
+ "test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
+ "coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info",
+ "test:circleci": "yarn test:coverage",
"run_mocha": "mocha lib/test/**/*_test.js",
"clean": "shx rm -rf _bundles lib test_temp scripts",
"build": "tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts"
@@ -34,6 +36,7 @@
"@types/lodash.foreach": "^4.5.3",
"@types/lodash.values": "^4.3.3",
"@types/mocha": "^2.2.42",
+ "nyc": "^11.0.1",
"chai": "^4.0.1",
"chai-typescript-typings": "^0.0.4",
"copyfiles": "^1.2.0",
diff --git a/packages/monorepo-scripts/src/deps_versions.ts b/packages/monorepo-scripts/src/deps_versions.ts
index 5c9a2d6ff..07292a160 100644
--- a/packages/monorepo-scripts/src/deps_versions.ts
+++ b/packages/monorepo-scripts/src/deps_versions.ts
@@ -5,6 +5,8 @@ import * as fs from 'fs';
import { sync as globSync } from 'glob';
import * as _ from 'lodash';
+import { utils } from './utils';
+
interface Dependencies {
[depName: string]: string;
}
@@ -17,10 +19,6 @@ interface VersionsByDependency {
const PACKAGE_JSON_GLOB = '../*/package.json';
-function log(...args: any[]) {
- console.log(...args); // tslint:disable-line:no-console
-}
-
function getDependencies(path: string): Dependencies {
const file = fs.readFileSync(path).toString();
const parsed = JSON.parse(file);
@@ -48,9 +46,9 @@ _.map(versionsByDependency, (versions: Versions, depName: string) => {
if (_.uniq(_.values(versions)).length === 1) {
delete versionsByDependency[depName];
} else {
- log(chalk.bold(depName));
+ utils.log(chalk.bold(depName));
_.map(versions, (version: string, packageName: string) => {
- log(`├── ${packageName} -> ${version}`);
+ utils.log(`├── ${packageName} -> ${version}`);
});
}
});
diff --git a/packages/monorepo-scripts/tsconfig.json b/packages/monorepo-scripts/tsconfig.json
index c56d255d5..3d967d05f 100644
--- a/packages/monorepo-scripts/tsconfig.json
+++ b/packages/monorepo-scripts/tsconfig.json
@@ -3,5 +3,5 @@
"compilerOptions": {
"outDir": "lib"
},
- "include": ["./src/**/*"]
+ "include": ["./src/**/*", "../../node_modules/web3-typescript-typings/index.d.ts"]
}
diff --git a/packages/react-docs/CHANGELOG.md b/packages/react-docs/CHANGELOG.md
index bd459cc77..a90cf19f0 100644
--- a/packages/react-docs/CHANGELOG.md
+++ b/packages/react-docs/CHANGELOG.md
@@ -1,5 +1,6 @@
# CHANGELOG
-## v0.0.2 - _TBD_
+## v0.0.2 - _TBD, 2018_
* Move example out into a separate sub-package
+ * Consolidate all `console.log` calls into `logUtils` in the `@0xproject/utils` package (#452)
diff --git a/packages/react-docs/package.json b/packages/react-docs/package.json
index a3e6b55d8..991af9a37 100644
--- a/packages/react-docs/package.json
+++ b/packages/react-docs/package.json
@@ -38,6 +38,7 @@
},
"dependencies": {
"@0xproject/react-shared": "^0.0.1",
+ "@0xproject/utils": "^0.4.1",
"basscss": "^8.0.3",
"compare-versions": "^3.0.1",
"lodash": "^4.17.4",
diff --git a/packages/react-docs/src/components/custom_enum.tsx b/packages/react-docs/src/components/custom_enum.tsx
index deb33ff1d..1fe55eedc 100644
--- a/packages/react-docs/src/components/custom_enum.tsx
+++ b/packages/react-docs/src/components/custom_enum.tsx
@@ -1,3 +1,4 @@
+import { logUtils } from '@0xproject/utils';
import * as _ from 'lodash';
import * as React from 'react';
@@ -16,7 +17,7 @@ export interface CustomEnumProps {
export function CustomEnum(props: CustomEnumProps) {
const type = props.type;
if (!_.startsWith(type.defaultValue, STRING_ENUM_CODE_PREFIX)) {
- utils.consoleLog('We do not yet support `Variable` types that are not strEnums');
+ logUtils.log('We do not yet support `Variable` types that are not strEnums');
return null;
}
// Remove the prefix and postfix, leaving only the strEnum values without quotes.
diff --git a/packages/react-docs/src/utils/utils.ts b/packages/react-docs/src/utils/utils.ts
index 8e1a80a44..f8c1fefff 100644
--- a/packages/react-docs/src/utils/utils.ts
+++ b/packages/react-docs/src/utils/utils.ts
@@ -1,9 +1,4 @@
export const utils = {
- consoleLog(message: string) {
- /* tslint:disable */
- console.log(message);
- /* tslint:enable */
- },
spawnSwitchErr(name: string, value: any) {
return new Error(`Unexpected switch value: ${value} encountered for ${name}`);
},
diff --git a/packages/sra-report/CHANGELOG.md b/packages/sra-report/CHANGELOG.md
index 43b92d58a..ede98a60f 100644
--- a/packages/sra-report/CHANGELOG.md
+++ b/packages/sra-report/CHANGELOG.md
@@ -1,3 +1,7 @@
# CHANGELOG
+## v0.0.2 - _TBD, 2018_
+
+ * Consolidate all `console.log` calls into `logUtils` in the `@0xproject/utils` package (#452)
+
## v0.0.1 - _March 8, 2018_
diff --git a/packages/sra-report/src/index.ts b/packages/sra-report/src/index.ts
index d23549916..e9d55ab9b 100644
--- a/packages/sra-report/src/index.ts
+++ b/packages/sra-report/src/index.ts
@@ -1,7 +1,7 @@
#!/usr/bin/env node
import { assert } from '@0xproject/assert';
import { Schema, schemas } from '@0xproject/json-schemas';
-import { promisify } from '@0xproject/utils';
+import { logUtils, promisify } from '@0xproject/utils';
import chalk from 'chalk';
import * as _ from 'lodash';
import * as newman from 'newman';
@@ -10,7 +10,6 @@ import * as yargs from 'yargs';
import * as sraReportCollectionJSON from '../postman_configs/collections/sra_report.postman_collection.json';
import { postmanEnvironmentFactory } from './postman_environment_factory';
-import { utils } from './utils';
const newmanRunAsync = promisify<void>(newman.run);
const DEFAULT_NETWORK_ID = 1;
@@ -66,12 +65,12 @@ const args = yargs
try {
assert.isWebUri('args', args.endpointUrl);
} catch (err) {
- utils.log(`${chalk.red(`Invalid url format:`)} ${args.endpointUrl}`);
+ logUtils.log(`${chalk.red(`Invalid url format:`)} ${args.endpointUrl}`);
process.exit(1);
}
if (!_.includes(SUPPORTED_NETWORK_IDS, args.networkId)) {
- utils.log(`${chalk.red(`Unsupported network id:`)} ${args.networkId}`);
- utils.log(`${chalk.bold(`Supported network ids:`)} ${SUPPORTED_NETWORK_IDS}`);
+ logUtils.log(`${chalk.red(`Unsupported network id:`)} ${args.networkId}`);
+ logUtils.log(`${chalk.bold(`Supported network ids:`)} ${SUPPORTED_NETWORK_IDS}`);
process.exit(1);
}
const mainAsync = async () => {
@@ -99,4 +98,4 @@ const mainAsync = async () => {
};
await newmanRunAsync(newmanRunOptions);
};
-mainAsync().catch(utils.log);
+mainAsync().catch(logUtils.log);
diff --git a/packages/sra-report/src/postman_environment_factory.ts b/packages/sra-report/src/postman_environment_factory.ts
index ffac7ac2e..530cacb07 100644
--- a/packages/sra-report/src/postman_environment_factory.ts
+++ b/packages/sra-report/src/postman_environment_factory.ts
@@ -1,6 +1,7 @@
import { SignedOrder, ZeroEx } from '0x.js';
import { HttpClient } from '@0xproject/connect';
import { Schema, schemas as schemasByName } from '@0xproject/json-schemas';
+import { logUtils } from '@0xproject/utils';
import chalk from 'chalk';
import * as _ from 'lodash';
@@ -8,7 +9,6 @@ import { addresses as kovanAddresses } from './contract_addresses/kovan_addresse
import { addresses as mainnetAddresses } from './contract_addresses/mainnet_addresses';
import { addresses as rinkebyAddresses } from './contract_addresses/rinkeby_addresses';
import { addresses as ropstenAddresses } from './contract_addresses/ropsten_addresses';
-import { utils } from './utils';
const ENVIRONMENT_NAME = 'SRA Report';
@@ -81,7 +81,7 @@ async function createOrderEnvironmentValuesAsync(url: string) {
createEnvironmentValue('orderHash', ZeroEx.getOrderHashHex(orderIfExists)),
];
} else {
- utils.log(`${chalk.red(`No orders from /orders found`)}`);
+ logUtils.log(`${chalk.red(`No orders from /orders found`)}`);
return [
createEnvironmentValue('order', ''),
createEnvironmentValue('orderMaker', ''),
diff --git a/packages/subproviders/coverage/.gitkeep b/packages/subproviders/coverage/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/packages/subproviders/coverage/.gitkeep
diff --git a/packages/subproviders/package.json b/packages/subproviders/package.json
index 24dd4fb8f..58b518079 100644
--- a/packages/subproviders/package.json
+++ b/packages/subproviders/package.json
@@ -12,7 +12,9 @@
"run_mocha_unit": "mocha lib/test/unit/**/*_test.js --timeout 10000 --bail --exit",
"run_mocha_integration": "mocha lib/test/integration/**/*_test.js --timeout 10000 --bail --exit",
"test": "npm run test:unit",
- "test:circleci": "npm run test:unit",
+ "test:unit:coverage": "nyc npm run test:unit --all && yarn coverage:report:lcov",
+ "coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info",
+ "test:circleci": "npm run test:unit:coverage",
"test:all": "run-s test:unit test:integration",
"test:unit": "run-s clean build run_mocha_unit",
"test:integration": "run-s clean build run_mocha_integration"
@@ -42,6 +44,7 @@
"@types/lodash": "^4.14.86",
"@types/mocha": "^2.2.42",
"@types/node": "^8.0.53",
+ "nyc": "^11.0.1",
"chai": "^4.0.1",
"chai-as-promised": "^7.1.0",
"chai-as-promised-typescript-typings": "^0.0.10",
diff --git a/packages/testnet-faucets/src/ts/dispatch_queue.ts b/packages/testnet-faucets/src/ts/dispatch_queue.ts
index 672511619..2dbeeba7a 100644
--- a/packages/testnet-faucets/src/ts/dispatch_queue.ts
+++ b/packages/testnet-faucets/src/ts/dispatch_queue.ts
@@ -1,8 +1,7 @@
-import { intervalUtils } from '@0xproject/utils';
+import { intervalUtils, logUtils } from '@0xproject/utils';
import * as _ from 'lodash';
import { errorReporter } from './error_reporter';
-import { utils } from './utils';
const MAX_QUEUE_SIZE = 500;
const DEFAULT_QUEUE_INTERVAL_MS = 1000;
@@ -45,7 +44,7 @@ export class DispatchQueue {
},
this._queueIntervalMs,
(err: Error) => {
- utils.consoleLog(`Unexpected err: ${err} - ${JSON.stringify(err)}`);
+ logUtils.log(`Unexpected err: ${err} - ${JSON.stringify(err)}`);
// tslint:disable-next-line:no-floating-promises
errorReporter.reportAsync(err);
},
diff --git a/packages/testnet-faucets/src/ts/dispense_asset_tasks.ts b/packages/testnet-faucets/src/ts/dispense_asset_tasks.ts
index 56b0a9e45..99f1bad36 100644
--- a/packages/testnet-faucets/src/ts/dispense_asset_tasks.ts
+++ b/packages/testnet-faucets/src/ts/dispense_asset_tasks.ts
@@ -1,11 +1,10 @@
import { ZeroEx } from '0x.js';
-import { BigNumber, promisify } from '@0xproject/utils';
+import { BigNumber, logUtils, promisify } from '@0xproject/utils';
import * as _ from 'lodash';
import * as Web3 from 'web3';
import { configs } from './configs';
import { errorReporter } from './error_reporter';
-import { utils } from './utils';
const DISPENSE_AMOUNT_ETHER = 0.1;
const DISPENSE_AMOUNT_TOKEN = 0.1;
@@ -15,11 +14,11 @@ const DISPENSE_MAX_AMOUNT_ETHER = 2;
export const dispenseAssetTasks = {
dispenseEtherTask(recipientAddress: string, web3: Web3) {
return async () => {
- utils.consoleLog(`Processing ETH ${recipientAddress}`);
+ logUtils.log(`Processing ETH ${recipientAddress}`);
const userBalance = await promisify<BigNumber>(web3.eth.getBalance)(recipientAddress);
const maxAmountInWei = new BigNumber(web3.toWei(DISPENSE_MAX_AMOUNT_ETHER, 'ether'));
if (userBalance.greaterThanOrEqualTo(maxAmountInWei)) {
- utils.consoleLog(
+ logUtils.log(
`User exceeded ETH balance maximum (${maxAmountInWei}) ${recipientAddress} ${userBalance} `,
);
return;
@@ -30,12 +29,12 @@ export const dispenseAssetTasks = {
to: recipientAddress,
value: web3.toWei(DISPENSE_AMOUNT_ETHER, 'ether'),
});
- utils.consoleLog(`Sent ${DISPENSE_AMOUNT_ETHER} ETH to ${recipientAddress} tx: ${txHash}`);
+ logUtils.log(`Sent ${DISPENSE_AMOUNT_ETHER} ETH to ${recipientAddress} tx: ${txHash}`);
};
},
dispenseTokenTask(recipientAddress: string, tokenSymbol: string, zeroEx: ZeroEx) {
return async () => {
- utils.consoleLog(`Processing ${tokenSymbol} ${recipientAddress}`);
+ logUtils.log(`Processing ${tokenSymbol} ${recipientAddress}`);
const amountToDispense = new BigNumber(DISPENSE_AMOUNT_TOKEN);
const token = await zeroEx.tokenRegistry.getTokenBySymbolIfExistsAsync(tokenSymbol);
if (_.isUndefined(token)) {
@@ -48,7 +47,7 @@ export const dispenseAssetTasks = {
token.decimals,
);
if (userBalanceBaseUnits.greaterThanOrEqualTo(maxAmountBaseUnits)) {
- utils.consoleLog(
+ logUtils.log(
`User exceeded token balance maximum (${maxAmountBaseUnits}) ${recipientAddress} ${userBalanceBaseUnits} `,
);
return;
@@ -59,7 +58,7 @@ export const dispenseAssetTasks = {
recipientAddress,
baseUnitAmount,
);
- utils.consoleLog(`Sent ${amountToDispense} ZRX to ${recipientAddress} tx: ${txHash}`);
+ logUtils.log(`Sent ${amountToDispense} ZRX to ${recipientAddress} tx: ${txHash}`);
};
},
};
diff --git a/packages/testnet-faucets/src/ts/error_reporter.ts b/packages/testnet-faucets/src/ts/error_reporter.ts
index 7fd76bde5..f0f3ca679 100644
--- a/packages/testnet-faucets/src/ts/error_reporter.ts
+++ b/packages/testnet-faucets/src/ts/error_reporter.ts
@@ -1,8 +1,8 @@
+import { logUtils } from '@0xproject/utils';
import * as express from 'express';
import rollbar = require('rollbar');
import { configs } from './configs';
-import { utils } from './utils';
export const errorReporter = {
setup() {
@@ -11,7 +11,7 @@ export const errorReporter = {
});
rollbar.handleUncaughtExceptions(configs.ROLLBAR_ACCESS_KEY);
process.on('unhandledRejection', async (err: Error) => {
- utils.consoleLog(`Uncaught exception ${err}. Stack: ${err.stack}`);
+ logUtils.log(`Uncaught exception ${err}. Stack: ${err.stack}`);
await this.reportAsync(err);
process.exit(1);
});
@@ -23,7 +23,7 @@ export const errorReporter = {
return new Promise((resolve, reject) => {
rollbar.handleError(err, req, (rollbarErr: Error) => {
if (rollbarErr) {
- utils.consoleLog(`Error reporting to rollbar, ignoring: ${rollbarErr}`);
+ logUtils.log(`Error reporting to rollbar, ignoring: ${rollbarErr}`);
reject(rollbarErr);
} else {
resolve();
diff --git a/packages/testnet-faucets/src/ts/handler.ts b/packages/testnet-faucets/src/ts/handler.ts
index 5f6ada186..f9ac484de 100644
--- a/packages/testnet-faucets/src/ts/handler.ts
+++ b/packages/testnet-faucets/src/ts/handler.ts
@@ -1,5 +1,5 @@
import { Order, SignedOrder, ZeroEx } from '0x.js';
-import { BigNumber } from '@0xproject/utils';
+import { BigNumber, logUtils } from '@0xproject/utils';
import * as express from 'express';
import * as _ from 'lodash';
import * as Web3 from 'web3';
@@ -19,7 +19,6 @@ import { DispatchQueue } from './dispatch_queue';
import { dispenseAssetTasks } from './dispense_asset_tasks';
import { idManagement } from './id_management';
import { rpcUrls } from './rpc_urls';
-import { utils } from './utils';
interface NetworkConfig {
dispatchQueue: DispatchQueue;
@@ -118,7 +117,7 @@ export class Handler {
res.status(503).send('QUEUE_IS_FULL');
return;
}
- utils.consoleLog(`Added ${recipient} to queue: ${requestedAssetType} networkId: ${networkId}`);
+ logUtils.log(`Added ${recipient} to queue: ${requestedAssetType} networkId: ${networkId}`);
res.status(200).end();
}
private async _dispenseOrder(req: express.Request, res: express.Response, requestedAssetType: RequestedAssetType) {
@@ -163,7 +162,7 @@ export class Handler {
};
const signedOrderHash = ZeroEx.getOrderHashHex(signedOrder);
const payload = JSON.stringify(signedOrder);
- utils.consoleLog(`Dispensed signed order: ${payload}`);
+ logUtils.log(`Dispensed signed order: ${payload}`);
res.status(200).send(payload);
}
}
diff --git a/packages/testnet-faucets/src/ts/parameter_transformer.ts b/packages/testnet-faucets/src/ts/parameter_transformer.ts
index c5711d462..2630a5e0b 100644
--- a/packages/testnet-faucets/src/ts/parameter_transformer.ts
+++ b/packages/testnet-faucets/src/ts/parameter_transformer.ts
@@ -4,7 +4,6 @@ import * as _ from 'lodash';
import { configs } from './configs';
import { rpcUrls } from './rpc_urls';
-import { utils } from './utils';
const DEFAULT_NETWORK_ID = 42; // kovan
diff --git a/packages/testnet-faucets/src/ts/utils.ts b/packages/testnet-faucets/src/ts/utils.ts
deleted file mode 100644
index 893f82ca3..000000000
--- a/packages/testnet-faucets/src/ts/utils.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-export const utils = {
- consoleLog(message: string) {
- /* tslint:disable */
- console.log(message);
- /* tslint:enable */
- },
-};
diff --git a/packages/testnet-faucets/tsconfig.json b/packages/testnet-faucets/tsconfig.json
index 5deaaebe6..237f62169 100644
--- a/packages/testnet-faucets/tsconfig.json
+++ b/packages/testnet-faucets/tsconfig.json
@@ -6,6 +6,7 @@
},
"include": [
"./src/ts/**/*",
+ "../../node_modules/ethers-typescript-typings/index.d.ts",
"../../node_modules/types-bn/index.d.ts",
"../../node_modules/types-ethereumjs-util/index.d.ts",
"../../node_modules/web3-typescript-typings/index.d.ts"
diff --git a/packages/utils/CHANGELOG.md b/packages/utils/CHANGELOG.md
index bf9cf53b4..5488d4f8c 100644
--- a/packages/utils/CHANGELOG.md
+++ b/packages/utils/CHANGELOG.md
@@ -1,5 +1,9 @@
# CHANGELOG
+## v0.4.1 - _TBD, 2018_
+
+ * Consolidate all `console.log` calls into `logUtils` in the `@0xproject/utils` package (#452)
+
## v0.4.0 - _March 4, 2018_
* Use `ethers-contracts` as a backend to decode event args (#413)
diff --git a/packages/utils/src/index.ts b/packages/utils/src/index.ts
index 39dede41f..debcce746 100644
--- a/packages/utils/src/index.ts
+++ b/packages/utils/src/index.ts
@@ -4,3 +4,4 @@ export { classUtils } from './class_utils';
export { intervalUtils } from './interval_utils';
export { BigNumber } from './configured_bignumber';
export { AbiDecoder } from './abi_decoder';
+export { logUtils } from './log_utils';
diff --git a/packages/sra-report/src/utils.ts b/packages/utils/src/log_utils.ts
index 5423cabd9..d0f0e34c9 100644
--- a/packages/sra-report/src/utils.ts
+++ b/packages/utils/src/log_utils.ts
@@ -1,4 +1,4 @@
-export const utils = {
+export const logUtils = {
log(...args: any[]): void {
console.log(...args); // tslint:disable-line:no-console
},
diff --git a/packages/website/ts/blockchain.ts b/packages/website/ts/blockchain.ts
index c92023541..a3427baee 100644
--- a/packages/website/ts/blockchain.ts
+++ b/packages/website/ts/blockchain.ts
@@ -23,7 +23,7 @@ import {
LedgerWalletSubprovider,
RedundantRPCSubprovider,
} from '@0xproject/subproviders';
-import { BigNumber, intervalUtils, promisify } from '@0xproject/utils';
+import { BigNumber, intervalUtils, logUtils, promisify } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as _ from 'lodash';
import * as React from 'react';
@@ -405,7 +405,7 @@ export class Blockchain {
},
5000,
(err: Error) => {
- utils.consoleLog(`Polling tokenBalance failed: ${err}`);
+ logUtils.log(`Polling tokenBalance failed: ${err}`);
intervalUtils.clearAsyncExcludingInterval(tokenPollInterval);
reject(err);
},
@@ -822,7 +822,7 @@ export class Blockchain {
if (!_.isUndefined(contractAddress)) {
const doesContractExist = await this.doesContractExistAtAddressAsync(contractAddress);
if (!doesContractExist) {
- utils.consoleLog(`Contract does not exist: ${artifact.contract_name} at ${contractAddress}`);
+ logUtils.log(`Contract does not exist: ${artifact.contract_name} at ${contractAddress}`);
throw new Error(BlockchainCallErrs.ContractDoesNotExist);
}
}
@@ -832,7 +832,7 @@ export class Blockchain {
return contractInstance;
} catch (err) {
const errMsg = `${err}`;
- utils.consoleLog(`Notice: Error encountered: ${err} ${err.stack}`);
+ logUtils.log(`Notice: Error encountered: ${err} ${err.stack}`);
if (_.includes(errMsg, 'not been deployed to detected network')) {
throw new Error(BlockchainCallErrs.ContractDoesNotExist);
} else {
diff --git a/packages/website/ts/blockchain_watcher.ts b/packages/website/ts/blockchain_watcher.ts
index d3801cef4..2712b2c04 100644
--- a/packages/website/ts/blockchain_watcher.ts
+++ b/packages/website/ts/blockchain_watcher.ts
@@ -1,4 +1,4 @@
-import { BigNumber, intervalUtils, promisify } from '@0xproject/utils';
+import { BigNumber, intervalUtils, logUtils, promisify } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as _ from 'lodash';
import { Dispatcher } from 'ts/redux/dispatcher';
@@ -87,7 +87,7 @@ export class BlockchainWatcher {
},
5000,
(err: Error) => {
- utils.consoleLog(`Watching network and balances failed: ${err.stack}`);
+ logUtils.log(`Watching network and balances failed: ${err.stack}`);
this._stopEmittingNetworkConnectionAndUserBalanceStateAsync();
},
);
diff --git a/packages/website/ts/components/dialogs/ledger_config_dialog.tsx b/packages/website/ts/components/dialogs/ledger_config_dialog.tsx
index 87b75ed95..d7190c0bb 100644
--- a/packages/website/ts/components/dialogs/ledger_config_dialog.tsx
+++ b/packages/website/ts/components/dialogs/ledger_config_dialog.tsx
@@ -1,6 +1,6 @@
import { ZeroEx } from '0x.js';
import { colors, constants as sharedConstants } from '@0xproject/react-shared';
-import { BigNumber } from '@0xproject/utils';
+import { BigNumber, logUtils } from '@0xproject/utils';
import * as _ from 'lodash';
import Dialog from 'material-ui/Dialog';
import FlatButton from 'material-ui/FlatButton';
@@ -239,7 +239,7 @@ export class LedgerConfigDialog extends React.Component<LedgerConfigDialogProps,
addressBalances.push(balanceInWei);
}
} catch (err) {
- utils.consoleLog(`Ledger error: ${JSON.stringify(err)}`);
+ logUtils.log(`Ledger error: ${JSON.stringify(err)}`);
this.setState({
connectionErrMsg: 'Failed to connect. Follow the instructions and try again.',
});
@@ -265,7 +265,7 @@ export class LedgerConfigDialog extends React.Component<LedgerConfigDialogProps,
private async _onConnectLedgerClickAsync() {
const isU2FSupported = await utils.isU2FSupportedAsync();
if (!isU2FSupported) {
- utils.consoleLog(`U2F not supported in this browser`);
+ logUtils.log(`U2F not supported in this browser`);
this.setState({
connectionErrMsg: 'U2F not supported by this browser. Try using Chrome.',
});
diff --git a/packages/website/ts/components/eth_weth_conversion_button.tsx b/packages/website/ts/components/eth_weth_conversion_button.tsx
index 8e13d0aae..586d260fb 100644
--- a/packages/website/ts/components/eth_weth_conversion_button.tsx
+++ b/packages/website/ts/components/eth_weth_conversion_button.tsx
@@ -1,5 +1,5 @@
import { ZeroEx } from '0x.js';
-import { BigNumber } from '@0xproject/utils';
+import { BigNumber, logUtils } from '@0xproject/utils';
import * as _ from 'lodash';
import RaisedButton from 'material-ui/RaisedButton';
import * as React from 'react';
@@ -111,8 +111,8 @@ export class EthWethConversionButton extends React.Component<
if (_.includes(errMsg, BlockchainCallErrs.UserHasNoAssociatedAddresses)) {
this.props.dispatcher.updateShouldBlockchainErrDialogBeOpen(true);
} else if (!utils.didUserDenyWeb3Request(errMsg)) {
- utils.consoleLog(`Unexpected error encountered: ${err}`);
- utils.consoleLog(err.stack);
+ logUtils.log(`Unexpected error encountered: ${err}`);
+ logUtils.log(err.stack);
const errorMsg =
direction === Side.Deposit
? 'Failed to wrap your ETH. Please try again.'
diff --git a/packages/website/ts/components/fill_order.tsx b/packages/website/ts/components/fill_order.tsx
index f1eee3e89..a6144bd6b 100644
--- a/packages/website/ts/components/fill_order.tsx
+++ b/packages/website/ts/components/fill_order.tsx
@@ -1,6 +1,6 @@
import { Order as ZeroExOrder, ZeroEx } from '0x.js';
import { colors, constants as sharedConstants } from '@0xproject/react-shared';
-import { BigNumber } from '@0xproject/utils';
+import { BigNumber, logUtils } from '@0xproject/utils';
import * as accounting from 'accounting';
import * as _ from 'lodash';
import { Card, CardHeader, CardText } from 'material-ui/Card';
@@ -403,7 +403,7 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> {
const validationResult = validator.validate(order, portalOrderSchema);
if (validationResult.errors.length > 0) {
orderJSONErrMsg = 'Submitted order JSON is not a valid order';
- utils.consoleLog(`Unexpected order JSON validation error: ${validationResult.errors.join(', ')}`);
+ logUtils.log(`Unexpected order JSON validation error: ${validationResult.errors.join(', ')}`);
return;
}
parsedOrder = order;
@@ -448,7 +448,7 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> {
this.props.dispatcher.updateUserSuppliedOrderCache(parsedOrder);
}
} catch (err) {
- utils.consoleLog(`Validate order err: ${err}`);
+ logUtils.log(`Validate order err: ${err}`);
if (!_.isEmpty(orderJSON)) {
orderJSONErrMsg = 'Submitted order JSON is not valid JSON';
}
@@ -564,7 +564,7 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> {
return;
}
globalErrMsg = 'Failed to fill order, please refresh and try again';
- utils.consoleLog(`${err}`);
+ logUtils.log(`${err}`);
this.setState({
globalErrMsg,
});
@@ -635,7 +635,7 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> {
}
analytics.logEvent('Portal', 'Cancel Order Failure', eventLabel, parsedOrder.signedOrder.makerTokenAmount);
globalErrMsg = 'Failed to cancel order, please refresh and try again';
- utils.consoleLog(`${err}`);
+ logUtils.log(`${err}`);
this.setState({
globalErrMsg,
});
diff --git a/packages/website/ts/components/generate_order/generate_order_form.tsx b/packages/website/ts/components/generate_order/generate_order_form.tsx
index 559acd1d6..eb76cb529 100644
--- a/packages/website/ts/components/generate_order/generate_order_form.tsx
+++ b/packages/website/ts/components/generate_order/generate_order_form.tsx
@@ -1,6 +1,6 @@
import { ECSignature, Order, ZeroEx } from '0x.js';
import { colors, constants as sharedConstants } from '@0xproject/react-shared';
-import { BigNumber } from '@0xproject/utils';
+import { BigNumber, logUtils } from '@0xproject/utils';
import * as _ from 'lodash';
import Dialog from 'material-ui/Dialog';
import Divider from 'material-ui/Divider';
@@ -326,7 +326,7 @@ export class GenerateOrderForm extends React.Component<GenerateOrderFormProps, G
const validationResult = validator.validate(order, portalOrderSchema);
if (validationResult.errors.length > 0) {
globalErrMsg = 'Order signing failed. Please refresh and try again';
- utils.consoleLog(`Unexpected error occured: Order validation failed:
+ logUtils.log(`Unexpected error occured: Order validation failed:
${validationResult.errors}`);
}
} catch (err) {
@@ -335,8 +335,8 @@ export class GenerateOrderForm extends React.Component<GenerateOrderFormProps, G
globalErrMsg = 'User denied sign request';
} else {
globalErrMsg = 'An unexpected error occured. Please try refreshing the page';
- utils.consoleLog(`Unexpected error occured: ${err}`);
- utils.consoleLog(err.stack);
+ logUtils.log(`Unexpected error occured: ${err}`);
+ logUtils.log(err.stack);
await errorReporter.reportAsync(err);
}
}
diff --git a/packages/website/ts/components/inputs/allowance_toggle.tsx b/packages/website/ts/components/inputs/allowance_toggle.tsx
index e548bfc82..da6f900e6 100644
--- a/packages/website/ts/components/inputs/allowance_toggle.tsx
+++ b/packages/website/ts/components/inputs/allowance_toggle.tsx
@@ -1,5 +1,5 @@
import { constants as sharedConstants } from '@0xproject/react-shared';
-import { BigNumber } from '@0xproject/utils';
+import { BigNumber, logUtils } from '@0xproject/utils';
import * as _ from 'lodash';
import Toggle from 'material-ui/Toggle';
import * as React from 'react';
@@ -93,8 +93,8 @@ export class AllowanceToggle extends React.Component<AllowanceToggleProps, Allow
if (utils.didUserDenyWeb3Request(errMsg)) {
return;
}
- utils.consoleLog(`Unexpected error encountered: ${err}`);
- utils.consoleLog(err.stack);
+ logUtils.log(`Unexpected error encountered: ${err}`);
+ logUtils.log(err.stack);
this.props.onErrorOccurred(BalanceErrs.allowanceSettingFailed);
await errorReporter.reportAsync(err);
}
diff --git a/packages/website/ts/components/order_json.tsx b/packages/website/ts/components/order_json.tsx
index a5dd9ebc1..02b88b888 100644
--- a/packages/website/ts/components/order_json.tsx
+++ b/packages/website/ts/components/order_json.tsx
@@ -1,5 +1,5 @@
import { ECSignature } from '0x.js';
-import { BigNumber } from '@0xproject/utils';
+import { BigNumber, logUtils } from '@0xproject/utils';
import * as _ from 'lodash';
import Paper from 'material-ui/Paper';
import TextField from 'material-ui/TextField';
@@ -153,7 +153,7 @@ You can see and fill it here: ${this.state.shareLink}`);
const bodyObj = JSON.parse(responseBody);
if (response.status !== 200 || bodyObj.status_code !== 200) {
// TODO: Show error message in UI
- utils.consoleLog(`Unexpected status code: ${response.status} -> ${responseBody}`);
+ logUtils.log(`Unexpected status code: ${response.status} -> ${responseBody}`);
await errorReporter.reportAsync(new Error(`Bitly returned non-200: ${JSON.stringify(response)}`));
return '';
}
diff --git a/packages/website/ts/components/portal.tsx b/packages/website/ts/components/portal.tsx
index 7df340f45..5bdb5bde9 100644
--- a/packages/website/ts/components/portal.tsx
+++ b/packages/website/ts/components/portal.tsx
@@ -1,5 +1,5 @@
import { colors } from '@0xproject/react-shared';
-import { BigNumber } from '@0xproject/utils';
+import { BigNumber, logUtils } from '@0xproject/utils';
import * as _ from 'lodash';
import CircularProgress from 'material-ui/CircularProgress';
import Paper from 'material-ui/Paper';
@@ -374,7 +374,7 @@ export class Portal extends React.Component<PortalAllProps, PortalAllState> {
const order = JSON.parse(decodeURIComponent(orderPair[1]));
const validationResult = validator.validate(order, portalOrderSchema);
if (validationResult.errors.length > 0) {
- utils.consoleLog(`Invalid shared order: ${validationResult.errors}`);
+ logUtils.log(`Invalid shared order: ${validationResult.errors}`);
return undefined;
}
return order;
diff --git a/packages/website/ts/components/send_button.tsx b/packages/website/ts/components/send_button.tsx
index ffa165f60..79c103e05 100644
--- a/packages/website/ts/components/send_button.tsx
+++ b/packages/website/ts/components/send_button.tsx
@@ -1,4 +1,4 @@
-import { BigNumber } from '@0xproject/utils';
+import { BigNumber, logUtils } from '@0xproject/utils';
import * as _ from 'lodash';
import RaisedButton from 'material-ui/RaisedButton';
import * as React from 'react';
@@ -77,8 +77,8 @@ export class SendButton extends React.Component<SendButtonProps, SendButtonState
this.props.dispatcher.updateShouldBlockchainErrDialogBeOpen(true);
return;
} else if (!utils.didUserDenyWeb3Request(errMsg)) {
- utils.consoleLog(`Unexpected error encountered: ${err}`);
- utils.consoleLog(err.stack);
+ logUtils.log(`Unexpected error encountered: ${err}`);
+ logUtils.log(err.stack);
this.props.onError();
await errorReporter.reportAsync(err);
}
diff --git a/packages/website/ts/components/token_balances.tsx b/packages/website/ts/components/token_balances.tsx
index 894e0721f..186393c4f 100644
--- a/packages/website/ts/components/token_balances.tsx
+++ b/packages/website/ts/components/token_balances.tsx
@@ -7,7 +7,7 @@ import {
Styles,
utils as sharedUtils,
} from '@0xproject/react-shared';
-import { BigNumber } from '@0xproject/utils';
+import { BigNumber, logUtils } from '@0xproject/utils';
import DharmaLoanFrame from 'dharma-loan-frame';
import * as _ from 'lodash';
import Dialog from 'material-ui/Dialog';
@@ -591,8 +591,8 @@ export class TokenBalances extends React.Component<TokenBalancesProps, TokenBala
if (utils.didUserDenyWeb3Request(errMsg)) {
return false;
}
- utils.consoleLog(`Unexpected error encountered: ${err}`);
- utils.consoleLog(err.stack);
+ logUtils.log(`Unexpected error encountered: ${err}`);
+ logUtils.log(err.stack);
this.setState({
errorType: BalanceErrs.mintingFailed,
});
@@ -623,7 +623,7 @@ export class TokenBalances extends React.Component<TokenBalancesProps, TokenBala
);
const responseBody = await response.text();
if (response.status !== constants.SUCCESS_STATUS) {
- utils.consoleLog(`Unexpected status code: ${response.status} -> ${responseBody}`);
+ logUtils.log(`Unexpected status code: ${response.status} -> ${responseBody}`);
const errorType =
response.status === constants.UNAVAILABLE_STATUS
? BalanceErrs.faucetQueueIsFull
diff --git a/packages/website/ts/pages/wiki/wiki.tsx b/packages/website/ts/pages/wiki/wiki.tsx
index f6cff51e4..e2dd3a68e 100644
--- a/packages/website/ts/pages/wiki/wiki.tsx
+++ b/packages/website/ts/pages/wiki/wiki.tsx
@@ -8,6 +8,7 @@ import {
Styles,
utils as sharedUtils,
} from '@0xproject/react-shared';
+import { logUtils } from '@0xproject/utils';
import * as _ from 'lodash';
import CircularProgress from 'material-ui/CircularProgress';
import RaisedButton from 'material-ui/RaisedButton';
@@ -213,7 +214,7 @@ export class Wiki extends React.Component<WikiProps, WikiState> {
if (response.status !== 200) {
// TODO: Show the user an error message when the wiki fail to load
const errMsg = await response.text();
- utils.consoleLog(`Failed to load wiki: ${response.status} ${errMsg}`);
+ logUtils.log(`Failed to load wiki: ${response.status} ${errMsg}`);
return;
}
const articlesBySection = await response.json();
diff --git a/packages/website/ts/utils/doc_utils.ts b/packages/website/ts/utils/doc_utils.ts
index 0686e3e7f..6b3f5f378 100644
--- a/packages/website/ts/utils/doc_utils.ts
+++ b/packages/website/ts/utils/doc_utils.ts
@@ -1,4 +1,5 @@
import { DoxityDocObj, TypeDocNode } from '@0xproject/react-docs';
+import { logUtils } from '@0xproject/utils';
import findVersions = require('find-versions');
import * as _ from 'lodash';
import { S3FileObject, VersionToFileName } from 'ts/types';
@@ -20,7 +21,7 @@ export const docUtils = {
if (response.status !== 200) {
// TODO: Show the user an error message when the docs fail to load
const errMsg = await response.text();
- utils.consoleLog(`Failed to load JSON file list: ${response.status} ${errMsg}`);
+ logUtils.log(`Failed to load JSON file list: ${response.status} ${errMsg}`);
throw new Error(errMsg);
}
const responseXML = await response.text();
@@ -43,7 +44,7 @@ export const docUtils = {
if (response.status !== 200) {
// TODO: Show the user an error message when the docs fail to load
const errMsg = await response.text();
- utils.consoleLog(`Failed to load Doc JSON: ${response.status} ${errMsg}`);
+ logUtils.log(`Failed to load Doc JSON: ${response.status} ${errMsg}`);
throw new Error(errMsg);
}
const jsonDocObj = await response.json();
diff --git a/packages/website/ts/utils/error_reporter.ts b/packages/website/ts/utils/error_reporter.ts
index 0bd247c5b..19f563880 100644
--- a/packages/website/ts/utils/error_reporter.ts
+++ b/packages/website/ts/utils/error_reporter.ts
@@ -1,3 +1,4 @@
+import { logUtils } from '@0xproject/utils';
import { Environments } from 'ts/types';
import { configs } from 'ts/utils/configs';
import { constants } from 'ts/utils/constants';
@@ -40,7 +41,7 @@ export const errorReporter = {
return new Promise((resolve, reject) => {
rollbar.error(err, (rollbarErr: Error) => {
if (rollbarErr) {
- utils.consoleLog(`Error reporting to rollbar, ignoring: ${rollbarErr}`);
+ logUtils.log(`Error reporting to rollbar, ignoring: ${rollbarErr}`);
// We never want to reject and cause the app to throw because of rollbar
resolve();
} else {
diff --git a/packages/website/ts/utils/utils.ts b/packages/website/ts/utils/utils.ts
index abb2598c3..25d7e449b 100644
--- a/packages/website/ts/utils/utils.ts
+++ b/packages/website/ts/utils/utils.ts
@@ -95,11 +95,6 @@ export const utils = {
};
return order;
},
- consoleLog(message: string) {
- /* tslint:disable */
- console.log(message);
- /* tslint:enable */
- },
async sleepAsync(ms: number) {
return new Promise(resolve => setTimeout(resolve, ms));
},
diff --git a/yarn.lock b/yarn.lock
index 596842906..005141e88 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2185,10 +2185,18 @@ cliui@^4.0.0:
strip-ansi "^4.0.0"
wrap-ansi "^2.0.0"
+clone-buffer@^1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/clone-buffer/-/clone-buffer-1.0.0.tgz#e3e25b207ac4e701af721e2cb5a16792cac3dc58"
+
clone-stats@^0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/clone-stats/-/clone-stats-0.0.1.tgz#b88f94a82cf38b8791d58046ea4029ad88ca99d1"
+clone-stats@^1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/clone-stats/-/clone-stats-1.0.0.tgz#b3782dff8bb5474e18b9b6bf0fdfe782f8777680"
+
clone@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/clone/-/clone-0.2.0.tgz#c6126a90ad4f72dbf5acdb243cc37724fe93fc1f"
@@ -2201,6 +2209,14 @@ clone@^2.0.0, clone@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/clone/-/clone-2.1.1.tgz#d217d1e961118e3ac9a4b8bba3285553bf647cdb"
+cloneable-readable@^1.0.0:
+ version "1.1.1"
+ resolved "https://registry.yarnpkg.com/cloneable-readable/-/cloneable-readable-1.1.1.tgz#c27a4f3a943ca37bed9b01c7d572ee61b1302b15"
+ dependencies:
+ inherits "^2.0.1"
+ process-nextick-args "^2.0.0"
+ readable-stream "^2.3.5"
+
cmd-shim@^2.0.2:
version "2.0.2"
resolved "https://registry.yarnpkg.com/cmd-shim/-/cmd-shim-2.0.2.tgz#6fcbda99483a8fd15d7d30a196ca69d688a2efdb"
@@ -2604,7 +2620,7 @@ conventional-recommended-bump@^1.2.1:
meow "^3.3.0"
object-assign "^4.0.1"
-convert-source-map@^1.1.0, convert-source-map@^1.3.0, convert-source-map@^1.5.0:
+convert-source-map@^1.1.0, convert-source-map@^1.1.1, convert-source-map@^1.3.0, convert-source-map@^1.5.0:
version "1.5.1"
resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.5.1.tgz#b8278097b9bc229365de5c62cf5fcaed8b5599e5"
@@ -3347,7 +3363,7 @@ duplexer@^0.1.1, duplexer@~0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/duplexer/-/duplexer-0.1.1.tgz#ace6ff808c1ce66b57d1ebf97977acb02334cfc1"
-duplexify@^3.4.2, duplexify@^3.5.3:
+duplexify@^3.2.0, duplexify@^3.4.2, duplexify@^3.5.3:
version "3.5.4"
resolved "https://registry.yarnpkg.com/duplexify/-/duplexify-3.5.4.tgz#4bb46c1796eabebeec4ca9a2e66b808cb7a3d8b4"
dependencies:
@@ -4580,7 +4596,7 @@ glob-parent@^2.0.0:
dependencies:
is-glob "^2.0.0"
-glob-parent@^3.1.0:
+glob-parent@^3.0.0, glob-parent@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-3.1.0.tgz#9e6af6299d8d3bd2bd40430832bd113df906c5ae"
dependencies:
@@ -4598,6 +4614,19 @@ glob-stream@^3.1.5:
through2 "^0.6.1"
unique-stream "^1.0.0"
+glob-stream@^5.3.2:
+ version "5.3.5"
+ resolved "https://registry.yarnpkg.com/glob-stream/-/glob-stream-5.3.5.tgz#a55665a9a8ccdc41915a87c701e32d4e016fad22"
+ dependencies:
+ extend "^3.0.0"
+ glob "^5.0.3"
+ glob-parent "^3.0.0"
+ micromatch "^2.3.7"
+ ordered-read-streams "^0.3.0"
+ through2 "^0.6.0"
+ to-absolute-glob "^0.1.1"
+ unique-stream "^2.0.2"
+
glob-to-regexp@^0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.3.0.tgz#8c5a1494d2066c570cc3bfe4496175acc4d502ab"
@@ -4652,7 +4681,7 @@ glob@^4.3.1:
minimatch "^2.0.1"
once "^1.3.0"
-glob@^5.0.15:
+glob@^5.0.15, glob@^5.0.3:
version "5.0.15"
resolved "https://registry.yarnpkg.com/glob/-/glob-5.0.15.tgz#1bc936b9e02f4a603fcc222ecf7633d30b8b93b1"
dependencies:
@@ -4781,7 +4810,7 @@ graceful-fs@^3.0.0:
dependencies:
natives "^1.1.0"
-graceful-fs@^4.1.10, graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9:
+graceful-fs@^4.0.0, graceful-fs@^4.1.10, graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9:
version "4.1.11"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658"
@@ -4801,6 +4830,16 @@ growl@1.9.2:
version "1.9.2"
resolved "https://registry.yarnpkg.com/growl/-/growl-1.9.2.tgz#0ea7743715db8d8de2c5ede1775e1b45ac85c02f"
+gulp-sourcemaps@1.6.0:
+ version "1.6.0"
+ resolved "https://registry.yarnpkg.com/gulp-sourcemaps/-/gulp-sourcemaps-1.6.0.tgz#b86ff349d801ceb56e1d9e7dc7bbcb4b7dee600c"
+ dependencies:
+ convert-source-map "^1.1.1"
+ graceful-fs "^4.1.2"
+ strip-bom "^2.0.0"
+ through2 "^2.0.0"
+ vinyl "^1.0.0"
+
gulp-util@^3.0.0:
version "3.0.8"
resolved "https://registry.yarnpkg.com/gulp-util/-/gulp-util-3.0.8.tgz#0054e1e744502e27c04c187c3ecc505dd54bbb4f"
@@ -5795,6 +5834,10 @@ is-utf8@^0.2.0:
version "0.2.1"
resolved "https://registry.yarnpkg.com/is-utf8/-/is-utf8-0.2.1.tgz#4b0da1442104d1b336340e80797e865cf39f7d72"
+is-valid-glob@^0.3.0:
+ version "0.3.0"
+ resolved "https://registry.yarnpkg.com/is-valid-glob/-/is-valid-glob-0.3.0.tgz#d4b55c69f51886f9b65c70d6c2622d37e29f48fe"
+
is-whitespace-character@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/is-whitespace-character/-/is-whitespace-character-1.0.1.tgz#9ae0176f3282b65457a1992cdb084f8a5f833e3b"
@@ -6023,7 +6066,7 @@ json-schema@0.2.3:
version "0.2.3"
resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13"
-json-stable-stringify@^1.0.1:
+json-stable-stringify@^1.0.0, json-stable-stringify@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz#9a759d39c5f2ff503fd5300646ed445f88c4f9af"
dependencies:
@@ -6148,6 +6191,12 @@ lazy-cache@^2.0.2:
dependencies:
set-getter "^0.1.0"
+lazystream@^1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/lazystream/-/lazystream-1.0.0.tgz#f6995fe0f820392f61396be89462407bb77168e4"
+ dependencies:
+ readable-stream "^2.0.5"
+
lcid@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/lcid/-/lcid-1.0.0.tgz#308accafa0bc483a3867b4b6f2b9506251d1b835"
@@ -6158,6 +6207,14 @@ lcov-parse@^0.0.10:
version "0.0.10"
resolved "https://registry.yarnpkg.com/lcov-parse/-/lcov-parse-0.0.10.tgz#1b0b8ff9ac9c7889250582b70b71315d9da6d9a3"
+lcov-result-merger@^2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/lcov-result-merger/-/lcov-result-merger-2.0.0.tgz#ba26a3b7d15b40b0efe6e603b1354b1dded28ce1"
+ dependencies:
+ through2 "^2.0.1"
+ vinyl "^2.0.0"
+ vinyl-fs "^2.4.3"
+
lerna@^2.5.1:
version "2.9.0"
resolved "https://registry.yarnpkg.com/lerna/-/lerna-2.9.0.tgz#303f70bc50b1c4541bdcf54eda13c36fe54401f3"
@@ -6503,6 +6560,10 @@ lodash.isarray@^3.0.0:
version "3.0.4"
resolved "https://registry.yarnpkg.com/lodash.isarray/-/lodash.isarray-3.0.4.tgz#79e4eb88c36a8122af86f844aa9bcd851b5fbb55"
+lodash.isequal@^4.0.0:
+ version "4.5.0"
+ resolved "https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0"
+
lodash.isnull@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/lodash.isnull/-/lodash.isnull-3.0.0.tgz#fafbe59ea1dca27eed786534039dd84c2e07c56e"
@@ -6849,6 +6910,12 @@ merge-source-map@^1.0.2:
dependencies:
source-map "^0.6.1"
+merge-stream@^1.0.0:
+ version "1.0.1"
+ resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-1.0.1.tgz#4041202d508a342ba00174008df0c251b8c135e1"
+ dependencies:
+ readable-stream "^2.0.1"
+
merkle-patricia-tree@^2.1.2, merkle-patricia-tree@^2.2.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/merkle-patricia-tree/-/merkle-patricia-tree-2.3.0.tgz#84c606232ef343f1b96fc972e697708754f08573"
@@ -6866,7 +6933,7 @@ methods@~1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee"
-micromatch@^2.3.11:
+micromatch@^2.3.11, micromatch@^2.3.7:
version "2.3.11"
resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-2.3.11.tgz#86677c97d1720b363431d04d0d15293bd38c1565"
dependencies:
@@ -7667,6 +7734,13 @@ ordered-read-streams@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/ordered-read-streams/-/ordered-read-streams-0.1.0.tgz#fd565a9af8eb4473ba69b6ed8a34352cb552f126"
+ordered-read-streams@^0.3.0:
+ version "0.3.0"
+ resolved "https://registry.yarnpkg.com/ordered-read-streams/-/ordered-read-streams-0.3.0.tgz#7137e69b3298bb342247a1bbee3881c80e2fd78b"
+ dependencies:
+ is-stream "^1.0.1"
+ readable-stream "^2.0.1"
+
original@>=0.0.5:
version "1.0.0"
resolved "https://registry.yarnpkg.com/original/-/original-1.0.0.tgz#9147f93fa1696d04be61e01bd50baeaca656bd3b"
@@ -8447,7 +8521,7 @@ private@^0.1.6, private@^0.1.7:
version "0.1.8"
resolved "https://registry.yarnpkg.com/private/-/private-0.1.8.tgz#2381edb3689f7a53d653190060fcf822d2f368ff"
-process-nextick-args@~2.0.0:
+process-nextick-args@^2.0.0, process-nextick-args@~2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.0.tgz#a37d732f4271b4ab1ad070d35508e8290788ffaa"
@@ -9012,7 +9086,7 @@ read@~1.0.5:
dependencies:
mute-stream "~0.0.4"
-"readable-stream@1 || 2", readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.4, readable-stream@^2.0.5, readable-stream@^2.0.6, readable-stream@^2.1.4, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.2.9, readable-stream@^2.3.3:
+"readable-stream@1 || 2", readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.4, readable-stream@^2.0.5, readable-stream@^2.0.6, readable-stream@^2.1.4, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.2.9, readable-stream@^2.3.3, readable-stream@^2.3.5:
version "2.3.5"
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.5.tgz#b4f85003a938cbb6ecbce2a124fb1012bd1a838d"
dependencies:
@@ -9227,7 +9301,7 @@ replace-ext@0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/replace-ext/-/replace-ext-0.0.1.tgz#29bbd92078a739f0bcce2b4ee41e837953522924"
-replace-ext@1.0.0:
+replace-ext@1.0.0, replace-ext@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/replace-ext/-/replace-ext-1.0.0.tgz#de63128373fcbf7c3ccfa4de5a480c45a67958eb"
@@ -10336,6 +10410,13 @@ strip-ansi@^4.0.0:
dependencies:
ansi-regex "^3.0.0"
+strip-bom-stream@^1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/strip-bom-stream/-/strip-bom-stream-1.0.0.tgz#e7144398577d51a6bed0fa1994fa05f43fd988ee"
+ dependencies:
+ first-chunk-stream "^1.0.0"
+ strip-bom "^2.0.0"
+
strip-bom@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-1.0.0.tgz#85b8862f3844b5a6d5ec8467a93598173a36f794"
@@ -10645,14 +10726,21 @@ thenify-all@^1.0.0, thenify-all@^1.6.0:
dependencies:
any-promise "^1.0.0"
-through2@^0.6.1, through2@~0.6.3:
+through2-filter@^2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/through2-filter/-/through2-filter-2.0.0.tgz#60bc55a0dacb76085db1f9dae99ab43f83d622ec"
+ dependencies:
+ through2 "~2.0.0"
+ xtend "~4.0.0"
+
+through2@^0.6.0, through2@^0.6.1, through2@~0.6.3:
version "0.6.5"
resolved "https://registry.yarnpkg.com/through2/-/through2-0.6.5.tgz#41ab9c67b29d57209071410e1d7a7a968cd3ad48"
dependencies:
readable-stream ">=1.0.33-1 <1.1.0-0"
xtend ">=4.0.0 <4.1.0-0"
-through2@^2.0.0, through2@^2.0.1, through2@^2.0.2:
+through2@^2.0.0, through2@^2.0.1, through2@^2.0.2, through2@~2.0.0:
version "2.0.3"
resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.3.tgz#0004569b37c7c74ba39c43f3ced78d1ad94140be"
dependencies:
@@ -10714,6 +10802,12 @@ tmp@^0.0.33:
dependencies:
os-tmpdir "~1.0.2"
+to-absolute-glob@^0.1.1:
+ version "0.1.1"
+ resolved "https://registry.yarnpkg.com/to-absolute-glob/-/to-absolute-glob-0.1.1.tgz#1cdfa472a9ef50c239ee66999b662ca0eb39937f"
+ dependencies:
+ extend-shallow "^2.0.1"
+
to-arraybuffer@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz#7d229b1fcc637e466ca081180836a7aabff83f43"
@@ -11265,6 +11359,13 @@ unique-stream@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/unique-stream/-/unique-stream-1.0.0.tgz#d59a4a75427447d9aa6c91e70263f8d26a4b104b"
+unique-stream@^2.0.2:
+ version "2.2.1"
+ resolved "https://registry.yarnpkg.com/unique-stream/-/unique-stream-2.2.1.tgz#5aa003cfbe94c5ff866c4e7d668bb1c4dbadb369"
+ dependencies:
+ json-stable-stringify "^1.0.0"
+ through2-filter "^2.0.0"
+
unique-string@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/unique-string/-/unique-string-1.0.0.tgz#9e1057cca851abb93398f8b33ae187b99caec11a"
@@ -11456,6 +11557,10 @@ v8flags@^2.0.2:
dependencies:
user-home "^1.1.1"
+vali-date@^1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/vali-date/-/vali-date-1.0.0.tgz#1b904a59609fb328ef078138420934f6b86709a6"
+
valid-url@^1.0.9:
version "1.0.9"
resolved "https://registry.yarnpkg.com/valid-url/-/valid-url-1.0.9.tgz#1c14479b40f1397a75782f115e4086447433a200"
@@ -11523,6 +11628,28 @@ vinyl-fs@^0.3.0:
through2 "^0.6.1"
vinyl "^0.4.0"
+vinyl-fs@^2.4.3:
+ version "2.4.4"
+ resolved "https://registry.yarnpkg.com/vinyl-fs/-/vinyl-fs-2.4.4.tgz#be6ff3270cb55dfd7d3063640de81f25d7532239"
+ dependencies:
+ duplexify "^3.2.0"
+ glob-stream "^5.3.2"
+ graceful-fs "^4.0.0"
+ gulp-sourcemaps "1.6.0"
+ is-valid-glob "^0.3.0"
+ lazystream "^1.0.0"
+ lodash.isequal "^4.0.0"
+ merge-stream "^1.0.0"
+ mkdirp "^0.5.0"
+ object-assign "^4.0.0"
+ readable-stream "^2.0.4"
+ strip-bom "^2.0.0"
+ strip-bom-stream "^1.0.0"
+ through2 "^2.0.0"
+ through2-filter "^2.0.0"
+ vali-date "^1.0.0"
+ vinyl "^1.0.0"
+
vinyl@^0.4.0:
version "0.4.6"
resolved "https://registry.yarnpkg.com/vinyl/-/vinyl-0.4.6.tgz#2f356c87a550a255461f36bbeb2a5ba8bf784847"
@@ -11538,6 +11665,25 @@ vinyl@^0.5.0:
clone-stats "^0.0.1"
replace-ext "0.0.1"
+vinyl@^1.0.0:
+ version "1.2.0"
+ resolved "https://registry.yarnpkg.com/vinyl/-/vinyl-1.2.0.tgz#5c88036cf565e5df05558bfc911f8656df218884"
+ dependencies:
+ clone "^1.0.0"
+ clone-stats "^0.0.1"
+ replace-ext "0.0.1"
+
+vinyl@^2.0.0:
+ version "2.1.0"
+ resolved "https://registry.yarnpkg.com/vinyl/-/vinyl-2.1.0.tgz#021f9c2cf951d6b939943c89eb5ee5add4fd924c"
+ dependencies:
+ clone "^2.1.1"
+ clone-buffer "^1.0.0"
+ clone-stats "^1.0.0"
+ cloneable-readable "^1.0.0"
+ remove-trailing-separator "^1.0.1"
+ replace-ext "^1.0.0"
+
vm-browserify@0.0.4:
version "0.0.4"
resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-0.0.4.tgz#5d7ea45bbef9e4a6ff65f95438e0a87c357d5a73"