Start refactoring docs to remove unnecessary configs given more concise TypeDoc JSON

This commit is contained in:
Fabio Berger
2018-08-01 17:36:37 +02:00
parent 11869122b4
commit 3bdf6004ca
23 changed files with 274 additions and 630 deletions

View File

@@ -40,42 +40,12 @@ const docsInfoConfig: DocsInfoConfig = {
[connectDocSections.installation]: InstallationMarkdownV1,
},
},
sectionNameToModulePath: {
[connectDocSections.httpClient]: ['"src/http_client"'],
[connectDocSections.webSocketOrderbookChannel]: ['"src/ws_orderbook_channel"'],
[connectDocSections.types]: ['"src/types"', '"types/src/index"'],
},
menuSubsectionToVersionWhenIntroduced: {},
sections: connectDocSections,
visibleConstructors: [connectDocSections.httpClient, connectDocSections.webSocketOrderbookChannel],
typeConfigs: {
typeNameToExternalLink: {
Provider: constants.URL_WEB3_PROVIDER_DOCS,
BigNumber: constants.URL_BIGNUMBERJS_GITHUB,
},
// 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: [
'Client',
'FeesRequest',
'FeesResponse',
'OrderbookChannel',
'OrderbookChannelHandler',
'OrderbookChannelSubscriptionOpts',
'OrderbookRequest',
'OrderbookResponse',
'OrdersRequest',
'OrdersRequestOpts',
'PagedRequestOpts',
'TokenPairsItem',
'TokenPairsRequest',
'TokenPairsRequestOpts',
'TokenTradeInfo',
'WebSocketOrderbookChannelConfig',
'Order',
'SignedOrder',
'ECSignature',
],
},
};
const docsInfo = new DocsInfo(docsInfoConfig);

View File

@@ -36,60 +36,8 @@ const docsInfoConfig: DocsInfoConfig = {
[docSections.installation]: InstallationMarkdown,
},
},
sectionNameToModulePath: {
[docSections.types]: ['"index"'],
},
visibleConstructors: [],
menuSubsectionToVersionWhenIntroduced: {},
sections: docSections,
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: [
'Provider',
'JSONRPCErrorCallback',
'Provider',
'ContractAbi',
'AbiDefinition',
'FunctionAbi',
'ConstructorStateMutability',
'StateMutability',
'MethodAbi',
'ConstructorAbi',
'FallbackAbi',
'EventParameter',
'EventAbi',
'DataItem',
'OpCode',
// 'StructLog', // TODO: This type breaks the docs so we don't render it for now
'TransactionTrace',
'Unit',
'JSONRPCRequestPayload',
'JSONRPCResponsePayload',
'BlockWithoutTransactionData',
'BlockWithTransactionData',
'Transaction',
'TxData',
'CallData',
'FilterObject',
'LogTopic',
'DecodedLogEntry',
'DecodedLogEntryEvent',
'LogEntryEvent',
'LogEntry',
'TxDataPayable',
'TransactionReceipt',
'AbiType',
'ContractEventArg',
'DecodedLogArgs',
'LogWithDecodedArgs',
'RawLog',
'BlockParamLiteral',
'BlockParam',
'RawLogEntry',
'SolidityTypes',
'TransactionReceiptWithDecodedLogs',
],
typeNameToExternalLink: {
BigNumber: constants.URL_BIGNUMBERJS_GITHUB,
},

View File

