From 9212d67e2fad159fa7eb3feed751814ea515416c Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 4 Jun 2018 10:54:14 -0700 Subject: Add a documentation page for ethereum types --- packages/ethereum-types/package.json | 13 ++- .../src/monorepo_scripts/stage_docs.ts | 8 ++ .../website/md/docs/ethereum_types/installation.md | 11 ++ .../website/md/docs/ethereum_types/introduction.md | 1 + packages/website/translations/chinese.json | 1 + packages/website/translations/english.json | 1 + packages/website/translations/korean.json | 1 + packages/website/translations/russian.json | 1 + packages/website/translations/spanish.json | 1 + packages/website/ts/components/top_bar/top_bar.tsx | 6 + .../ts/containers/ethereum_types_documentation.ts | 124 +++++++++++++++++++++ packages/website/ts/index.tsx | 7 ++ .../website/ts/pages/documentation/doc_page.tsx | 1 + packages/website/ts/types.ts | 3 + packages/website/ts/utils/doc_utils.ts | 2 +- 15 files changed, 179 insertions(+), 2 deletions(-) create mode 100644 packages/ethereum-types/src/monorepo_scripts/stage_docs.ts create mode 100644 packages/website/md/docs/ethereum_types/installation.md create mode 100644 packages/website/md/docs/ethereum_types/introduction.md create mode 100644 packages/website/ts/containers/ethereum_types_documentation.ts diff --git a/packages/ethereum-types/package.json b/packages/ethereum-types/package.json index 0c9519994..26110c68e 100644 --- a/packages/ethereum-types/package.json +++ b/packages/ethereum-types/package.json @@ -12,7 +12,18 @@ "build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts", "clean": "shx rm -rf lib scripts", "lint": "tslint --project .", - "manual:postpublish": "yarn build; node ./scripts/postpublish.js" + "manual:postpublish": "yarn build; node ./scripts/postpublish.js", + "docs:stage": "node scripts/stage_docs.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": { + "docPublishConfigs": { + "s3BucketPath": "s3://doc-jsons/ethereum-types/", + "s3StagingBucketPath": "s3://staging-doc-jsons/ethereum-types/" + } + } }, "license": "Apache-2.0", "repository": { diff --git a/packages/ethereum-types/src/monorepo_scripts/stage_docs.ts b/packages/ethereum-types/src/monorepo_scripts/stage_docs.ts new file mode 100644 index 000000000..e732ac8eb --- /dev/null +++ b/packages/ethereum-types/src/monorepo_scripts/stage_docs.ts @@ -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); diff --git a/packages/website/md/docs/ethereum_types/installation.md b/packages/website/md/docs/ethereum_types/installation.md new file mode 100644 index 000000000..5371cfa47 --- /dev/null +++ b/packages/website/md/docs/ethereum_types/installation.md @@ -0,0 +1,11 @@ +**Install** + +```bash +yarn add ethereum-types +``` + +**Import** + +```typescript +import { Provider } from 'ethereum-types'; +``` diff --git a/packages/website/md/docs/ethereum_types/introduction.md b/packages/website/md/docs/ethereum_types/introduction.md new file mode 100644 index 000000000..43484cdd1 --- /dev/null +++ b/packages/website/md/docs/ethereum_types/introduction.md @@ -0,0 +1 @@ +Welcome to the [ethereum-types](https://github.com/0xProject/0x-monorepo/packages/ethereum-types) documentation! This package provides ethereum specific (but not library-specific) types that are meant to be shared between other ethereum packages. diff --git a/packages/website/translations/chinese.json b/packages/website/translations/chinese.json index 966457a93..3e9f21370 100644 --- a/packages/website/translations/chinese.json +++ b/packages/website/translations/chinese.json @@ -59,6 +59,7 @@ "SOL_COMPILER": "Solidity Compiler", "JSON_SCHEMAS": "JSON Schemas", "SOL_COV": "Solidity Coverage", + "ETHEREUM_TYPES": "Ethereum Types", "SUBPROVIDERS": "Subproviders", "BLOG": "博客", "FORUM": "论坛", diff --git a/packages/website/translations/english.json b/packages/website/translations/english.json index f3acea3be..04fb0507a 100644 --- a/packages/website/translations/english.json +++ b/packages/website/translations/english.json @@ -60,6 +60,7 @@ "SOL_COMPILER": "Solidity Compiler", "JSON_SCHEMAS": "JSON Schemas", "SOL_COV": "Solidity Coverage", + "ETHEREUM_TYPES": "Ethereum Types", "SUBPROVIDERS": "Subproviders", "BLOG": "blog", "FORUM": "forum", diff --git a/packages/website/translations/korean.json b/packages/website/translations/korean.json index 7414207f7..c38de6677 100644 --- a/packages/website/translations/korean.json +++ b/packages/website/translations/korean.json @@ -59,6 +59,7 @@ "SOL_COMPILER": "Solidity Compiler", "JSON_SCHEMAS": "JSON Schemas", "SOL_COV": "Solidity Coverage", + "ETHEREUM_TYPES": "Ethereum Types", "SUBPROVIDERS": "Subproviders", "BLOG": "블로그", "FORUM": "포럼", diff --git a/packages/website/translations/russian.json b/packages/website/translations/russian.json index 75ab02a27..a7e06d646 100644 --- a/packages/website/translations/russian.json +++ b/packages/website/translations/russian.json @@ -59,6 +59,7 @@ "SOL_COMPILER": "Solidity Compiler", "JSON_SCHEMAS": "JSON Schemas", "SOL_COV": "Solidity Coverage", + "ETHEREUM_TYPES": "Ethereum Types", "SUBPROVIDERS": "Subproviders", "BLOG": "Блог", "FORUM": "Форум", diff --git a/packages/website/translations/spanish.json b/packages/website/translations/spanish.json index 8f537ea40..5a8920f61 100644 --- a/packages/website/translations/spanish.json +++ b/packages/website/translations/spanish.json @@ -60,6 +60,7 @@ "SOL_COMPILER": "Solidity Compiler", "JSON_SCHEMAS": "JSON Schemas", "SOL_COV": "Solidity Coverage", + "ETHEREUM_TYPES": "Ethereum Types", "SUBPROVIDERS": "Subproviders", "BLOG": "blog", "FORUM": "foro", diff --git a/packages/website/ts/components/top_bar/top_bar.tsx b/packages/website/ts/components/top_bar/top_bar.tsx index e2d791ae3..3e97dc741 100644 --- a/packages/website/ts/components/top_bar/top_bar.tsx +++ b/packages/website/ts/components/top_bar/top_bar.tsx @@ -165,6 +165,12 @@ export class TopBar extends React.Component { primaryText={this.props.translate.get(Key.SolCov, Deco.CapWords)} /> , + + + , ({ + docsVersion: state.docsVersion, + availableDocVersions: state.availableDocVersions, + translate: state.translate, + docsInfo, +}); + +const mapDispatchToProps = (dispatch: Dispatch): ConnectedDispatch => ({ + dispatcher: new Dispatcher(dispatch), +}); + +export const Documentation: React.ComponentClass = connect(mapStateToProps, mapDispatchToProps)( + DocPageComponent, +); diff --git a/packages/website/ts/index.tsx b/packages/website/ts/index.tsx index a6bfe7dd2..719604c02 100644 --- a/packages/website/ts/index.tsx +++ b/packages/website/ts/index.tsx @@ -69,6 +69,9 @@ const LazySubprovidersDocumentation = createLazyComponent('Documentation', async const LazyOrderUtilsDocumentation = createLazyComponent('Documentation', async () => System.import(/* webpackChunkName: "orderUtilsDocs" */ 'ts/containers/order_utils_documentation'), ); +const LazyEthereumTypesDocumentation = createLazyComponent('Documentation', async () => + System.import(/* webpackChunkName: "ethereumTypesDocs" */ 'ts/containers/ethereum_types_documentation'), +); analytics.init(); // tslint:disable-next-line:no-floating-promises @@ -116,6 +119,10 @@ render( path={`${WebsitePaths.SmartContracts}/:version?`} component={LazySmartContractsDocumentation} /> + {/* Legacy endpoints */} { - const versionFilePaths = await this.getVersionFileNamesAsync(s3DocJsonRoot, folderName); + const versionFilePaths = await docUtils.getVersionFileNamesAsync(s3DocJsonRoot, folderName); const versionToFilePath: VersionToFilePath = {}; _.each(versionFilePaths, filePath => { const [version] = findVersions(filePath); -- cgit v1.2.3