diff options
author | Fabio Berger <me@fabioberger.com> | 2018-04-04 02:58:18 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-04 02:58:18 +0800 |
commit | 674e56cea69fe96ddd0071d3c4c5b5ea8ae299bf (patch) | |
tree | 19ddd0c0312eed054595c0d3431ecddead18e857 /packages | |
parent | 4a9752d7cda05f616d2709e34f4687da813d3090 (diff) | |
parent | 61809130a6659335c7550cf35c55e20b3e579a6f (diff) | |
download | dexon-0x-contracts-674e56cea69fe96ddd0071d3c4c5b5ea8ae299bf.tar.gz dexon-0x-contracts-674e56cea69fe96ddd0071d3c4c5b5ea8ae299bf.tar.zst dexon-0x-contracts-674e56cea69fe96ddd0071d3c4c5b5ea8ae299bf.zip |
Merge pull request #496 from 0xProject/removeUnusedDeps
Remove unused deps + Remove Dharma from website
Diffstat (limited to 'packages')
-rw-r--r-- | packages/0x.js/package.json | 5 | ||||
-rw-r--r-- | packages/0x.js/src/globals.d.ts | 1 | ||||
-rw-r--r-- | packages/contracts/package.json | 9 | ||||
-rw-r--r-- | packages/dev-utils/package.json | 3 | ||||
-rw-r--r-- | packages/monorepo-scripts/package.json | 8 | ||||
-rw-r--r-- | packages/monorepo-scripts/src/find_unused_dependencies.ts | 45 | ||||
-rw-r--r-- | packages/react-docs/package.json | 2 | ||||
-rw-r--r-- | packages/sol-cov/package.json | 5 | ||||
-rw-r--r-- | packages/sol-cov/src/coverage_subprovider.ts | 1 | ||||
-rw-r--r-- | packages/subproviders/package.json | 1 | ||||
-rw-r--r-- | packages/subproviders/src/globals.d.ts | 2 | ||||
-rw-r--r-- | packages/subproviders/src/subproviders/subprovider.ts | 4 | ||||
-rw-r--r-- | packages/subproviders/test/integration/ledger_subprovider_test.ts | 2 | ||||
-rw-r--r-- | packages/website/package.json | 13 | ||||
-rw-r--r-- | packages/website/ts/components/token_balances.tsx | 69 | ||||
-rw-r--r-- | packages/website/ts/globals.d.ts | 3 |
16 files changed, 57 insertions, 116 deletions
diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json index 8d2f3f01f..882b40733 100644 --- a/packages/0x.js/package.json +++ b/packages/0x.js/package.json @@ -60,15 +60,14 @@ "node": ">=6.0.0" }, "devDependencies": { - "@0xproject/abi-gen": "^0.2.9", "@0xproject/dev-utils": "^0.3.4", "@0xproject/monorepo-scripts": "^0.1.16", "@0xproject/tslint-config": "^0.4.14", "@types/bintrees": "^1.0.2", - "@types/jsonschema": "^1.1.1", "@types/lodash": "4.14.104", "@types/mocha": "^2.2.42", "@types/node": "^8.0.53", + "@types/request": "2.47.0", "@types/sinon": "^2.2.2", "@types/uuid": "^3.4.2", "awesome-typescript-loader": "^3.1.3", @@ -84,7 +83,6 @@ "opn-cli": "^3.1.0", "prettier": "^1.11.1", "request": "^2.81.0", - "request-promise-native": "^1.0.5", "shx": "^0.2.2", "sinon": "^4.0.0", "source-map-support": "^0.5.0", @@ -92,7 +90,6 @@ "tslint": "5.8.0", "typedoc": "0xProject/typedoc", "typescript": "2.7.1", - "web3-provider-engine": "^13.0.1", "webpack": "^3.1.0" }, "dependencies": { diff --git a/packages/0x.js/src/globals.d.ts b/packages/0x.js/src/globals.d.ts index 3cd6d91b1..b9b691ba1 100644 --- a/packages/0x.js/src/globals.d.ts +++ b/packages/0x.js/src/globals.d.ts @@ -1,5 +1,4 @@ declare module 'web3_beta'; -declare module 'request-promise-native'; // semver-sort declarations declare module 'semver-sort' { diff --git a/packages/contracts/package.json b/packages/contracts/package.json index c1d6fd289..8152a9afe 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -43,10 +43,8 @@ "devDependencies": { "@0xproject/dev-utils": "^0.3.4", "@0xproject/tslint-config": "^0.4.14", - "@types/bluebird": "^3.5.3", "@types/lodash": "4.14.104", "@types/node": "^8.0.53", - "@types/request-promise-native": "^1.0.2", "@types/yargs": "^10.0.0", "chai": "^4.0.1", "chai-as-promised": "^7.1.0", @@ -65,20 +63,15 @@ "dependencies": { "0x.js": "^0.35.0", "@0xproject/deployer": "^0.3.5", - "@0xproject/json-schemas": "^0.7.19", "@0xproject/types": "^0.5.0", "@0xproject/typescript-typings": "^0.0.3", "@0xproject/utils": "^0.5.0", "@0xproject/web3-wrapper": "^0.5.0", - "bluebird": "^3.5.0", "bn.js": "^4.11.8", "ethereumjs-abi": "^0.6.4", "ethereumjs-util": "^5.1.1", "ethers-contracts": "^2.2.1", - "isomorphic-fetch": "^2.2.1", "lodash": "^4.17.4", - "request": "^2.81.0", - "web3": "^0.20.0", - "web3-eth-abi": "^1.0.0-beta.24" + "web3": "^0.20.0" } } diff --git a/packages/dev-utils/package.json b/packages/dev-utils/package.json index f8ff22eaa..dd7712065 100644 --- a/packages/dev-utils/package.json +++ b/packages/dev-utils/package.json @@ -44,11 +44,8 @@ "@0xproject/subproviders": "^0.8.4", "@0xproject/types": "^0.5.0", "@0xproject/typescript-typings": "^0.0.3", - "@0xproject/utils": "^0.5.0", "@0xproject/web3-wrapper": "^0.5.0", - "ethereumjs-util": "^5.1.2", "lodash": "^4.17.4", - "request-promise-native": "^1.0.5", "web3": "^0.20.0", "web3-provider-engine": "^13.0.1" }, diff --git a/packages/monorepo-scripts/package.json b/packages/monorepo-scripts/package.json index e2ff1928d..b113b4b39 100644 --- a/packages/monorepo-scripts/package.json +++ b/packages/monorepo-scripts/package.json @@ -10,8 +10,10 @@ "clean": "shx rm -rf lib", "build": "tsc", "test:publish": "run-s build script:publish", + "find_unused_deps": "run-s build script:find_unused_deps", "script:deps_versions": "node ./lib/deps_versions.js", - "script:publish": "IS_DRY_RUN=true node ./lib/publish.js" + "script:publish": "IS_DRY_RUN=true node ./lib/publish.js", + "script:find_unused_deps": "node ./lib/find_unused_dependencies.js" }, "repository": { "type": "git", @@ -24,10 +26,11 @@ "homepage": "https://github.com/0xProject/0x-monorepo/packages/monorepo-scripts/README.md", "comment": "// We purposefully use an older version of tslint-config here to avoid creating an import cycle", "devDependencies": { - "@0xproject/tslint-config": "0.4.8", + "@0xproject/tslint-config": "0.4.13", "@types/glob": "^5.0.33", "@types/node": "^8.0.53", "@types/rimraf": "^2.0.2", + "depcheck": "^0.6.9", "lerna-get-packages": "^1.0.0", "npm-run-all": "^4.1.2", "shx": "^0.2.2", @@ -35,6 +38,7 @@ "typescript": "2.7.1" }, "dependencies": { + "@types/depcheck": "^0.6.0", "async-child-process": "^1.1.1", "chalk": "^2.3.0", "es6-promisify": "^5.0.0", diff --git a/packages/monorepo-scripts/src/find_unused_dependencies.ts b/packages/monorepo-scripts/src/find_unused_dependencies.ts new file mode 100644 index 000000000..374cba2e3 --- /dev/null +++ b/packages/monorepo-scripts/src/find_unused_dependencies.ts @@ -0,0 +1,45 @@ +#!/usr/bin/env node + +import * as depcheck from 'depcheck'; +import * as fs from 'fs'; +import lernaGetPackages = require('lerna-get-packages'); +import * as _ from 'lodash'; +import { exec as execAsync } from 'promisify-child-process'; + +import { constants } from './constants'; +import { utils } from './utils'; + +// For some reason, `depcheck` hangs on some packages. Add them here. +const IGNORE_PACKAGES = ['@0xproject/deployer']; + +(async () => { + utils.log('*** NOTE: Not all deps listed here are actually not required. ***'); + utils.log("*** `depcheck` isn't perfect so double check before actually removing any. ***\n"); + const lernaPackages = lernaGetPackages(constants.monorepoRootPath); + for (const lernaPackage of lernaPackages) { + if (_.includes(IGNORE_PACKAGES, lernaPackage.package.name)) { + continue; // skip + } + utils.log(`Checking ${lernaPackage.package.name} for unused deps. This might take a while...`); + + const configs = {}; + const result = await depcheckAsync(lernaPackage.location, configs); + if (!_.isEmpty(result.dependencies)) { + _.each(result.dependencies, dep => { + utils.log(dep); + }); + } + utils.log('\n'); + } +})().catch(err => { + utils.log(err); + process.exit(1); +}); + +async function depcheckAsync(path: string, opts: any): Promise<depcheck.Results> { + return new Promise<depcheck.Results>((resolve, reject) => { + depcheck(path, opts, (unused: any) => { + resolve(unused); + }); + }); +} diff --git a/packages/react-docs/package.json b/packages/react-docs/package.json index dbcaf5c09..12f438f53 100644 --- a/packages/react-docs/package.json +++ b/packages/react-docs/package.json @@ -39,7 +39,6 @@ "@types/react": "^16.0.34", "@types/react-dom": "^16.0.3", "@types/react-scroll": "0.0.31", - "@types/react-tap-event-plugin": "0.0.30", "basscss": "^8.0.3", "compare-versions": "^3.0.1", "lodash": "^4.17.4", @@ -48,7 +47,6 @@ "react-dom": "15.6.1", "react-markdown": "^3.2.2", "react-scroll": "^1.5.2", - "react-tap-event-plugin": "^2.0.1", "react-tooltip": "^3.2.7" }, "publishConfig": { diff --git a/packages/sol-cov/package.json b/packages/sol-cov/package.json index f9ccc556b..6444fb876 100644 --- a/packages/sol-cov/package.json +++ b/packages/sol-cov/package.json @@ -44,15 +44,12 @@ "@0xproject/subproviders": "^0.8.4", "@0xproject/types": "^0.5.0", "@0xproject/typescript-typings": "^0.0.3", - "@0xproject/utils": "^0.5.0", "ethereumjs-util": "^5.1.1", "glob": "^7.1.2", "istanbul": "^0.4.5", "lodash": "^4.17.4", "semaphore-async-await": "^1.5.1", - "solidity-coverage": "^0.4.10", - "solidity-parser-antlr": "^0.2.8", - "solidity-parser-sc": "^0.4.4" + "solidity-parser-antlr": "^0.2.8" }, "devDependencies": { "@0xproject/monorepo-scripts": "^0.1.16", diff --git a/packages/sol-cov/src/coverage_subprovider.ts b/packages/sol-cov/src/coverage_subprovider.ts index 1c80dca7b..fc8b55188 100644 --- a/packages/sol-cov/src/coverage_subprovider.ts +++ b/packages/sol-cov/src/coverage_subprovider.ts @@ -1,6 +1,5 @@ import { Callback, ErrorCallback, NextCallback, Subprovider } from '@0xproject/subproviders'; import { BlockParam, CallData, JSONRPCRequestPayload, TransactionTrace, TxData } from '@0xproject/types'; -import { promisify } from '@0xproject/utils'; import * as _ from 'lodash'; import { Lock } from 'semaphore-async-await'; diff --git a/packages/subproviders/package.json b/packages/subproviders/package.json index 3f13424aa..cadbac0e8 100644 --- a/packages/subproviders/package.json +++ b/packages/subproviders/package.json @@ -43,7 +43,6 @@ "@ledgerhq/hw-app-eth": "^4.3.0", "@ledgerhq/hw-transport-u2f": "^4.3.0", "bn.js": "^4.11.8", - "es6-promisify": "^5.0.0", "ethereumjs-tx": "^1.3.3", "ethereumjs-util": "^5.1.1", "ganache-core": "0xProject/ganache-core", diff --git a/packages/subproviders/src/globals.d.ts b/packages/subproviders/src/globals.d.ts index 916fed807..580c5aaa5 100644 --- a/packages/subproviders/src/globals.d.ts +++ b/packages/subproviders/src/globals.d.ts @@ -1,5 +1,3 @@ -declare module 'es6-promisify'; - // tslint:disable:max-classes-per-file // tslint:disable:class-name // tslint:disable:async-suffix diff --git a/packages/subproviders/src/subproviders/subprovider.ts b/packages/subproviders/src/subproviders/subprovider.ts index 26ce19305..c51462f07 100644 --- a/packages/subproviders/src/subproviders/subprovider.ts +++ b/packages/subproviders/src/subproviders/subprovider.ts @@ -1,5 +1,5 @@ import { JSONRPCRequestPayload, JSONRPCResponsePayload } from '@0xproject/types'; -import promisify = require('es6-promisify'); +import { promisify } from '@0xproject/utils'; import * as Web3 from 'web3'; import { JSONRPCRequestPayloadWithMethod } from '../types'; @@ -40,7 +40,7 @@ export class Subprovider { */ public async emitPayloadAsync(payload: Partial<JSONRPCRequestPayloadWithMethod>): Promise<JSONRPCResponsePayload> { const finalPayload = Subprovider._createFinalPayload(payload); - const response = await promisify(this._engine.sendAsync, this._engine)(finalPayload); + const response = await promisify<JSONRPCResponsePayload>(this._engine.sendAsync, this._engine)(finalPayload); return response; } /** diff --git a/packages/subproviders/test/integration/ledger_subprovider_test.ts b/packages/subproviders/test/integration/ledger_subprovider_test.ts index 969081ad5..bc60b4330 100644 --- a/packages/subproviders/test/integration/ledger_subprovider_test.ts +++ b/packages/subproviders/test/integration/ledger_subprovider_test.ts @@ -1,10 +1,10 @@ import { JSONRPCResponsePayload } from '@0xproject/types'; +import { promisify } from '@0xproject/utils'; import Eth from '@ledgerhq/hw-app-eth'; // HACK: This depdency is optional and tslint skips optional depdencies // tslint:disable-next-line:no-implicit-dependencies import TransportNodeHid from '@ledgerhq/hw-transport-node-hid'; import * as chai from 'chai'; -import promisify = require('es6-promisify'); import * as ethUtils from 'ethereumjs-util'; import * as _ from 'lodash'; import Web3 = require('web3'); diff --git a/packages/website/package.json b/packages/website/package.json index d3c5566d1..7d0c68b47 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -28,10 +28,7 @@ "accounting": "^0.4.1", "basscss": "^8.0.3", "blockies": "^0.0.2", - "dateformat": "^2.0.0", "deep-equal": "^1.0.1", - "dharma-loan-frame": "^0.0.12", - "ethereumjs-tx": "^1.3.3", "ethereumjs-util": "^5.1.1", "find-versions": "^2.0.0", "jsonschema": "^1.2.0", @@ -39,25 +36,17 @@ "lodash": "^4.17.4", "material-ui": "^0.17.1", "moment": "2.21.0", - "query-string": "^5.0.1", "react": "15.6.1", "react-copy-to-clipboard": "^4.2.3", "react-document-title": "^2.0.3", "react-dom": "15.6.1", "react-ga": "^2.4.1", - "react-html5video": "^2.1.0", - "react-inlinesvg": "^0.5.5", - "react-markdown": "^3.2.2", - "react-recaptcha": "^2.3.2", "react-redux": "^5.0.3", "react-router-dom": "^4.1.1", - "react-router-hash-link": "^1.1.0", "react-scroll": "^1.5.2", "react-tap-event-plugin": "^2.0.1", "react-tooltip": "^3.2.7", - "react-waypoint": "^7.0.4", "redux": "^3.6.0", - "scroll-to-element": "^2.0.0", "semver-sort": "0.0.4", "thenby": "^1.2.3", "truffle-contract": "2.0.1", @@ -68,13 +57,11 @@ }, "devDependencies": { "@types/accounting": "^0.4.1", - "@types/dateformat": "^1.0.1", "@types/deep-equal": "^1.0.0", "@types/jsonschema": "^1.1.1", "@types/lodash": "4.14.104", "@types/material-ui": "0.18.0", "@types/node": "^8.0.53", - "@types/query-string": "^5.0.1", "@types/react": "^16.0.34", "@types/react-copy-to-clipboard": "^4.2.0", "@types/react-dom": "^16.0.3", diff --git a/packages/website/ts/components/token_balances.tsx b/packages/website/ts/components/token_balances.tsx index b4a710ef4..618b5fe8f 100644 --- a/packages/website/ts/components/token_balances.tsx +++ b/packages/website/ts/components/token_balances.tsx @@ -8,7 +8,6 @@ import { utils as sharedUtils, } from '@0xproject/react-shared'; import { BigNumber, logUtils } from '@0xproject/utils'; -import DharmaLoanFrame from 'dharma-loan-frame'; import * as _ from 'lodash'; import Dialog from 'material-ui/Dialog'; import Divider from 'material-ui/Divider'; @@ -79,7 +78,6 @@ interface TokenBalancesProps { interface TokenBalancesState { errorType: BalanceErrs; isBalanceSpinnerVisible: boolean; - isDharmaDialogVisible: boolean; isZRXSpinnerVisible: boolean; isTokenPickerOpen: boolean; isAddingToken: boolean; @@ -96,7 +94,6 @@ export class TokenBalances extends React.Component<TokenBalancesProps, TokenBala errorType: undefined, isBalanceSpinnerVisible: false, isZRXSpinnerVisible: false, - isDharmaDialogVisible: DharmaLoanFrame.isAuthTokenPresent(), isTokenPickerOpen: false, isAddingToken: false, trackedTokenStateByAddress: initialTrackedTokenStateByAddress, @@ -168,20 +165,8 @@ export class TokenBalances extends React.Component<TokenBalancesProps, TokenBala onTouchTap={this._onErrorDialogToggle.bind(this, false)} />, ]; - const dharmaDialogActions = [ - <FlatButton - key="dharmaCloseBtn" - label="Close" - primary={true} - onTouchTap={this._onDharmaDialogToggle.bind(this, false)} - />, - ]; const isTestNetwork = utils.isTestNetwork(this.props.networkId); const isKovanTestNetwork = this.props.networkId === constants.NETWORK_ID_KOVAN; - const dharmaButtonColumnStyle = { - paddingLeft: 3, - display: isKovanTestNetwork ? 'table-cell' : 'none', - }; const stubColumnStyle = { display: isTestNetwork ? 'none' : 'table-cell', }; @@ -190,11 +175,6 @@ export class TokenBalances extends React.Component<TokenBalancesProps, TokenBala allTokenRowHeight < MAX_TOKEN_TABLE_HEIGHT ? allTokenRowHeight : MAX_TOKEN_TABLE_HEIGHT; const isSmallScreen = this.props.screenWidth === ScreenWidths.Sm; const tokenColSpan = isSmallScreen ? TOKEN_COL_SPAN_SM : TOKEN_COL_SPAN_LG; - const dharmaLoanExplanation = - 'If you need access to larger amounts of ether,<br> \ - you can request a loan from the Dharma Loan<br> \ - network. Your loan should be funded in 5<br> \ - minutes or less.'; const allowanceExplanation = '0x smart contracts require access to your<br> \ token balances in order to execute trades.<br> \ @@ -226,12 +206,6 @@ export class TokenBalances extends React.Component<TokenBalancesProps, TokenBala {isSmallScreen ? 'Faucet' : 'Request from faucet'} </TableHeaderColumn> )} - {isKovanTestNetwork && ( - <TableHeaderColumn style={dharmaButtonColumnStyle}> - {isSmallScreen ? 'Loan' : 'Request Dharma loan'} - <HelpTooltip style={{ paddingLeft: 4 }} explanation={dharmaLoanExplanation} /> - </TableHeaderColumn> - )} </TableRow> </TableHeader> <TableBody displayRowCheckbox={false}> @@ -258,15 +232,6 @@ export class TokenBalances extends React.Component<TokenBalancesProps, TokenBala /> </TableRowColumn> )} - {isKovanTestNetwork && ( - <TableRowColumn style={dharmaButtonColumnStyle}> - <RaisedButton - label="Request" - style={{ width: '100%' }} - onTouchTap={this._onDharmaDialogToggle.bind(this)} - /> - </TableRowColumn> - )} </TableRow> </TableBody> </Table> @@ -315,17 +280,6 @@ export class TokenBalances extends React.Component<TokenBalancesProps, TokenBala > {this._renderErrorDialogBody()} </Dialog> - <Dialog - title="Request Dharma Loan" - titleStyle={{ fontWeight: 100, backgroundColor: colors.white }} - bodyStyle={{ backgroundColor: colors.dharmaDarkGrey }} - actionsContainerStyle={{ backgroundColor: colors.white }} - autoScrollBodyContent={true} - actions={dharmaDialogActions} - open={this.state.isDharmaDialogVisible} - > - {this._renderDharmaLoanFrame()} - </Dialog> <AssetPicker userAddress={this.props.userAddress} networkId={this.props.networkId} @@ -545,24 +499,6 @@ export class TokenBalances extends React.Component<TokenBalancesProps, TokenBala throw utils.spawnSwitchErr('errorType', this.state.errorType); } } - private _renderDharmaLoanFrame() { - if (sharedUtils.isUserOnMobile()) { - return ( - <h4 style={{ textAlign: 'center' }}> - We apologize -- Dharma loan requests are not available on mobile yet. Please try again through your - desktop browser. - </h4> - ); - } else { - return ( - <DharmaLoanFrame - partner="0x" - env={utils.getCurrentEnvironment()} - screenWidth={this.props.screenWidth} - /> - ); - } - } private _onErrorOccurred(errorType: BalanceErrs) { this.setState({ errorType, @@ -646,11 +582,6 @@ export class TokenBalances extends React.Component<TokenBalancesProps, TokenBala errorType: undefined, }); } - private _onDharmaDialogToggle() { - this.setState({ - isDharmaDialogVisible: !this.state.isDharmaDialogVisible, - }); - } private _onAddTokenClicked() { this.setState({ isTokenPickerOpen: true, diff --git a/packages/website/ts/globals.d.ts b/packages/website/ts/globals.d.ts index fcf4c2434..2c2140485 100644 --- a/packages/website/ts/globals.d.ts +++ b/packages/website/ts/globals.d.ts @@ -1,12 +1,9 @@ declare module 'react-tooltip'; -declare module 'react-router-hash-link'; declare module 'truffle-contract'; declare module 'keccak'; declare module 'whatwg-fetch'; -declare module 'react-html5video'; declare module 'web3-provider-engine/subproviders/filters'; declare module 'thenby'; -declare module 'react-recaptcha'; declare module 'react-document-title'; declare module 'react-ga'; |