@@ -43,16 +43,8 @@ const docsInfoConfig: DocsInfoConfig = {
[docSections.usage]: UsageMarkdownV1,
},
},
sectionNameToModulePath: {
[docSections.schemaValidator]: ['"json-schemas/src/schema_validator"'],
},
menuSubsectionToVersionWhenIntroduced: {},
sections: docSections,
visibleConstructors: [docSections.schemaValidator],
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: [],
typeNameToExternalLink: {
Schema:
'https://github.com/tdegrunt/jsonschema/blob/5c2edd4baba149964aec0f23c87ad12c25a50dfb/lib/index.d.ts#L49',

View File

@@ -38,33 +38,8 @@ const docsInfoConfig: DocsInfoConfig = {
[docSections.installation]: InstallationMarkdownV1,
},
},
sectionNameToModulePath: {
[docSections.usage]: [
'"order-utils/src/order_hash"',
'"order-utils/src/signature_utils"',
'"order-utils/src/order_factory"',
'"order-utils/src/salt"',
'"order-utils/src/assert"',
'"order-utils/src/constants"',
],
[docSections.types]: ['"order-utils/src/types"', '"types/src/index"'],
},
menuSubsectionToVersionWhenIntroduced: {},
sections: docSections,
visibleConstructors: [],
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: [
'OrderError',
'Order',
'SignedOrder',
'ECSignature',
'Provider',
'JSONRPCRequestPayload',
'JSONRPCResponsePayload',
'JSONRPCErrorCallback',
],
typeNameToExternalLink: {
BigNumber: constants.URL_BIGNUMBERJS_GITHUB,
},

View File

@@ -34,7 +34,6 @@ const docsInfoConfig: DocsInfoConfig = {
TokenRegistry: Sections.TokenRegistry,
ZRXToken: Sections.ZRXToken,
},
visibleConstructors: [Sections.Exchange, Sections.TokenRegistry, Sections.ZRXToken, Sections.TokenTransferProxy],
contractsByVersionByNetworkId: {
'1.0.0': {
[Networks.Mainnet]: {

View File

@@ -41,17 +41,8 @@ const docsInfoConfig: DocsInfoConfig = {
[docSections.usage]: UsageMarkdown,
},
},
sectionNameToModulePath: {
[docSections.compiler]: ['"sol-compiler/src/compiler"'],
[docSections.types]: ['"sol-compiler/src/utils/types"', '"types/src/index"'],
},
menuSubsectionToVersionWhenIntroduced: {},
sections: docSections,
visibleConstructors: [docSections.compiler],
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: ['CompilerOptions'],
typeNameToExternalLink: {},
typeNameToPrefix: {},
},

View File

@@ -47,42 +47,10 @@ const docsInfoConfig: DocsInfoConfig = {
[docSections.usage]: UsageMarkdown,
},
},
sectionNameToModulePath: {
[docSections.coverageSubprovider]: ['"sol-cov/src/coverage_subprovider"'],
[docSections.abstractArtifactAdapter]: ['"sol-cov/src/artifact_adapters/abstract_artifact_adapter"'],
[docSections.solCompilerArtifactAdapter]: ['"sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter"'],
[docSections.truffleArtifactAdapter]: ['"sol-cov/src/artifact_adapters/truffle_artifact_adapter"'],
[docSections.types]: ['"subproviders/src/types"', '"types/src/index"'],
},
menuSubsectionToVersionWhenIntroduced: {},
sections: docSections,
visibleConstructors: [
docSections.coverageSubprovider,
docSections.abstractArtifactAdapter,
docSections.solCompilerArtifactAdapter,
docSections.truffleArtifactAdapter,
],
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: [
'JSONRPCRequestPayload',
'NextCallback',
'ErrorCallback',
'AbstractArtifactAdapter',
'CoverageSubprovider',
'TruffleArtifactAdapter',
'SolCompilerArtifactAdapter',
'ContractData',
],
typeNameToExternalLink: {},
typeNameToPrefix: {},
typeNameToDocSection: {
AbstractArtifactAdapter: docSections.abstractArtifactAdapter,
CoverageSubprovider: docSections.coverageSubprovider,
TruffleArtifactAdapter: docSections.truffleArtifactAdapter,
SolCompilerArtifactAdapter: docSections.solCompilerArtifactAdapter,
},
},
};
const docsInfo = new DocsInfo(docsInfoConfig);

View File

