aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-04-12 07:56:33 +0800
committerGitHub <noreply@github.com>2018-04-12 07:56:33 +0800
commit5eb90697c824f1c98467cdb6cd71dbb94ff70805 (patch)
treeb5e02ec65e8ae5298761f07eae18df145024bb16
parentc47fb8f9a83d409c092dd7449054fa16cf0fa1c9 (diff)
parentfaedd2fa0b2582ea24ca4624e13ea7466de18408 (diff)
downloaddexon-sol-tools-5eb90697c824f1c98467cdb6cd71dbb94ff70805.tar
dexon-sol-tools-5eb90697c824f1c98467cdb6cd71dbb94ff70805.tar.gz
dexon-sol-tools-5eb90697c824f1c98467cdb6cd71dbb94ff70805.tar.bz2
dexon-sol-tools-5eb90697c824f1c98467cdb6cd71dbb94ff70805.tar.lz
dexon-sol-tools-5eb90697c824f1c98467cdb6cd71dbb94ff70805.tar.xz
dexon-sol-tools-5eb90697c824f1c98467cdb6cd71dbb94ff70805.tar.zst
dexon-sol-tools-5eb90697c824f1c98467cdb6cd71dbb94ff70805.zip
Merge pull request #519 from 0xProject/fix/docImprovements
Doc fixes and improvements
-rw-r--r--README.md2
-rw-r--r--packages/0x.js/CHANGELOG.json2
-rw-r--r--packages/0x.js/README.md2
-rw-r--r--packages/dev-utils/CHANGELOG.json2
-rw-r--r--packages/dev-utils/CHANGELOG.md2
-rw-r--r--packages/react-docs/CHANGELOG.json13
-rw-r--r--packages/react-docs/src/components/documentation.tsx2
-rw-r--r--packages/react-docs/src/components/interface.tsx3
-rw-r--r--packages/react-docs/src/components/signature.tsx2
-rw-r--r--packages/react-docs/src/components/type.tsx1
-rw-r--r--packages/react-docs/src/types.ts1
-rw-r--r--packages/react-docs/src/utils/typedoc_utils.ts11
-rw-r--r--packages/sol-cov/package.json3
-rw-r--r--packages/types/src/index.ts8
-rw-r--r--packages/web3-wrapper/README.md2
-rw-r--r--packages/website/ts/components/top_bar/top_bar.tsx12
-rw-r--r--packages/website/ts/containers/sol_cov_documentation.ts8
-rw-r--r--packages/website/ts/containers/subproviders_documentation.ts12
-rw-r--r--packages/website/ts/containers/web3_wrapper_documentation.ts29
-rw-r--r--packages/website/ts/containers/zero_ex_js_documentation.ts18
-rw-r--r--packages/website/ts/index.tsx13
-rw-r--r--packages/website/ts/pages/documentation/doc_page.tsx8
-rw-r--r--packages/website/ts/types.ts9
-rw-r--r--packages/website/ts/utils/utils.ts8
24 files changed, 121 insertions, 52 deletions
diff --git a/README.md b/README.md
index 770f3440d..d7a1771c2 100644
--- a/README.md
+++ b/README.md
@@ -32,7 +32,7 @@ This repository is a monorepo including the 0x protocol smart contracts and nume
| [`@0xproject/react-docs`](/packages/react-docs) | [![npm](https://img.shields.io/npm/v/@0xproject/react-docs.svg)](https://www.npmjs.com/package/@0xproject/react-docs) | React documentation component for rendering TypeDoc & Doxity generated JSON |
| [`@0xproject/react-shared`](/packages/react-shared) | [![npm](https://img.shields.io/npm/v/@0xproject/react-shared.svg)](https://www.npmjs.com/package/@0xproject/react-shared) | 0x shared react components |
| [`@0xproject/sra-report`](/packages/sra-report) | [![npm](https://img.shields.io/npm/v/@0xproject/sra-report.svg)](https://www.npmjs.com/package/@0xproject/sra-report) | Generate reports for standard relayer API compliance |
-| [`@0xproject/sol-cov`](/packages/sol-cov) | [![npm](https://img.shields.io/npm/v/@0xproject/sol-cov.svg)](https://www.npmjs.com/package/@0xproject/sol-cov) | Solidity test coverage tool tool |
+| [`@0xproject/sol-cov`](/packages/sol-cov) | [![npm](https://img.shields.io/npm/v/@0xproject/sol-cov.svg)](https://www.npmjs.com/package/@0xproject/sol-cov) | Solidity test coverage tool |
| [`@0xproject/subproviders`](/packages/subproviders) | [![npm](https://img.shields.io/npm/v/@0xproject/subproviders.svg)](https://www.npmjs.com/package/@0xproject/subproviders) | Useful web3 subproviders (e.g LedgerSubprovider) |
| [`@0xproject/tslint-config`](/packages/tslint-config) | [![npm](https://img.shields.io/npm/v/@0xproject/tslint-config.svg)](https://www.npmjs.com/package/@0xproject/tslint-config) | Custom 0x development TSLint rules |
| [`@0xproject/types`](/packages/types) | [![npm](https://img.shields.io/npm/v/@0xproject/types.svg)](https://www.npmjs.com/package/@0xproject/types) | Shared type declarations |
diff --git a/packages/0x.js/CHANGELOG.json b/packages/0x.js/CHANGELOG.json
index 6bcfcb73e..9b5c52d00 100644
--- a/packages/0x.js/CHANGELOG.json
+++ b/packages/0x.js/CHANGELOG.json
@@ -14,7 +14,7 @@
"changes": [
{
"note":
- "Removed `ZeroExError.TransactionMiningTimeout` and moved it to '@0xproject/web3_wrapper' `Web3WrapperErrors.TransactionMiningTimeout`",
+ "Removed `ZeroExError.TransactionMiningTimeout` and moved it to '@0xproject/web3-wrapper' `Web3WrapperErrors.TransactionMiningTimeout`",
"pr": 485
}
],
diff --git a/packages/0x.js/README.md b/packages/0x.js/README.md
index cfa353504..72e5cc5fd 100644
--- a/packages/0x.js/README.md
+++ b/packages/0x.js/README.md
@@ -2,7 +2,7 @@
A TypeScript/Javascript library for interacting with the 0x protocol.
-### Read the [Documentation](https://0xproject.com/docs/0xjs).
+### Read the [Documentation](https://0xproject.com/docs/0x.js).
## Installation
diff --git a/packages/dev-utils/CHANGELOG.json b/packages/dev-utils/CHANGELOG.json
index 59169621e..b5dd3732d 100644
--- a/packages/dev-utils/CHANGELOG.json
+++ b/packages/dev-utils/CHANGELOG.json
@@ -33,7 +33,7 @@
"note": "Reduce npm package size by adding an `.npmignore` file."
},
{
- "note": "Move `@0xproject/web3_wrapper` to dependencies from devDependencies."
+ "note": "Move `@0xproject/web3-wrapper` to dependencies from devDependencies."
}
],
"timestamp": 1521298800
diff --git a/packages/dev-utils/CHANGELOG.md b/packages/dev-utils/CHANGELOG.md
index 499ac335f..b63fad04c 100644
--- a/packages/dev-utils/CHANGELOG.md
+++ b/packages/dev-utils/CHANGELOG.md
@@ -20,7 +20,7 @@ CHANGELOG
## v0.3.1 - _March 17, 2018_
* Reduce npm package size by adding an `.npmignore` file.
- * Move `@0xproject/web3_wrapper` to dependencies from devDependencies.
+ * Move `@0xproject/web3-wrapper` to dependencies from devDependencies.
## v0.3.0 - _March 17, 2018_
diff --git a/packages/react-docs/CHANGELOG.json b/packages/react-docs/CHANGELOG.json
index d8655277a..951ed84e0 100644
--- a/packages/react-docs/CHANGELOG.json
+++ b/packages/react-docs/CHANGELOG.json
@@ -1,5 +1,18 @@
[
{
+ "version": "0.0.8",
+ "changes": [
+ {
+ "note": "Added support for rendering default param values",
+ "pr": 519
+ },
+ {
+ "note": "Added support for rendering nested function types within interface types",
+ "pr": 519
+ }
+ ]
+ },
+ {
"timestamp": 1523462196,
"version": "0.0.7",
"changes": [
diff --git a/packages/react-docs/src/components/documentation.tsx b/packages/react-docs/src/components/documentation.tsx
index 14fe175cf..800892dc8 100644
--- a/packages/react-docs/src/components/documentation.tsx
+++ b/packages/react-docs/src/components/documentation.tsx
@@ -337,7 +337,7 @@ export class Documentation extends React.Component<DocumentationProps, Documenta
return (
<div key={`property-${property.name}-${property.type.name}`} className="pb3">
<code className={`hljs ${constants.TYPE_TO_SYNTAX[this.props.docsInfo.type]}`}>
- {property.name}:
+ {property.name}:{' '}
<Type type={property.type} sectionName={sectionName} docsInfo={this.props.docsInfo} />
</code>
{property.source && (
diff --git a/packages/react-docs/src/components/interface.tsx b/packages/react-docs/src/components/interface.tsx
index 541e164e3..bdfdf47c4 100644
--- a/packages/react-docs/src/components/interface.tsx
+++ b/packages/react-docs/src/components/interface.tsx
@@ -19,7 +19,7 @@ export function Interface(props: InterfaceProps) {
return (
<span key={`property-${property.name}-${property.type}-${type.name}`}>
{property.name}:{' '}
- {property.type.typeDocType !== TypeDocTypes.Reflection ? (
+ {property.type && property.type.typeDocType !== TypeDocTypes.Reflection ? (
<Type type={property.type} sectionName={props.sectionName} docsInfo={props.docsInfo} />
) : (
<Signature
@@ -27,7 +27,6 @@ export function Interface(props: InterfaceProps) {
returnType={property.type.method.returnType}
parameters={property.type.method.parameters}
typeParameter={property.type.method.typeParameter}
- callPath={property.type.method.callPath}
sectionName={props.sectionName}
shouldHideMethodName={true}
shouldUseArrowSyntax={true}
diff --git a/packages/react-docs/src/components/signature.tsx b/packages/react-docs/src/components/signature.tsx
index 83fb1e246..1d3c90261 100644
--- a/packages/react-docs/src/components/signature.tsx
+++ b/packages/react-docs/src/components/signature.tsx
@@ -91,6 +91,7 @@ function renderParameters(
) {
const params = _.map(parameters, (p: Parameter) => {
const isOptional = p.isOptional;
+ const hasDefaultValue = !_.isUndefined(p.defaultValue);
const type = (
<Type
type={p.type}
@@ -103,6 +104,7 @@ function renderParameters(
<span key={`param-${p.type}-${p.name}`}>
{p.name}
{isOptional && '?'}: {type}
+ {hasDefaultValue && ` = ${p.defaultValue}`}
</span>
);
});
diff --git a/packages/react-docs/src/components/type.tsx b/packages/react-docs/src/components/type.tsx
index fd4562ce3..2b7b49672 100644
--- a/packages/react-docs/src/components/type.tsx
+++ b/packages/react-docs/src/components/type.tsx
@@ -109,7 +109,6 @@ export function Type(props: TypeProps): any {
returnType={type.method.returnType}
parameters={type.method.parameters}
typeParameter={type.method.typeParameter}
- callPath={type.method.callPath}
sectionName={props.sectionName}
shouldHideMethodName={true}
shouldUseArrowSyntax={true}
diff --git a/packages/react-docs/src/types.ts b/packages/react-docs/src/types.ts
index 2a300c164..3b4a57ad5 100644
--- a/packages/react-docs/src/types.ts
+++ b/packages/react-docs/src/types.ts
@@ -140,6 +140,7 @@ export interface Parameter {
comment: string;
isOptional: boolean;
type: Type;
+ defaultValue?: string;
}
export interface TypeParameter {
diff --git a/packages/react-docs/src/utils/typedoc_utils.ts b/packages/react-docs/src/utils/typedoc_utils.ts
index 02f5b4049..9c89b135a 100644
--- a/packages/react-docs/src/utils/typedoc_utils.ts
+++ b/packages/react-docs/src/utils/typedoc_utils.ts
@@ -14,6 +14,7 @@ import {
Type,
TypeDocNode,
TypeDocType,
+ TypeDocTypes,
TypeParameter,
TypescriptFunction,
TypescriptMethod,
@@ -221,9 +222,16 @@ export const typeDocUtils = {
const childrenIfExist = !_.isUndefined(entity.children)
? _.map(entity.children, (child: TypeDocNode) => {
- const childTypeIfExists = !_.isUndefined(child.type)
+ let childTypeIfExists = !_.isUndefined(child.type)
? typeDocUtils._convertType(child.type, sections, sectionName, docId)
: undefined;
+ if (child.kindString === KindString.Method) {
+ childTypeIfExists = {
+ name: child.name,
+ typeDocType: TypeDocTypes.Reflection,
+ method: this._convertMethod(child, isConstructor, sections, sectionName, docId),
+ };
+ }
const c: CustomTypeChild = {
name: child.name,
type: childTypeIfExists,
@@ -387,6 +395,7 @@ export const typeDocUtils = {
name: entity.name,
comment,
isOptional,
+ defaultValue: entity.defaultValue,
type,
};
return parameter;
diff --git a/packages/sol-cov/package.json b/packages/sol-cov/package.json
index 0eccf099d..f92850db5 100644
--- a/packages/sol-cov/package.json
+++ b/packages/sol-cov/package.json
@@ -24,7 +24,8 @@
"assets": [],
"docPublishConfigs": {
"extraFileIncludes": [
- "../subproviders/src/types.ts"
+ "../subproviders/src/types.ts",
+ "../types/src/index.ts"
],
"s3BucketPath": "s3://doc-jsons/sol-cov/",
"s3StagingBucketPath": "s3://staging-doc-jsons/sol-cov/"
diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts
index 442fbb2d6..044aae3c8 100644
--- a/packages/types/src/index.ts
+++ b/packages/types/src/index.ts
@@ -1,7 +1,13 @@
import { BigNumber } from 'bignumber.js';
+export type JSONRPCErrorCallback = (err: Error | null, result?: JSONRPCResponsePayload) => void;
+
+/**
+ * Do not create your own provider. Use an existing provider from a Web3 or ProviderEngine library
+ * Read more about Providers in the 0x wiki.
+ */
export interface Provider {
- sendAsync(payload: JSONRPCRequestPayload, callback: (err: Error, result: JSONRPCResponsePayload) => void): void;
+ sendAsync(payload: JSONRPCRequestPayload, callback: JSONRPCErrorCallback): void;
}
export type ContractAbi = AbiDefinition[];
diff --git a/packages/web3-wrapper/README.md b/packages/web3-wrapper/README.md
index a38f49e6e..d752a9de0 100644
--- a/packages/web3-wrapper/README.md
+++ b/packages/web3-wrapper/README.md
@@ -2,7 +2,7 @@
Wrapped version of web3 with a nicer interface that is used across 0x projects and packages.
-### Read the [Documentation](https://0xproject.com/docs/web3_wrapper).
+### Read the [Documentation](https://0xproject.com/docs/web3-wrapper).
## Installation
diff --git a/packages/website/ts/components/top_bar/top_bar.tsx b/packages/website/ts/components/top_bar/top_bar.tsx
index 4b2e82119..13351dcdc 100644
--- a/packages/website/ts/components/top_bar/top_bar.tsx
+++ b/packages/website/ts/components/top_bar/top_bar.tsx
@@ -15,7 +15,7 @@ import { TopBarMenuItem } from 'ts/components/top_bar/top_bar_menu_item';
import { DropDown } from 'ts/components/ui/drop_down';
import { Identicon } from 'ts/components/ui/identicon';
import { Dispatcher } from 'ts/redux/dispatcher';
-import { Deco, Key, ProviderType, WebsitePaths } from 'ts/types';
+import { Deco, Key, ProviderType, WebsiteLegacyPaths, WebsitePaths } from 'ts/types';
import { constants } from 'ts/utils/constants';
import { Translate } from 'ts/utils/translate';
@@ -462,7 +462,10 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> {
return _.includes(this.props.location.pathname, WebsitePaths.FAQ);
}
private _isViewing0xjsDocs() {
- return _.includes(this.props.location.pathname, WebsitePaths.ZeroExJs);
+ return (
+ _.includes(this.props.location.pathname, WebsitePaths.ZeroExJs) ||
+ _.includes(this.props.location.pathname, WebsiteLegacyPaths.ZeroExJs)
+ );
}
private _isViewingConnectDocs() {
return _.includes(this.props.location.pathname, WebsitePaths.Connect);
@@ -471,7 +474,10 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> {
return _.includes(this.props.location.pathname, WebsitePaths.SmartContracts);
}
private _isViewingWeb3WrapperDocs() {
- return _.includes(this.props.location.pathname, WebsitePaths.Web3Wrapper);
+ return (
+ _.includes(this.props.location.pathname, WebsitePaths.Web3Wrapper) ||
+ _.includes(this.props.location.pathname, WebsiteLegacyPaths.Web3Wrapper)
+ );
}
private _isViewingDeployerDocs() {
return _.includes(this.props.location.pathname, WebsitePaths.Deployer);
diff --git a/packages/website/ts/containers/sol_cov_documentation.ts b/packages/website/ts/containers/sol_cov_documentation.ts
index 2b901ec6f..58755c1e0 100644
--- a/packages/website/ts/containers/sol_cov_documentation.ts
+++ b/packages/website/ts/containers/sol_cov_documentation.ts
@@ -44,7 +44,7 @@ const docsInfoConfig: DocsInfoConfig = {
},
sectionNameToModulePath: {
[docSections.coverageSubprovider]: ['"sol-cov/src/coverage_subprovider"'],
- [docSections.types]: ['"subproviders/src/types"'],
+ [docSections.types]: ['"subproviders/src/types"', '"types/src/index"'],
},
menuSubsectionToVersionWhenIntroduced: {},
sections: docSections,
@@ -52,11 +52,9 @@ const docsInfoConfig: DocsInfoConfig = {
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: ['NextCallback', 'OnNextCompleted', 'ErrorCallback'],
+ publicTypes: ['NextCallback', 'OnNextCompleted', 'ErrorCallback', 'JSONRPCRequestPayload'],
typeNameToExternalLink: {},
- typeNameToPrefix: {
- JSONRPCRequestPayload: 'Web3',
- },
+ typeNameToPrefix: {},
typeNameToDocSection: {},
},
};
diff --git a/packages/website/ts/containers/subproviders_documentation.ts b/packages/website/ts/containers/subproviders_documentation.ts
index 7aa05f9a5..4a956acea 100644
--- a/packages/website/ts/containers/subproviders_documentation.ts
+++ b/packages/website/ts/containers/subproviders_documentation.ts
@@ -91,25 +91,21 @@ const docsInfoConfig: DocsInfoConfig = {
'ErrorCallback',
'ECSignature',
'JSONRPCRequestPayloadWithMethod',
+ 'JSONRPCRequestPayload',
'JSONRPCResponsePayload',
'AccountFetchingConfigs',
'LedgerEthereumClientFactoryAsync',
'PartialTxParams',
'LedgerEthereumClient',
'LedgerSubproviderConfigs',
+ 'OnNextCompleted',
+ 'Provider',
],
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',
},
+ typeNameToPrefix: {},
},
};
const docsInfo = new DocsInfo(docsInfoConfig);
diff --git a/packages/website/ts/containers/web3_wrapper_documentation.ts b/packages/website/ts/containers/web3_wrapper_documentation.ts
index b0adad536..9c0ca9b9a 100644
--- a/packages/website/ts/containers/web3_wrapper_documentation.ts
+++ b/packages/website/ts/containers/web3_wrapper_documentation.ts
@@ -59,15 +59,36 @@ const docsInfoConfig: DocsInfoConfig = {
'BlockWithoutTransactionData',
'CallData',
'LogEntryEvent',
+ 'Provider',
+ 'AbiDefinition',
+ 'LogTopic',
+ 'JSONRPCRequestPayload',
+ 'JSONRPCResponsePayload',
+ 'BlockParamLiteral',
+ 'FunctionAbi',
+ 'EventAbi',
+ 'JSONRPCErrorCallback',
+ 'MethodAbi',
+ 'ConstructorAbi',
+ 'FallbackAbi',
+ 'EventParameter',
+ 'DataItem',
+ 'StateMutability',
+ 'Function',
+ 'Fallback',
+ 'Constructor',
+ 'Event',
+ 'ConstructorStateMutability',
+ 'TransactionReceiptWithDecodedLogs',
+ 'DecodedLogArgs',
+ 'LogWithDecodedArgs',
+ 'ContractEventArg',
],
typeNameToExternalLink: {
Web3: 'https://github.com/ethereum/wiki/wiki/JavaScript-API',
- Provider: 'https://github.com/0xProject/web3-typescript-typings/blob/f5bcb96/index.d.ts#L150',
BigNumber: 'http://mikemcl.github.io/bignumber.js',
},
- typeNameToPrefix: {
- Provider: 'Web3',
- },
+ typeNameToPrefix: {},
typeNameToDocSection: {
Web3Wrapper: docSections.web3Wrapper,
},
diff --git a/packages/website/ts/containers/zero_ex_js_documentation.ts b/packages/website/ts/containers/zero_ex_js_documentation.ts
index da8922e79..40853cb9e 100644
--- a/packages/website/ts/containers/zero_ex_js_documentation.ts
+++ b/packages/website/ts/containers/zero_ex_js_documentation.ts
@@ -168,21 +168,15 @@ const docsInfoConfig: DocsInfoConfig = {
'OrderStateWatcherConfig',
'FilterObject',
'OrderRelevantState',
+ 'JSONRPCRequestPayload',
+ 'JSONRPCResponsePayload',
+ 'JSONRPCErrorCallback',
+ 'LogEntryEvent',
+ 'LogEntry',
],
- typeNameToPrefix: {
- Provider: 'Web3',
- DecodedLogEntryEvent: 'Web3',
- LogEntryEvent: 'Web3',
- CallData: 'Web3',
- LogEntry: 'Web3',
- },
+ typeNameToPrefix: {},
typeNameToExternalLink: {
- Web3: constants.URL_WEB3_DOCS,
- Provider: constants.URL_WEB3_PROVIDER_DOCS,
BigNumber: constants.URL_BIGNUMBERJS_GITHUB,
- DecodedLogEntryEvent: constants.URL_WEB3_DECODED_LOG_ENTRY_EVENT,
- LogEntryEvent: constants.URL_WEB3_LOG_ENTRY_EVENT,
- LogEntry: 'https://github.com/0xProject/web3-typescript-typings/blob/f5bcb96/index.d.ts#L366',
},
typeNameToDocSection: {
ExchangeWrapper: 'exchange',
diff --git a/packages/website/ts/index.tsx b/packages/website/ts/index.tsx
index d542bd804..5bc36da32 100644
--- a/packages/website/ts/index.tsx
+++ b/packages/website/ts/index.tsx
@@ -15,7 +15,7 @@ import { createLazyComponent } from 'ts/lazy_component';
import { trackedTokenStorage } from 'ts/local_storage/tracked_token_storage';
import { tradeHistoryStorage } from 'ts/local_storage/trade_history_storage';
import { reducer, State } from 'ts/redux/reducer';
-import { WebsitePaths } from 'ts/types';
+import { WebsiteLegacyPaths, WebsitePaths } from 'ts/types';
import { analytics } from 'ts/utils/analytics';
import { muiTheme } from 'ts/utils/mui_theme';
import { utils } from 'ts/utils/utils';
@@ -98,6 +98,17 @@ render(
path={`${WebsitePaths.SmartContracts}/:version?`}
component={LazySmartContractsDocumentation}
/>
+
+ {/* Legacy endpoints */}
+ <Route
+ path={`${WebsiteLegacyPaths.ZeroExJs}/:version?`}
+ component={LazyZeroExJSDocumentation}
+ />
+ <Route
+ path={`${WebsiteLegacyPaths.Web3Wrapper}/:version?`}
+ component={LazyWeb3WrapperDocumentation}
+ />
+
<Route component={NotFound as any} />
</Switch>
</div>
diff --git a/packages/website/ts/pages/documentation/doc_page.tsx b/packages/website/ts/pages/documentation/doc_page.tsx
index 8ec1a023d..aca20447b 100644
--- a/packages/website/ts/pages/documentation/doc_page.tsx
+++ b/packages/website/ts/pages/documentation/doc_page.tsx
@@ -8,14 +8,14 @@ import semverSort = require('semver-sort');
import { SidebarHeader } from 'ts/components/sidebar_header';
import { TopBar } from 'ts/components/top_bar/top_bar';
import { Dispatcher } from 'ts/redux/dispatcher';
-import { DocPackages, Environments } from 'ts/types';
+import { DocPackages } from 'ts/types';
import { configs } from 'ts/utils/configs';
import { constants } from 'ts/utils/constants';
import { docUtils } from 'ts/utils/doc_utils';
import { Translate } from 'ts/utils/translate';
import { utils } from 'ts/utils/utils';
-const isDevelopment = configs.ENVIRONMENT === Environments.DEVELOPMENT;
+const isDevelopmentOrStaging = utils.isDevelopment() || utils.isStaging();
const DEFAULT_ICON = 'docs.png';
const ZERO_EX_JS_VERSION_MISSING_TOPLEVEL_PATH = '0.32.4';
@@ -106,7 +106,9 @@ export class DocPage extends React.Component<DocPageProps, DocPageState> {
}
private async _fetchJSONDocsFireAndForgetAsync(preferredVersionIfExists?: string): Promise<void> {
const folderName = docIdToSubpackageName[this.props.docsInfo.id];
- const docBucketRoot = isDevelopment ? constants.S3_STAGING_DOC_BUCKET_ROOT : constants.S3_DOC_BUCKET_ROOT;
+ const docBucketRoot = isDevelopmentOrStaging
+ ? constants.S3_STAGING_DOC_BUCKET_ROOT
+ : constants.S3_DOC_BUCKET_ROOT;
const versionToFilePath = await docUtils.getVersionToFilePathAsync(docBucketRoot, folderName);
const versions = _.keys(versionToFilePath);
this.props.dispatcher.updateAvailableDocVersions(versions);
diff --git a/packages/website/ts/types.ts b/packages/website/ts/types.ts
index dba59f704..c03e5676f 100644
--- a/packages/website/ts/types.ts
+++ b/packages/website/ts/types.ts
@@ -341,17 +341,22 @@ export enum Docs {
SmartContracts,
}
+export enum WebsiteLegacyPaths {
+ ZeroExJs = '/docs/0xjs',
+ Web3Wrapper = '/docs/web3_wrapper',
+}
+
export enum WebsitePaths {
Portal = '/portal',
Wiki = '/wiki',
- ZeroExJs = '/docs/0xjs',
+ ZeroExJs = '/docs/0x.js',
Home = '/',
FAQ = '/faq',
About = '/about',
Whitepaper = '/pdfs/0x_white_paper.pdf',
SmartContracts = '/docs/contracts',
Connect = '/docs/connect',
- Web3Wrapper = '/docs/web3_wrapper',
+ Web3Wrapper = '/docs/web3-wrapper',
Deployer = '/docs/deployer',
JSONSchemas = '/docs/json-schemas',
SolCov = '/docs/sol-cov',
diff --git a/packages/website/ts/utils/utils.ts b/packages/website/ts/utils/utils.ts
index afe159beb..53d60b3ce 100644
--- a/packages/website/ts/utils/utils.ts
+++ b/packages/website/ts/utils/utils.ts
@@ -5,7 +5,7 @@ import { BigNumber } from '@0xproject/utils';
import deepEqual = require('deep-equal');
import * as _ from 'lodash';
import * as moment from 'moment';
-import { Order, Providers, ScreenWidths, Side, SideToAssetToken, Token, TokenByAddress } from 'ts/types';
+import { Environments, Order, Providers, ScreenWidths, Side, SideToAssetToken, Token, TokenByAddress } from 'ts/types';
import { configs } from 'ts/utils/configs';
import { constants } from 'ts/utils/constants';
import * as u2f from 'ts/vendor/u2f_api';
@@ -292,4 +292,10 @@ export const utils = {
}
return parsedProviderName;
},
+ isDevelopment() {
+ return configs.ENVIRONMENT === Environments.DEVELOPMENT;
+ },
+ isStaging() {
+ return _.includes(window.location.href, configs.DOMAIN_STAGING);
+ },
};