Add Subprovider docs to website
This commit is contained in:
@@ -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"
|
||||
},
|
||||
|
8
packages/subproviders/src/monorepo_scripts/stagedocs.ts
Normal file
8
packages/subproviders/src/monorepo_scripts/stagedocs.ts
Normal file
@@ -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);
|
15
packages/website/md/docs/subproviders/installation.md
Normal file
15
packages/website/md/docs/subproviders/installation.md
Normal file
@@ -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;
|
||||
```
|
1
packages/website/md/docs/subproviders/introduction.md
Normal file
1
packages/website/md/docs/subproviders/introduction.md
Normal file
@@ -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.
|
@@ -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 连接",
|
||||
|
@@ -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",
|
||||
|
@@ -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",
|
||||
|
@@ -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",
|
||||
|
@@ -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",
|
||||
|
@@ -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',
|
||||
|
@@ -120,6 +120,18 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> {
|
||||
primaryText={this.props.translate.get(Key.StandardRelayerApi, Deco.CapWords)}
|
||||
/>
|
||||
</a>,
|
||||
<Link key="subMenuItem-jsonSchema" to={WebsitePaths.JSONSchemas} className="text-decoration-none">
|
||||
<MenuItem
|
||||
style={{ fontSize: styles.menuItem.fontSize }}
|
||||
primaryText={this.props.translate.get(Key.JsonSchemas, Deco.CapWords)}
|
||||
/>
|
||||
</Link>,
|
||||
<Link key="subMenuItem-subproviders" to={WebsitePaths.Subproviders} className="text-decoration-none">
|
||||
<MenuItem
|
||||
style={{ fontSize: styles.menuItem.fontSize }}
|
||||
primaryText={this.props.translate.get(Key.Subproviders, Deco.CapWords)}
|
||||
/>
|
||||
</Link>,
|
||||
<Link key="subMenuItem-web3Wrapper" to={WebsitePaths.Web3Wrapper} className="text-decoration-none">
|
||||
<MenuItem
|
||||
style={{ fontSize: styles.menuItem.fontSize }}
|
||||
@@ -132,12 +144,6 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> {
|
||||
primaryText={this.props.translate.get(Key.Deployer, Deco.CapWords)}
|
||||
/>
|
||||
</Link>,
|
||||
<Link key="subMenuItem-jsonSchema" to={WebsitePaths.JSONSchemas} className="text-decoration-none">
|
||||
<MenuItem
|
||||
style={{ fontSize: styles.menuItem.fontSize }}
|
||||
primaryText={this.props.translate.get(Key.JsonSchemas, Deco.CapWords)}
|
||||
/>
|
||||
</Link>,
|
||||
<Link key="subMenuItem-sol-cov" to={WebsitePaths.SolCov} className="text-decoration-none">
|
||||
<MenuItem
|
||||
style={{ fontSize: styles.menuItem.fontSize }}
|
||||
@@ -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
|
||||
|
137
packages/website/ts/containers/subproviders_documentation.ts
Normal file
137
packages/website/ts/containers/subproviders_documentation.ts
Normal file
@@ -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,
|
||||
);
|
@@ -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
|
||||
@@ -83,6 +86,10 @@ render(
|
||||
path={`${WebsitePaths.JSONSchemas}/:version?`}
|
||||
component={LazyJSONSchemasDocumentation}
|
||||
/>
|
||||
<Route
|
||||
path={`${WebsitePaths.Subproviders}/:version?`}
|
||||
component={LazySubprovidersDocumentation}
|
||||
/>
|
||||
<Route
|
||||
path={`${WebsitePaths.Web3Wrapper}/:version?`}
|
||||
component={LazyWeb3WrapperDocumentation}
|
||||
|
@@ -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 {
|
||||
|
@@ -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',
|
||||
|
Reference in New Issue
Block a user