@@ -64,55 +64,8 @@ const docsInfoConfig: DocsInfoConfig = {
[docSections.ledgerNodeHid]: LedgerNodeHidMarkdown,
},
},
sectionNameToModulePath: {
[docSections.subprovider]: ['"subproviders/src/subproviders/subprovider"'],
[docSections.ledgerSubprovider]: ['"subproviders/src/subproviders/ledger"'],
[docSections.privateKeyWalletSubprovider]: ['"subproviders/src/subproviders/private_key_wallet"'],
[docSections.mnemonicWalletSubprovider]: ['"subproviders/src/subproviders/mnemonic_wallet"'],
[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.signerSubprovider]: ['"subproviders/src/subproviders/signer"'],
[docSections.redundantRPCSubprovider]: ['"subproviders/src/subproviders/redundant_rpc"'],
[docSections.ganacheSubprovider]: ['"subproviders/src/subproviders/ganache"'],
[docSections.nonceTrackerSubprovider]: ['"subproviders/src/subproviders/nonce_tracker"'],
[docSections.types]: ['"sol-compiler/src/utils/types"', '"types/src/index"', '"subproviders/src/types"'],
},
menuSubsectionToVersionWhenIntroduced: {},
sections: docSections,
visibleConstructors: [
docSections.subprovider,
docSections.ledgerSubprovider,
docSections.privateKeyWalletSubprovider,
docSections.mnemonicWalletSubprovider,
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',
'JSONRPCRequestPayload',
'JSONRPCResponsePayload',
'AccountFetchingConfigs',
'LedgerEthereumClientFactoryAsync',
'PartialTxParams',
'LedgerEthereumClient',
'LedgerSubproviderConfigs',
'MnemonicWalletSubproviderConfigs',
'OnNextCompleted',
'Provider',
],
typeNameToExternalLink: {
Web3: constants.URL_WEB3_DOCS,
BigNumber: constants.URL_BIGNUMBERJS_GITHUB,

View File

@@ -38,60 +38,13 @@ const docsInfoConfig: DocsInfoConfig = {
[docSections.installation]: InstallationMarkdownV1,
},
},
sectionNameToModulePath: {
[docSections.web3Wrapper]: ['"web3-wrapper/src/web3_wrapper"'],
[docSections.types]: ['"types/src/index"'],
},
menuSubsectionToVersionWhenIntroduced: {},
sections: docSections,
visibleConstructors: [docSections.web3Wrapper],
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: [
'TxData',
'TransactionReceipt',
'RawLogEntry',
'ContractAbi',
'BlockParam',
'FilterObject',
'LogEntry',
'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: constants.URL_WEB3_DOCS,
BigNumber: constants.URL_BIGNUMBERJS_GITHUB,
},
typeNameToPrefix: {},
typeNameToDocSection: {
Web3Wrapper: docSections.web3Wrapper,
},
},
};
const docsInfo = new DocsInfo(docsInfoConfig);

View File

