From 98d06d6d252ed379d60bcef915caf38a5ec7a5af Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Sat, 22 Sep 2018 11:06:48 -0400 Subject: BREAKING CHANGE: document contracts from sol-doc Change website to accept smart contract documentation in the format generated by sol-doc rather than that generated by Doxity. --- .../website/ts/pages/documentation/doc_page.tsx | 26 ++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'packages/website/ts/pages/documentation') diff --git a/packages/website/ts/pages/documentation/doc_page.tsx b/packages/website/ts/pages/documentation/doc_page.tsx index 9c144b93f..7bf3addc0 100644 --- a/packages/website/ts/pages/documentation/doc_page.tsx +++ b/packages/website/ts/pages/documentation/doc_page.tsx @@ -1,4 +1,11 @@ -import { DocAgnosticFormat, DocsInfo, Documentation } from '@0xproject/react-docs'; +import { + DocAgnosticFormat, + DocsInfo, + Documentation, + GeneratedDocJson, + SupportedDocJson, + TypeDocUtils, +} from '@0xproject/react-docs'; import findVersions = require('find-versions'); import * as _ from 'lodash'; import * as React from 'react'; @@ -128,7 +135,22 @@ export class DocPage extends React.Component { const versionFilePathToFetch = versionToFilePath[versionToFetch]; const versionDocObj = await docUtils.getJSONDocFileAsync(versionFilePathToFetch, docBucketRoot); - const docAgnosticFormat = this.props.docsInfo.convertToDocAgnosticFormat(versionDocObj); + let docAgnosticFormat; + if (this.props.docsInfo.type === SupportedDocJson.TypeDoc) { + docAgnosticFormat = new TypeDocUtils( + versionDocObj as GeneratedDocJson, + this.props.docsInfo, + ).convertToDocAgnosticFormat(); + } else if (this.props.docsInfo.type === SupportedDocJson.Solidity) { + // documenting solidity. + docAgnosticFormat = versionDocObj as DocAgnosticFormat; + // need to modify docsInfo like convertToDocAgnosticFormat() would do + this.props.docsInfo.menu.Contracts = []; + _.each(docAgnosticFormat, (docObj, contractName) => { + this.props.docsInfo.sections[contractName] = contractName; + this.props.docsInfo.menu.Contracts.push(contractName); + }); + } if (!this._isUnmounted) { this.setState({ -- cgit v1.2.3 From e8c8d3e722676a250428795f70143ed3e5289cbc Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Tue, 25 Sep 2018 14:35:18 -0400 Subject: fix: rename SupportedDocJson field to SolDoc from Solidity https://github.com/0xProject/0x-monorepo/pull/1004#discussion_r219976199 https://github.com/0xProject/0x-monorepo/pull/1004 --- packages/website/ts/pages/documentation/doc_page.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages/website/ts/pages/documentation') diff --git a/packages/website/ts/pages/documentation/doc_page.tsx b/packages/website/ts/pages/documentation/doc_page.tsx index 7bf3addc0..a06d29035 100644 --- a/packages/website/ts/pages/documentation/doc_page.tsx +++ b/packages/website/ts/pages/documentation/doc_page.tsx @@ -141,7 +141,7 @@ export class DocPage extends React.Component { versionDocObj as GeneratedDocJson, this.props.docsInfo, ).convertToDocAgnosticFormat(); - } else if (this.props.docsInfo.type === SupportedDocJson.Solidity) { + } else if (this.props.docsInfo.type === SupportedDocJson.SolDoc) { // documenting solidity. docAgnosticFormat = versionDocObj as DocAgnosticFormat; // need to modify docsInfo like convertToDocAgnosticFormat() would do -- cgit v1.2.3 From de9f5d350f008f1eeb6e42a3dcf611262f6210b4 Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Tue, 25 Sep 2018 15:49:43 -0400 Subject: fix: call out a HACK in comments https://github.com/0xProject/0x-monorepo/pull/1004#discussion_r220010054 https://github.com/0xProject/0x-monorepo/pull/1004 --- packages/website/ts/pages/documentation/doc_page.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages/website/ts/pages/documentation') diff --git a/packages/website/ts/pages/documentation/doc_page.tsx b/packages/website/ts/pages/documentation/doc_page.tsx index a06d29035..6f029b6a2 100644 --- a/packages/website/ts/pages/documentation/doc_page.tsx +++ b/packages/website/ts/pages/documentation/doc_page.tsx @@ -144,7 +144,7 @@ export class DocPage extends React.Component { } else if (this.props.docsInfo.type === SupportedDocJson.SolDoc) { // documenting solidity. docAgnosticFormat = versionDocObj as DocAgnosticFormat; - // need to modify docsInfo like convertToDocAgnosticFormat() would do + // HACK: need to modify docsInfo like convertToDocAgnosticFormat() would do this.props.docsInfo.menu.Contracts = []; _.each(docAgnosticFormat, (docObj, contractName) => { this.props.docsInfo.sections[contractName] = contractName; -- cgit v1.2.3