aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-03-19 02:04:16 +0800
committerFabio Berger <me@fabioberger.com>2018-03-19 02:04:16 +0800
commit5468358f2142549c68ffae0085ce7d31ea271ea4 (patch)
tree9c7886744f85a1ed6b1ced653d9312c30d5ffda2
parent87044313c2219f7130c1856f636f3db29b0fd1c4 (diff)
downloaddexon-0x-contracts-5468358f2142549c68ffae0085ce7d31ea271ea4.tar.gz
dexon-0x-contracts-5468358f2142549c68ffae0085ce7d31ea271ea4.tar.zst
dexon-0x-contracts-5468358f2142549c68ffae0085ce7d31ea271ea4.zip
Add Subprovider docs to website
-rw-r--r--packages/subproviders/package.json16
-rw-r--r--packages/subproviders/src/monorepo_scripts/stagedocs.ts8
-rw-r--r--packages/website/md/docs/subproviders/installation.md15
-rw-r--r--packages/website/md/docs/subproviders/introduction.md1
-rw-r--r--packages/website/translations/chinese.json3
-rw-r--r--packages/website/translations/english.json3
-rw-r--r--packages/website/translations/korean.json3
-rw-r--r--packages/website/translations/russian.json3
-rw-r--r--packages/website/translations/spanish.json3
-rw-r--r--packages/website/ts/components/sidebar_header.tsx1
-rw-r--r--packages/website/ts/components/top_bar/top_bar.tsx33
-rw-r--r--packages/website/ts/containers/subproviders_documentation.ts137
-rw-r--r--packages/website/ts/index.tsx7
-rw-r--r--packages/website/ts/pages/documentation/doc_page.tsx2
-rw-r--r--packages/website/ts/types.ts3
15 files changed, 225 insertions, 13 deletions
diff --git a/packages/subproviders/package.json b/packages/subproviders/package.json
index 58b518079..f6869c5c0 100644
--- a/packages/subproviders/package.json
+++ b/packages/subproviders/package.json
@@ -17,7 +17,20 @@
"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"
+ "test:integration": "run-s clean build run_mocha_integration",
+ "docs:stage": "yarn build && node ./scripts/stagedocs.js",
+ "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"
+ },
+ "config": {
+ "postpublish": {
+ "assets": [],
+ "docPublishConfigs": {
+ "extraFileIncludes": ["../types/src/index.ts"],
+ "s3BucketPath": "s3://doc-jsons/subproviders/",
+ "s3StagingBucketPath": "s3://staging-doc-jsons/subproviders/"
+ }
+ }
},
"dependencies": {
"@0xproject/assert": "^0.2.0",
@@ -57,6 +70,7 @@
"tslint": "5.8.0",
"types-bn": "^0.0.1",
"types-ethereumjs-util": "0xProject/types-ethereumjs-util",
+ "typedoc": "0xProject/typedoc",
"typescript": "2.7.1",
"webpack": "^3.1.0"
},
diff --git a/packages/subproviders/src/monorepo_scripts/stagedocs.ts b/packages/subproviders/src/monorepo_scripts/stagedocs.ts
new file mode 100644
index 000000000..e732ac8eb
--- /dev/null
+++ b/packages/subproviders/src/monorepo_scripts/stagedocs.ts
@@ -0,0 +1,8 @@
+import { postpublishUtils } from '@0xproject/monorepo-scripts';
+
+import * as packageJSON from '../package.json';
+import * as tsConfigJSON from '../tsconfig.json';
+
+const cwd = `${__dirname}/..`;
+// tslint:disable-next-line:no-floating-promises
+postpublishUtils.publishDocsToStagingAsync(packageJSON, tsConfigJSON, cwd);
diff --git a/packages/website/md/docs/subproviders/installation.md b/packages/website/md/docs/subproviders/installation.md
new file mode 100644
index 000000000..a049ff0ec
--- /dev/null
+++ b/packages/website/md/docs/subproviders/installation.md
@@ -0,0 +1,15 @@
+```bash
+npm install @0xproject/subproviders --save
+```
+
+**Import**
+
+```typescript
+import { LedgerSubprovider } from '@0xproject/subproviders';
+```
+
+or
+
+```javascript
+var LedgerSubprovider = require('@0xproject/subproviders').LedgerSubprovider;
+```
diff --git a/packages/website/md/docs/subproviders/introduction.md b/packages/website/md/docs/subproviders/introduction.md
new file mode 100644
index 000000000..835201064
--- /dev/null
+++ b/packages/website/md/docs/subproviders/introduction.md
@@ -0,0 +1 @@
+Welcome to the [Subproviders](https://github.com/0xProject/0x-monorepo/tree/development/packages/subproviders) documentation! Subproviders is a package containing useful [subproviders](https://0xproject.com/wiki#Web3-Provider-Explained) that can be used with the [Web3 Provider Engine](https://github.com/MetaMask/provider-engine) library.
diff --git a/packages/website/translations/chinese.json b/packages/website/translations/chinese.json
index a46d12747..f610bf56c 100644
--- a/packages/website/translations/chinese.json
+++ b/packages/website/translations/chinese.json
@@ -58,7 +58,8 @@
"CONTACT": "联系方式",
"DEPLOYER": "Deployer",
"JSON_SCHEMAS": "JSON Schemas",
- "SOL_COV": "Solidty Coverage",
+ "SOL_COV": "Solidity Coverage",
+ "SUBPROVIDERS": "Subproviders",
"BLOG": "博客",
"FORUM": "论坛",
"CONNECT": "0x 连接",
diff --git a/packages/website/translations/english.json b/packages/website/translations/english.json
index 3b9818909..122d445cb 100644
--- a/packages/website/translations/english.json
+++ b/packages/website/translations/english.json
@@ -59,7 +59,8 @@
"CONTACT": "contact",
"DEPLOYER": "Deployer",
"JSON_SCHEMAS": "JSON Schemas",
- "SOL_COV": "Solidty Coverage",
+ "SOL_COV": "Solidity Coverage",
+ "SUBPROVIDERS": "Subproviders",
"BLOG": "blog",
"FORUM": "forum",
"CONNECT": "0x Connect",
diff --git a/packages/website/translations/korean.json b/packages/website/translations/korean.json
index 6bc78cd4f..dd5f19b16 100644
--- a/packages/website/translations/korean.json
+++ b/packages/website/translations/korean.json
@@ -58,7 +58,8 @@
"CONTACT": "문의",
"DEPLOYER": "Deployer",
"JSON_SCHEMAS": "JSON Schemas",
- "SOL_COV": "Solidty Coverage",
+ "SOL_COV": "Solidity Coverage",
+ "SUBPROVIDERS": "Subproviders",
"BLOG": "블로그",
"FORUM": "포럼",
"CONNECT": "0x Connect",
diff --git a/packages/website/translations/russian.json b/packages/website/translations/russian.json
index 68ebed30b..5a8e2c539 100644
--- a/packages/website/translations/russian.json
+++ b/packages/website/translations/russian.json
@@ -58,7 +58,8 @@
"CONTACT": "Связаться с нами",
"DEPLOYER": "Deployer",
"JSON_SCHEMAS": "JSON Schemas",
- "SOL_COV": "Solidty Coverage",
+ "SOL_COV": "Solidity Coverage",
+ "SUBPROVIDERS": "Subproviders",
"BLOG": "Блог",
"FORUM": "Форум",
"CONNECT": "0x Connect",
diff --git a/packages/website/translations/spanish.json b/packages/website/translations/spanish.json
index cd508f00a..dd34e805c 100644
--- a/packages/website/translations/spanish.json
+++ b/packages/website/translations/spanish.json
@@ -59,7 +59,8 @@
"CONTACT": "contacto",
"DEPLOYER": "Deployer",
"JSON_SCHEMAS": "JSON Schemas",
- "SOL_COV": "Solidty Coverage",
+ "SOL_COV": "Solidity Coverage",
+ "SUBPROVIDERS": "Subproviders",
"BLOG": "blog",
"FORUM": "foro",
"CONNECT": "0x Connect",
diff --git a/packages/website/ts/components/sidebar_header.tsx b/packages/website/ts/components/sidebar_header.tsx
index 6fae03691..556243430 100644
--- a/packages/website/ts/components/sidebar_header.tsx
+++ b/packages/website/ts/components/sidebar_header.tsx
@@ -10,6 +10,7 @@ const titleToIcon: { [title: string]: string } = {
Deployer: 'zeroExJs.png',
'Sol-cov': 'zeroExJs.png',
'JSON Schemas': 'zeroExJs.png',
+ Subproviders: 'zeroExJs.png',
'0x Connect': 'connect.png',
'0x Smart Contracts': 'contracts.png',
Wiki: 'wiki.png',
diff --git a/packages/website/ts/components/top_bar/top_bar.tsx b/packages/website/ts/components/top_bar/top_bar.tsx
index 66efe0d24..3a6ceed34 100644
--- a/packages/website/ts/components/top_bar/top_bar.tsx
+++ b/packages/website/ts/components/top_bar/top_bar.tsx
@@ -120,22 +120,28 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> {
primaryText={this.props.translate.get(Key.StandardRelayerApi, Deco.CapWords)}
/>
</a>,
- <Link key="subMenuItem-web3Wrapper" to={WebsitePaths.Web3Wrapper} className="text-decoration-none">
+ <Link key="subMenuItem-jsonSchema" to={WebsitePaths.JSONSchemas} className="text-decoration-none">
<MenuItem
style={{ fontSize: styles.menuItem.fontSize }}
- primaryText={this.props.translate.get(Key.Web3Wrapper, Deco.CapWords)}
+ primaryText={this.props.translate.get(Key.JsonSchemas, Deco.CapWords)}
/>
</Link>,
- <Link key="subMenuItem-deployer" to={WebsitePaths.Deployer} className="text-decoration-none">
+ <Link key="subMenuItem-subproviders" to={WebsitePaths.Subproviders} className="text-decoration-none">
<MenuItem
style={{ fontSize: styles.menuItem.fontSize }}
- primaryText={this.props.translate.get(Key.Deployer, Deco.CapWords)}
+ primaryText={this.props.translate.get(Key.Subproviders, Deco.CapWords)}
/>
</Link>,
- <Link key="subMenuItem-jsonSchema" to={WebsitePaths.JSONSchemas} className="text-decoration-none">
+ <Link key="subMenuItem-web3Wrapper" to={WebsitePaths.Web3Wrapper} className="text-decoration-none">
<MenuItem
style={{ fontSize: styles.menuItem.fontSize }}
- primaryText={this.props.translate.get(Key.JsonSchemas, Deco.CapWords)}
+ primaryText={this.props.translate.get(Key.Web3Wrapper, Deco.CapWords)}
+ />
+ </Link>,
+ <Link key="subMenuItem-deployer" to={WebsitePaths.Deployer} className="text-decoration-none">
+ <MenuItem
+ style={{ fontSize: styles.menuItem.fontSize }}
+ primaryText={this.props.translate.get(Key.Deployer, Deco.CapWords)}
/>
</Link>,
<Link key="subMenuItem-sol-cov" to={WebsitePaths.SolCov} className="text-decoration-none">
@@ -333,6 +339,14 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> {
</MenuItem>
</Link>
)}
+ {!this._isViewingSubprovidersDocs() && (
+ <Link to={WebsitePaths.Subproviders} className="text-decoration-none">
+ <MenuItem className="py2">
+ {this.props.translate.get(Key.Subproviders, Deco.Cap)}{' '}
+ {this.props.translate.get(Key.Docs, Deco.Cap)}
+ </MenuItem>
+ </Link>
+ )}
{!this._isViewingPortal() && (
<Link to={`${WebsitePaths.Portal}`} className="text-decoration-none">
<MenuItem className="py2">
@@ -366,6 +380,7 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> {
!this._isViewingDeployerDocs() &&
!this._isViewingJsonSchemasDocs() &&
!this._isViewingSolCovDocs() &&
+ !this._isViewingSubprovidersDocs() &&
!this._isViewingConnectDocs()) ||
_.isUndefined(this.props.menu)
) {
@@ -466,6 +481,9 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> {
private _isViewingSolCovDocs() {
return _.includes(this.props.location.pathname, WebsitePaths.SolCov);
}
+ private _isViewingSubprovidersDocs() {
+ return _.includes(this.props.location.pathname, WebsitePaths.Subproviders);
+ }
private _isViewingWiki() {
return _.includes(this.props.location.pathname, WebsitePaths.Wiki);
}
@@ -479,7 +497,8 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> {
this._isViewingDeployerDocs() ||
this._isViewingJsonSchemasDocs() ||
this._isViewingSolCovDocs() ||
+ this._isViewingSubprovidersDocs() ||
this._isViewingConnectDocs()
);
}
-}
+} // tslint:disable:max-file-line-count
diff --git a/packages/website/ts/containers/subproviders_documentation.ts b/packages/website/ts/containers/subproviders_documentation.ts
new file mode 100644
index 000000000..34a3d7da2
--- /dev/null
+++ b/packages/website/ts/containers/subproviders_documentation.ts
@@ -0,0 +1,137 @@
+import { constants as docConstants, DocsInfo, DocsInfoConfig, SupportedDocJson } from '@0xproject/react-docs';
+import * as _ from 'lodash';
+import * as React from 'react';
+import { connect } from 'react-redux';
+import { Dispatch } from 'redux';
+import { DocPage as DocPageComponent, DocPageProps } from 'ts/pages/documentation/doc_page';
+import { Dispatcher } from 'ts/redux/dispatcher';
+import { State } from 'ts/redux/reducer';
+import { DocPackages, Environments, WebsitePaths } from 'ts/types';
+import { configs } from 'ts/utils/configs';
+import { constants } from 'ts/utils/constants';
+import { Translate } from 'ts/utils/translate';
+
+/* tslint:disable:no-var-requires */
+const IntroMarkdown = require('md/docs/subproviders/introduction');
+const InstallationMarkdown = require('md/docs/subproviders/installation');
+/* tslint:enable:no-var-requires */
+
+const docSections = {
+ introduction: 'introduction',
+ installation: 'installation',
+ subprovider: 'subprovider',
+ ledgerSubprovider: 'ledgerSubprovider',
+ factoryMethods: 'factory-methods',
+ emptyWalletSubprovider: 'emptyWalletSubprovider',
+ fakeGasEstimateSubprovider: 'fakeGasEstimateSubprovider',
+ injectedWeb3Subprovider: 'injectedWeb3Subprovider',
+ redundantRPCSubprovider: 'redundantRPCSubprovider',
+ ganacheSubprovider: 'ganacheSubprovider',
+ nonceTrackerSubprovider: 'nonceTrackerSubprovider',
+ types: docConstants.TYPES_SECTION_NAME,
+};
+
+const docsInfoConfig: DocsInfoConfig = {
+ id: DocPackages.Subproviders,
+ type: SupportedDocJson.TypeDoc,
+ displayName: 'Subproviders',
+ packageUrl: 'https://github.com/0xProject/0x-monorepo',
+ menu: {
+ introduction: [docSections.introduction],
+ install: [docSections.installation],
+ subprovider: [docSections.subprovider],
+ ['ledger-subprovider']: [docSections.ledgerSubprovider],
+ ['factory-methods']: [docSections.factoryMethods],
+ ['emptyWallet-subprovider']: [docSections.emptyWalletSubprovider],
+ ['fakeGasEstimate-subprovider']: [docSections.fakeGasEstimateSubprovider],
+ ['injectedWeb3-subprovider']: [docSections.injectedWeb3Subprovider],
+ ['redundantRPC-subprovider']: [docSections.redundantRPCSubprovider],
+ ['ganache-subprovider']: [docSections.ganacheSubprovider],
+ ['nonceTracker-subprovider']: [docSections.nonceTrackerSubprovider],
+ types: [docSections.types],
+ },
+ sectionNameToMarkdown: {
+ [docSections.introduction]: IntroMarkdown,
+ [docSections.installation]: InstallationMarkdown,
+ },
+ sectionNameToModulePath: {
+ [docSections.subprovider]: ['"subproviders/src/subproviders/subprovider"'],
+ [docSections.ledgerSubprovider]: ['"subproviders/src/subproviders/ledger"'],
+ [docSections.factoryMethods]: ['"subproviders/src/index"'],
+ [docSections.emptyWalletSubprovider]: ['"subproviders/src/subproviders/empty_wallet_subprovider"'],
+ [docSections.fakeGasEstimateSubprovider]: ['"subproviders/src/subproviders/fake_gas_estimate_subprovider"'],
+ [docSections.injectedWeb3Subprovider]: ['"subproviders/src/subproviders/injected_web3"'],
+ [docSections.redundantRPCSubprovider]: ['"subproviders/src/subproviders/redundant_rpc"'],
+ [docSections.ganacheSubprovider]: ['"subproviders/src/subproviders/ganache"'],
+ [docSections.nonceTrackerSubprovider]: ['"subproviders/src/subproviders/nonce_tracker"'],
+ [docSections.types]: ['"deployer/src/utils/types"', '"types/src/index"', '"subproviders/src/types"'],
+ },
+ menuSubsectionToVersionWhenIntroduced: {},
+ sections: docSections,
+ visibleConstructors: [
+ docSections.subprovider,
+ docSections.ledgerSubprovider,
+ docSections.emptyWalletSubprovider,
+ docSections.fakeGasEstimateSubprovider,
+ docSections.injectedWeb3Subprovider,
+ docSections.redundantRPCSubprovider,
+ docSections.ganacheSubprovider,
+ docSections.nonceTrackerSubprovider,
+ ],
+ typeConfigs: {
+ // Note: This needs to be kept in sync with the types exported in index.ts. Unfortunately there is
+ // currently no way to extract the re-exported types from index.ts via TypeDoc :(
+ publicTypes: [
+ 'Callback',
+ 'NextCallback',
+ 'ErrorCallback',
+ 'ECSignature',
+ 'JSONRPCRequestPayloadWithMethod',
+ 'JSONRPCResponsePayload',
+ 'AccountFetchingConfigs',
+ 'LedgerEthereumClientFactoryAsync',
+ 'PartialTxParams',
+ 'LedgerEthereumClient',
+ 'LedgerSubproviderConfigs',
+ ],
+ typeNameToExternalLink: {
+ Web3: 'https://github.com/ethereum/wiki/wiki/JavaScript-API',
+ BigNumber: 'https://github.com/0xProject/web3-typescript-typings/blob/f5bcb96/index.d.ts#L127',
+ JSONRPCRequestPayload: 'https://github.com/0xProject/web3-typescript-typings/blob/f5bcb96/index.d.ts#L137',
+ JSONRPCResponsePayload: 'https://github.com/0xProject/web3-typescript-typings/blob/f5bcb96/index.d.ts#L144',
+ Provider: 'https://github.com/0xProject/web3-typescript-typings/blob/f5bcb96/index.d.ts#L150',
+ },
+ typeNameToPrefix: {
+ JSONRPCRequestPayload: 'Web3',
+ JSONRPCResponsePayload: 'Web3',
+ Provider: 'Web3',
+ },
+ },
+};
+const docsInfo = new DocsInfo(docsInfoConfig);
+
+interface ConnectedState {
+ docsVersion: string;
+ availableDocVersions: string[];
+ docsInfo: DocsInfo;
+ translate: Translate;
+}
+
+interface ConnectedDispatch {
+ dispatcher: Dispatcher;
+}
+
+const mapStateToProps = (state: State, ownProps: DocPageProps): ConnectedState => ({
+ docsVersion: state.docsVersion,
+ availableDocVersions: state.availableDocVersions,
+ translate: state.translate,
+ docsInfo,
+});
+
+const mapDispatchToProps = (dispatch: Dispatch<State>): ConnectedDispatch => ({
+ dispatcher: new Dispatcher(dispatch),
+});
+
+export const Documentation: React.ComponentClass<DocPageProps> = connect(mapStateToProps, mapDispatchToProps)(
+ DocPageComponent,
+);
diff --git a/packages/website/ts/index.tsx b/packages/website/ts/index.tsx
index 1241c222b..0d33e389f 100644
--- a/packages/website/ts/index.tsx
+++ b/packages/website/ts/index.tsx
@@ -57,6 +57,9 @@ const LazyJSONSchemasDocumentation = createLazyComponent('Documentation', async
const LazySolCovDocumentation = createLazyComponent('Documentation', async () =>
System.import<any>(/* webpackChunkName: "connectDocs" */ 'ts/containers/sol_cov_documentation'),
);
+const LazySubprovidersDocumentation = createLazyComponent('Documentation', async () =>
+ System.import<any>(/* webpackChunkName: "connectDocs" */ 'ts/containers/subproviders_documentation'),
+);
analytics.init();
// tslint:disable-next-line:no-floating-promises
@@ -84,6 +87,10 @@ render(
component={LazyJSONSchemasDocumentation}
/>
<Route
+ path={`${WebsitePaths.Subproviders}/:version?`}
+ component={LazySubprovidersDocumentation}
+ />
+ <Route
path={`${WebsitePaths.Web3Wrapper}/:version?`}
component={LazyWeb3WrapperDocumentation}
/>
diff --git a/packages/website/ts/pages/documentation/doc_page.tsx b/packages/website/ts/pages/documentation/doc_page.tsx
index 78ab9dfa9..80c47ea5c 100644
--- a/packages/website/ts/pages/documentation/doc_page.tsx
+++ b/packages/website/ts/pages/documentation/doc_page.tsx
@@ -26,6 +26,7 @@ const docIdToS3FolderName: { [id: string]: string } = {
[DocPackages.Deployer]: 'deployer',
[DocPackages.JSONSchemas]: 'json-schemas',
[DocPackages.SolCov]: 'sol-cov',
+ [DocPackages.Subproviders]: 'subproviders',
};
const docIdToSubpackageName: { [id: string]: string } = {
@@ -36,6 +37,7 @@ const docIdToSubpackageName: { [id: string]: string } = {
[DocPackages.Deployer]: 'deployer',
[DocPackages.JSONSchemas]: 'json-schemas',
[DocPackages.SolCov]: 'sol-cov',
+ [DocPackages.Subproviders]: 'subproviders',
};
export interface DocPageProps {
diff --git a/packages/website/ts/types.ts b/packages/website/ts/types.ts
index b6518110a..262c96c76 100644
--- a/packages/website/ts/types.ts
+++ b/packages/website/ts/types.ts
@@ -359,6 +359,7 @@ export enum WebsitePaths {
Deployer = '/docs/deployer',
JSONSchemas = '/docs/json-schemas',
SolCov = '/docs/sol-cov',
+ Subproviders = '/docs/subproviders',
}
export enum DocPackages {
@@ -369,6 +370,7 @@ export enum DocPackages {
Deployer = 'DEPLOYER',
JSONSchemas = 'JSON_SCHEMAS',
SolCov = 'SOL_COV',
+ Subproviders = 'SUBPROVIDERS',
}
export interface TimestampMsRange {
@@ -453,6 +455,7 @@ export enum Key {
Deployer = 'DEPLOYER',
JsonSchemas = 'JSON_SCHEMAS',
SolCov = 'SOL_COV',
+ Subproviders = 'SUBPROVIDERS',
Blog = 'BLOG',
Forum = 'FORUM',
Connect = 'CONNECT',