@@ -27,14 +27,6 @@ const zeroExJsDocSections = {
async: 'async',
errors: 'errors',
versioning: 'versioning',
zeroEx: 'zeroEx',
exchange: 'exchange',
token: 'token',
tokenRegistry: 'tokenRegistry',
etherToken: 'etherToken',
proxy: 'proxy',
orderWatcher: 'orderWatcher',
types: docConstants.TYPES_SECTION_NAME,
};
const docsInfoConfig: DocsInfoConfig = {
@@ -46,16 +38,6 @@ const docsInfoConfig: DocsInfoConfig = {
introduction: [zeroExJsDocSections.introduction],
install: [zeroExJsDocSections.installation],
topics: [zeroExJsDocSections.async, zeroExJsDocSections.errors, zeroExJsDocSections.versioning],
zeroEx: [zeroExJsDocSections.zeroEx],
contracts: [
zeroExJsDocSections.exchange,
zeroExJsDocSections.token,
zeroExJsDocSections.tokenRegistry,
zeroExJsDocSections.etherToken,
zeroExJsDocSections.proxy,
],
orderWatcher: [zeroExJsDocSections.orderWatcher],
types: [zeroExJsDocSections.types],
},
sectionNameToMarkdownByVersion: {
'0.0.1': {
@@ -74,166 +56,12 @@ const docsInfoConfig: DocsInfoConfig = {
[zeroExJsDocSections.errors]: ErrorsMarkdownV1,
},
},
sectionNameToModulePath: {
[zeroExJsDocSections.zeroEx]: ['"0x.js/src/0x"', '"src/0x"'],
[zeroExJsDocSections.exchange]: [
'"0x.js/src/contract_wrappers/exchange_wrapper"',
'"src/contract_wrappers/exchange_wrapper"',
'"contract-wrappers/src/contract_wrappers/exchange_wrapper"',
],
[zeroExJsDocSections.tokenRegistry]: [
'"0x.js/src/contract_wrappers/token_registry_wrapper"',
'"src/contract_wrappers/token_registry_wrapper"',
'"contract-wrappers/src/contract_wrappers/token_registry_wrapper"',
],
[zeroExJsDocSections.token]: [
'"0x.js/src/contract_wrappers/token_wrapper"',
'"src/contract_wrappers/token_wrapper"',
'"contract-wrappers/src/contract_wrappers/token_wrapper"',
],
[zeroExJsDocSections.etherToken]: [
'"0x.js/src/contract_wrappers/ether_token_wrapper"',
'"src/contract_wrappers/ether_token_wrapper"',
'"contract-wrappers/src/contract_wrappers/ether_token_wrapper"',
],
[zeroExJsDocSections.proxy]: [
'"0x.js/src/contract_wrappers/proxy_wrapper"',
'"0x.js/src/contract_wrappers/token_transfer_proxy_wrapper"',
'"contract-wrappers/src/contract_wrappers/token_transfer_proxy_wrapper"',
],
[zeroExJsDocSections.orderWatcher]: [
'"0x.js/src/order_watcher/order_state_watcher"',
'"src/order_watcher/order_state_watcher"',
'"order-watcher/src/order_watcher/order_watcher"',
],
[zeroExJsDocSections.types]: [
'"0x.js/src/types"',
'"src/types"',
'"types/src/index"',
'"contract-wrappers/src/types"',
'"0x.js/src/contract_wrappers/generated/ether_token"',
'"0x.js/src/contract_wrappers/generated/token"',
'"0x.js/src/contract_wrappers/generated/exchange"',
'"0x.js/src/generated_contract_wrappers/ether_token"',
'"0x.js/src/generated_contract_wrappers/token"',
'"0x.js/src/generated_contract_wrappers/exchange"',
],
},
menuSubsectionToVersionWhenIntroduced: {
[zeroExJsDocSections.etherToken]: '0.7.1',
[zeroExJsDocSections.proxy]: '0.8.0',
[zeroExJsDocSections.orderWatcher]: '0.27.1',
},
sections: zeroExJsDocSections,
visibleConstructors: [zeroExJsDocSections.zeroEx],
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 :( Make sure to only
// ADD types here, DO NOT REMOVE types since they might still be needed for older supported versions
publicTypes: [
'Order',
'SignedOrder',
'ECSignature',
'ContractWrappersError',
'EventCallback',
'EventCallbackAsync',
'EventCallbackSync',
'ExchangeContractErrs',
'ContractEvent',
'Token',
'Provider',
'ExchangeEvents',
'IndexedFilterValues',
'SubscriptionOpts',
'BlockRange',
'BlockParam',
'OrderFillOrKillRequest',
'OrderCancellationRequest',
'OrderFillRequest',
'ContractEventEmitter',
'Web3Provider',
'ContractEventArgs',
'LogCancelArgs',
'LogFillArgs',
'LogErrorContractEventArgs',
'LogFillContractEventArgs',
'LogCancelContractEventArgs',
'EtherTokenContractEventArgs',
'WithdrawalContractEventArgs',
'DepositContractEventArgs',
'TokenEvents',
'ExchangeContractEventArgs',
'TransferContractEventArgs',
'ApprovalContractEventArgs',
'TokenContractEventArgs',
'ZeroExConfig',
'TransactionReceipt',
'TransactionReceiptWithDecodedLogs',
'LogWithDecodedArgs',
'EtherTokenEvents',
'BlockParamLiteral',
'DecodedLogArgs',
'MethodOpts',
'ValidateOrderFillableOpts',
'OrderTransactionOpts',
'TransactionOpts',
'ContractEventArg',
'LogEvent',
'DecodedLogEvent',
'EventWatcherCallback',
'OnOrderStateChangeCallback',
'OrderStateValid',
'OrderStateInvalid',
'OrderState',
'OrderStateWatcherConfig',
'OrderWatcherConfig',
'FilterObject',
'OrderRelevantState',
'JSONRPCRequestPayload',
'JSONRPCResponsePayload',
'JSONRPCErrorCallback',
'LogEntryEvent',
'LogEntry',
'ERC20AssetData',
'ERC721AssetData',
'AssetProxyId',
'WETH9Events',
'WETH9WithdrawalEventArgs',
'WETH9ApprovalEventArgs',
'WETH9EventArgs',
'WETH9DepositEventArgs',
'WETH9TransferEventArgs',
'ERC20TokenTransferEventArgs',
'ERC20TokenApprovalEventArgs',
'ERC20TokenEvents',
'ERC20TokenEventArgs',
'ERC721TokenApprovalEventArgs',
'ERC721TokenApprovalForAllEventArgs',
'ERC721TokenTransferEventArgs',
'ERC721TokenEvents',
'ExchangeCancelUpToEventArgs',
'ExchangeAssetProxyRegisteredEventArgs',
'ExchangeFillEventArgs',
'ExchangeCancelEventArgs',
'ExchangeEventArgs',
'ContractWrappersConfig',
'MessagePrefixType',
'MessagePrefixOpts',
'OrderInfo',
],
typeNameToPrefix: {},
typeNameToExternalLink: {
BigNumber: constants.URL_BIGNUMBERJS_GITHUB,
},
typeNameToDocSection: {
ExchangeWrapper: 'exchange',
TokenWrapper: 'token',
TokenRegistryWrapper: 'tokenRegistry',
EtherTokenWrapper: 'etherToken',
ProxyWrapper: 'proxy',
TokenTransferProxyWrapper: 'proxy',
OrderStateWatcher: 'orderWatcher',
},
},
};
const docsInfo = new DocsInfo(docsInfoConfig);

View File

@@ -84,7 +84,7 @@ export class DocPage extends React.Component<DocPageProps, DocPageState> {
location={this.props.location}
docsVersion={this.props.docsVersion}
availableDocVersions={this.props.availableDocVersions}
menu={this.props.docsInfo.getMenu(this.props.docsVersion)}
menu={this.props.docsInfo.menu}
menuSubsectionsBySection={menuSubsectionsBySection}
docsInfo={this.props.docsInfo}
translate={this.props.translate}

View File

@@ -1,4 +1,4 @@
import { DoxityDocObj, TypeDocNode } from '@0xproject/react-docs';
import { DoxityDocObj, GeneratedDocJson } from '@0xproject/react-docs';
import { fetchAsync, logUtils } from '@0xproject/utils';
import * as _ from 'lodash';
import { S3FileObject, VersionToFilePath } from 'ts/types';
@@ -70,7 +70,7 @@ export const docUtils = {
});
return versionFilePaths;
},
async getJSONDocFileAsync(filePath: string, s3DocJsonRoot: string): Promise<TypeDocNode | DoxityDocObj> {
async getJSONDocFileAsync(filePath: string, s3DocJsonRoot: string): Promise<GeneratedDocJson | DoxityDocObj> {
const endpoint = `${s3DocJsonRoot}/${filePath}`;
const response = await fetchAsync(endpoint);
if (response.status !== 200) {