Prefix menu and sections with markdown as that is all the should now be defined

This commit is contained in:
Fabio Berger 2018-08-01 21:00:45 +02:00
parent e5b93d1f02
commit 2494af99aa
12 changed files with 85 additions and 130 deletions

View File

@ -28,21 +28,16 @@ export class DocsInfo {
public sectionNameToMarkdownByVersion: SectionNameToMarkdownByVersion;
public contractsByVersionByNetworkId?: ContractsByVersionByNetworkId;
public typeConfigs: DocsInfoTypeConfigs;
private readonly _docsInfo: DocsInfoConfig;
constructor(config: DocsInfoConfig) {
this.id = config.id;
this.type = config.type;
this.menu = config.menu;
this.menu = config.markdownMenu;
this.displayName = config.displayName;
this.packageUrl = config.packageUrl;
this.sections = config.sections;
this.sections = config.markdownSections;
this.sectionNameToMarkdownByVersion = config.sectionNameToMarkdownByVersion;
this.contractsByVersionByNetworkId = config.contractsByVersionByNetworkId;
this.typeConfigs = config.typeConfigs;
this._docsInfo = config;
}
public getMenu(selectedVersion?: string): { [section: string]: string[] } {
return this._docsInfo.menu;
}
public getMenuSubsectionsBySection(docAgnosticFormat?: DocAgnosticFormat): MenuSubsectionsBySection {
const menuSubsectionsBySection = {} as MenuSubsectionsBySection;

View File

@ -7,8 +7,8 @@ export interface DocsInfoConfig {
type: SupportedDocJson;
displayName: string;
packageUrl: string;
menu: DocsMenu;
sections: SectionsMap;
markdownMenu: DocsMenu;
markdownSections: SectionsMap;
sectionNameToMarkdownByVersion: SectionNameToMarkdownByVersion;
contractsByVersionByNetworkId?: ContractsByVersionByNetworkId;
typeConfigs?: DocsInfoTypeConfigs;

View File

@ -14,7 +14,7 @@ const IntroMarkdownV1 = require('md/docs/connect/1.0.0/introduction');
const InstallationMarkdownV1 = require('md/docs/connect/1.0.0/installation');
/* tslint:enable:no-var-requires */
const connectDocSections = {
const markdownSections = {
introduction: 'introduction',
installation: 'installation',
httpClient: 'httpClient',
@ -27,20 +27,20 @@ const docsInfoConfig: DocsInfoConfig = {
type: SupportedDocJson.TypeDoc,
displayName: '0x Connect',
packageUrl: 'https://github.com/0xProject/0x-monorepo',
menu: {
introduction: [connectDocSections.introduction],
install: [connectDocSections.installation],
httpClient: [connectDocSections.httpClient],
webSocketOrderbookChannel: [connectDocSections.webSocketOrderbookChannel],
types: [connectDocSections.types],
markdownMenu: {
introduction: [markdownSections.introduction],
install: [markdownSections.installation],
httpClient: [markdownSections.httpClient],
webSocketOrderbookChannel: [markdownSections.webSocketOrderbookChannel],
types: [markdownSections.types],
},
sectionNameToMarkdownByVersion: {
'0.0.1': {
[connectDocSections.introduction]: IntroMarkdownV1,
[connectDocSections.installation]: InstallationMarkdownV1,
[markdownSections.introduction]: IntroMarkdownV1,
[markdownSections.installation]: InstallationMarkdownV1,
},
},
sections: connectDocSections,
markdownSections: markdownSections,
typeConfigs: {
typeNameToExternalLink: {
Provider: constants.URL_WEB3_PROVIDER_DOCS,

View File

@ -14,7 +14,7 @@ const IntroMarkdown = require('md/docs/ethereum_types/introduction');
const InstallationMarkdown = require('md/docs/ethereum_types/installation');
/* tslint:enable:no-var-requires */
const docSections = {
const markdownSections = {
introduction: 'introduction',
installation: 'installation',
types: docConstants.TYPES_SECTION_NAME,
@ -25,18 +25,18 @@ const docsInfoConfig: DocsInfoConfig = {
type: SupportedDocJson.TypeDoc,
displayName: 'Ethereum Types',
packageUrl: 'https://github.com/0xProject/0x-monorepo/packages/ethereum-types',
menu: {
introduction: [docSections.introduction],
install: [docSections.installation],
types: [docSections.types],
markdownMenu: {
introduction: [markdownSections.introduction],
install: [markdownSections.installation],
types: [markdownSections.types],
},
sectionNameToMarkdownByVersion: {
'0.0.1': {
[docSections.introduction]: IntroMarkdown,
[docSections.installation]: InstallationMarkdown,
[markdownSections.introduction]: IntroMarkdown,
[markdownSections.installation]: InstallationMarkdown,
},
},
sections: docSections,
markdownSections: markdownSections,
typeConfigs: {
typeNameToExternalLink: {
BigNumber: constants.URL_BIGNUMBERJS_GITHUB,

View File

@ -15,7 +15,7 @@ const UsageMarkdownV1 = require('md/docs/json_schemas/1.0.0/usage');
const SchemasMarkdownV1 = require('md/docs/json_schemas/1.0.0/schemas');
/* tslint:enable:no-var-requires */
const docSections = {
const markdownSections = {
introduction: 'introduction',
installation: 'installation',
usage: 'usage',
@ -28,22 +28,22 @@ const docsInfoConfig: DocsInfoConfig = {
type: SupportedDocJson.TypeDoc,
displayName: 'JSON Schemas',
packageUrl: 'https://github.com/0xProject/0x-monorepo',
menu: {
introduction: [docSections.introduction],
install: [docSections.installation],
usage: [docSections.usage],
schemaValidator: [docSections.schemaValidator],
schemas: [docSections.schemas],
markdownMenu: {
introduction: [markdownSections.introduction],
install: [markdownSections.installation],
usage: [markdownSections.usage],
schemaValidator: [markdownSections.schemaValidator],
schemas: [markdownSections.schemas],
},
sectionNameToMarkdownByVersion: {
'0.0.1': {
[docSections.introduction]: IntroMarkdownV1,
[docSections.installation]: InstallationMarkdownV1,
[docSections.schemas]: SchemasMarkdownV1,
[docSections.usage]: UsageMarkdownV1,
[markdownSections.introduction]: IntroMarkdownV1,
[markdownSections.installation]: InstallationMarkdownV1,
[markdownSections.schemas]: SchemasMarkdownV1,
[markdownSections.usage]: UsageMarkdownV1,
},
},
sections: docSections,
markdownSections: markdownSections,
typeConfigs: {
typeNameToExternalLink: {
Schema:

View File

@ -14,7 +14,7 @@ const IntroMarkdownV1 = require('md/docs/order_utils/1.0.0/introduction');
const InstallationMarkdownV1 = require('md/docs/order_utils/1.0.0/installation');
/* tslint:enable:no-var-requires */
const docSections = {
const markdownSections = {
introduction: 'introduction',
installation: 'installation',
usage: 'usage',
@ -26,19 +26,19 @@ const docsInfoConfig: DocsInfoConfig = {
type: SupportedDocJson.TypeDoc,
displayName: 'Order utils',
packageUrl: 'https://github.com/0xProject/0x-monorepo',
menu: {
introduction: [docSections.introduction],
install: [docSections.installation],
usage: [docSections.usage],
types: [docSections.types],
markdownMenu: {
introduction: [markdownSections.introduction],
install: [markdownSections.installation],
usage: [markdownSections.usage],
types: [markdownSections.types],
},
sectionNameToMarkdownByVersion: {
'0.0.1': {
[docSections.introduction]: IntroMarkdownV1,
[docSections.installation]: InstallationMarkdownV1,
[markdownSections.introduction]: IntroMarkdownV1,
[markdownSections.installation]: InstallationMarkdownV1,
},
},
sections: docSections,
markdownSections: markdownSections,
typeConfigs: {
typeNameToExternalLink: {
BigNumber: constants.URL_BIGNUMBERJS_GITHUB,

View File

@ -18,7 +18,7 @@ const docsInfoConfig: DocsInfoConfig = {
type: SupportedDocJson.Doxity,
displayName: '0x Smart Contracts',
packageUrl: 'https://github.com/0xProject/contracts',
menu: {
markdownMenu: {
introduction: [Sections.Introduction],
contracts: [Sections.Exchange, Sections.TokenRegistry, Sections.ZRXToken, Sections.TokenTransferProxy],
},
@ -27,7 +27,7 @@ const docsInfoConfig: DocsInfoConfig = {
[Sections.Introduction]: IntroMarkdownV1,
},
},
sections: {
markdownSections: {
Introduction: Sections.Introduction,
Exchange: Sections.Exchange,
TokenTransferProxy: Sections.TokenTransferProxy,

View File

@ -14,7 +14,7 @@ const InstallationMarkdownV1 = require('md/docs/sol-compiler/installation');
const UsageMarkdown = require('md/docs/sol-compiler/usage');
/* tslint:enable:no-var-requires */
const docSections = {
const markdownSections = {
introduction: 'introduction',
installation: 'installation',
usage: 'usage',
@ -27,21 +27,21 @@ const docsInfoConfig: DocsInfoConfig = {
type: SupportedDocJson.TypeDoc,
displayName: 'Solidity Compiler',
packageUrl: 'https://github.com/0xProject/0x-monorepo',
menu: {
introduction: [docSections.introduction],
install: [docSections.installation],
usage: [docSections.usage],
compiler: [docSections.compiler],
types: [docSections.types],
markdownMenu: {
introduction: [markdownSections.introduction],
install: [markdownSections.installation],
usage: [markdownSections.usage],
compiler: [markdownSections.compiler],
types: [markdownSections.types],
},
sectionNameToMarkdownByVersion: {
'0.0.1': {
[docSections.introduction]: IntroMarkdownV1,
[docSections.installation]: InstallationMarkdownV1,
[docSections.usage]: UsageMarkdown,
[markdownSections.introduction]: IntroMarkdownV1,
[markdownSections.installation]: InstallationMarkdownV1,
[markdownSections.usage]: UsageMarkdown,
},
},
sections: docSections,
markdownSections: markdownSections,
typeConfigs: {
typeNameToExternalLink: {},
typeNameToPrefix: {},

View File

@ -14,15 +14,10 @@ const InstallationMarkdownV1 = require('md/docs/sol_cov/installation');
const UsageMarkdown = require('md/docs/sol_cov/usage');
/* tslint:enable:no-var-requires */
const docSections = {
const markdownSections = {
introduction: 'introduction',
installation: 'installation',
usage: 'usage',
coverageSubprovider: 'coverageSubprovider',
abstractArtifactAdapter: 'abstractArtifactAdapter',
solCompilerArtifactAdapter: 'solCompilerArtifactAdapter',
truffleArtifactAdapter: 'truffleArtifactAdapter',
types: docConstants.TYPES_SECTION_NAME,
};
const docsInfoConfig: DocsInfoConfig = {
@ -30,24 +25,19 @@ const docsInfoConfig: DocsInfoConfig = {
type: SupportedDocJson.TypeDoc,
displayName: 'Sol-cov',
packageUrl: 'https://github.com/0xProject/0x-monorepo',
menu: {
introduction: [docSections.introduction],
install: [docSections.installation],
usage: [docSections.usage],
'coverage-subprovider': [docSections.coverageSubprovider],
'abstract-artifact-adapter': [docSections.abstractArtifactAdapter],
'sol-compiler-artifact-adapter': [docSections.solCompilerArtifactAdapter],
'truffle-artifact-adapter': [docSections.truffleArtifactAdapter],
types: [docSections.types],
markdownMenu: {
introduction: [markdownSections.introduction],
install: [markdownSections.installation],
usage: [markdownSections.usage],
},
sectionNameToMarkdownByVersion: {
'0.0.1': {
[docSections.introduction]: IntroMarkdownV1,
[docSections.installation]: InstallationMarkdownV1,
[docSections.usage]: UsageMarkdown,
[markdownSections.introduction]: IntroMarkdownV1,
[markdownSections.installation]: InstallationMarkdownV1,
[markdownSections.usage]: UsageMarkdown,
},
},
sections: docSections,
markdownSections: markdownSections,
typeConfigs: {
typeNameToExternalLink: {},
typeNameToPrefix: {},

View File

@ -18,20 +18,7 @@ const LedgerNodeHidMarkdown = require('md/docs/subproviders/ledger_node_hid');
const docSections = {
introduction: 'introduction',
installation: 'installation',
subprovider: 'subprovider',
ledgerSubprovider: 'ledgerSubprovider',
ledgerNodeHid: 'ledger-node-hid-issue',
factoryMethods: 'factory-methods',
emptyWalletSubprovider: 'emptyWalletSubprovider',
fakeGasEstimateSubprovider: 'fakeGasEstimateSubprovider',
injectedWeb3Subprovider: 'injectedWeb3Subprovider',
signerSubprovider: 'signerSubprovider',
redundantRPCSubprovider: 'redundantRPCSubprovider',
ganacheSubprovider: 'ganacheSubprovider',
nonceTrackerSubprovider: 'nonceTrackerSubprovider',
privateKeyWalletSubprovider: 'privateKeyWalletSubprovider',
mnemonicWalletSubprovider: 'mnemonicWalletSubprovider',
types: docConstants.TYPES_SECTION_NAME,
};
const docsInfoConfig: DocsInfoConfig = {
@ -39,23 +26,10 @@ const docsInfoConfig: DocsInfoConfig = {
type: SupportedDocJson.TypeDoc,
displayName: 'Subproviders',
packageUrl: 'https://github.com/0xProject/0x-monorepo',
menu: {
markdownMenu: {
introduction: [docSections.introduction],
install: [docSections.installation],
subprovider: [docSections.subprovider],
['ledger-subprovider']: [docSections.ledgerSubprovider],
['ledger-node-hid-issue']: [docSections.ledgerNodeHid],
['private-key-wallet-subprovider']: [docSections.privateKeyWalletSubprovider],
['mnemonic-wallet-subprovider']: [docSections.mnemonicWalletSubprovider],
['factory-methods']: [docSections.factoryMethods],
['emptyWallet-subprovider']: [docSections.emptyWalletSubprovider],
['fakeGasEstimate-subprovider']: [docSections.fakeGasEstimateSubprovider],
['injectedWeb3-subprovider']: [docSections.injectedWeb3Subprovider],
['signer-subprovider']: [docSections.signerSubprovider],
['redundantRPC-subprovider']: [docSections.redundantRPCSubprovider],
['ganache-subprovider']: [docSections.ganacheSubprovider],
['nonceTracker-subprovider']: [docSections.nonceTrackerSubprovider],
types: [docSections.types],
},
sectionNameToMarkdownByVersion: {
'0.0.1': {
@ -64,7 +38,7 @@ const docsInfoConfig: DocsInfoConfig = {
[docSections.ledgerNodeHid]: LedgerNodeHidMarkdown,
},
},
sections: docSections,
markdownSections: docSections,
typeConfigs: {
typeNameToExternalLink: {
Web3: constants.URL_WEB3_DOCS,

View File

@ -17,8 +17,6 @@ const InstallationMarkdownV1 = require('md/docs/web3_wrapper/installation');
const docSections = {
introduction: 'introduction',
installation: 'installation',
web3Wrapper: 'web3Wrapper',
types: docConstants.TYPES_SECTION_NAME,
};
const docsInfoConfig: DocsInfoConfig = {
@ -26,11 +24,9 @@ const docsInfoConfig: DocsInfoConfig = {
type: SupportedDocJson.TypeDoc,
displayName: 'Web3Wrapper',
packageUrl: 'https://github.com/0xProject/0x-monorepo',
menu: {
markdownMenu: {
introduction: [docSections.introduction],
install: [docSections.installation],
web3Wrapper: [docSections.web3Wrapper],
types: [docSections.types],
},
sectionNameToMarkdownByVersion: {
'0.0.1': {
@ -38,7 +34,7 @@ const docsInfoConfig: DocsInfoConfig = {
[docSections.installation]: InstallationMarkdownV1,
},
},
sections: docSections,
markdownSections: docSections,
typeConfigs: {
typeNameToExternalLink: {
Web3: constants.URL_WEB3_DOCS,

View File

@ -20,7 +20,7 @@ const IntroMarkdownV2 = require('md/docs/0xjs/2.0.0/introduction');
const versioningMarkdownV2 = require('md/docs/0xjs/2.0.0/versioning');
/* tslint:enable:no-var-requires */
const zeroExJsDocSections = {
const markdownSections = {
introduction: 'introduction',
installation: 'installation',
testrpc: 'testrpc',
@ -34,29 +34,29 @@ const docsInfoConfig: DocsInfoConfig = {
type: SupportedDocJson.TypeDoc,
displayName: '0x.js',
packageUrl: 'https://github.com/0xProject/0x-monorepo',
menu: {
introduction: [zeroExJsDocSections.introduction],
install: [zeroExJsDocSections.installation],
topics: [zeroExJsDocSections.async, zeroExJsDocSections.errors, zeroExJsDocSections.versioning],
markdownMenu: {
introduction: [markdownSections.introduction],
install: [markdownSections.installation],
topics: [markdownSections.async, markdownSections.errors, markdownSections.versioning],
},
sectionNameToMarkdownByVersion: {
'0.0.1': {
[zeroExJsDocSections.introduction]: IntroMarkdownV1,
[zeroExJsDocSections.installation]: InstallationMarkdownV1,
[zeroExJsDocSections.async]: AsyncMarkdownV1,
[zeroExJsDocSections.errors]: ErrorsMarkdownV1,
[zeroExJsDocSections.versioning]: versioningMarkdownV1,
[markdownSections.introduction]: IntroMarkdownV1,
[markdownSections.installation]: InstallationMarkdownV1,
[markdownSections.async]: AsyncMarkdownV1,
[markdownSections.errors]: ErrorsMarkdownV1,
[markdownSections.versioning]: versioningMarkdownV1,
},
'1.0.0-rc.1': {
[zeroExJsDocSections.introduction]: IntroMarkdownV2,
[zeroExJsDocSections.versioning]: versioningMarkdownV2,
[markdownSections.introduction]: IntroMarkdownV2,
[markdownSections.versioning]: versioningMarkdownV2,
// These are the same as for V1
[zeroExJsDocSections.installation]: InstallationMarkdownV1,
[zeroExJsDocSections.async]: AsyncMarkdownV1,
[zeroExJsDocSections.errors]: ErrorsMarkdownV1,
[markdownSections.installation]: InstallationMarkdownV1,
[markdownSections.async]: AsyncMarkdownV1,
[markdownSections.errors]: ErrorsMarkdownV1,
},
},
sections: zeroExJsDocSections,
markdownSections: markdownSections,
typeConfigs: {
typeNameToPrefix: {},
typeNameToExternalLink: {