From 3510985cf472690e12e07e350f1a27bfb263b3bc Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Wed, 14 Feb 2018 10:15:53 -0800 Subject: Add stagedocs script to connect package --- packages/connect/scripts/stagedocs.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 packages/connect/scripts/stagedocs.js (limited to 'packages') diff --git a/packages/connect/scripts/stagedocs.js b/packages/connect/scripts/stagedocs.js new file mode 100644 index 000000000..c7582cffa --- /dev/null +++ b/packages/connect/scripts/stagedocs.js @@ -0,0 +1,26 @@ +const execAsync = require('async-child-process').execAsync; +const postpublish_utils = require('../../../scripts/postpublish_utils'); +const packageJSON = require('../package.json'); + +const cwd = __dirname + '/..'; +const subPackageName = packageJSON.name; +const S3BucketPath = 's3://staging-connect-docs-jsons/'; +const jsonFilePath = __dirname + '/../' + postpublish_utils.generatedDocsDirectoryName + '/index.json'; +const version = process.env.DOCS_VERSION; + +execAsync('JSON_FILE_PATH=' + jsonFilePath + ' PROJECT_DIR=' + __dirname + '/.. yarn docs:json', { + cwd, +}) +.then(function(result) { + if (result.stderr !== '') { + throw new Error(result.stderr); + } + const fileName = 'v' + version + '.json'; + const s3Url = S3BucketPath + fileName; + return execAsync('S3_URL=' + s3Url + ' yarn upload_docs_json', { + cwd, + }); +}) +.catch(function(err) { + console.log(err); +}); -- cgit From 2897b729672b0d98bf1eb2fc843c23f5d966f6ee Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Wed, 14 Feb 2018 10:16:00 -0800 Subject: Add support for intersection types in docs --- .../website/ts/containers/connect_documentation.tsx | 9 +++++++-- packages/website/ts/pages/documentation/type.tsx | 17 +++++++++++++++++ packages/website/ts/types.ts | 1 + 3 files changed, 25 insertions(+), 2 deletions(-) (limited to 'packages') diff --git a/packages/website/ts/containers/connect_documentation.tsx b/packages/website/ts/containers/connect_documentation.tsx index 22ba4a7a1..f6aae415d 100644 --- a/packages/website/ts/containers/connect_documentation.tsx +++ b/packages/website/ts/containers/connect_documentation.tsx @@ -6,7 +6,8 @@ import { DocsInfo } from 'ts/pages/documentation/docs_info'; import { Documentation as DocumentationComponent, DocumentationAllProps } from 'ts/pages/documentation/documentation'; import { Dispatcher } from 'ts/redux/dispatcher'; import { State } from 'ts/redux/reducer'; -import { DocsInfoConfig, WebsitePaths } from 'ts/types'; +import { DocsInfoConfig, Environments, WebsitePaths } from 'ts/types'; +import { configs } from 'ts/utils/configs'; import { constants } from 'ts/utils/constants'; import { typeDocUtils } from 'ts/utils/typedoc_utils'; @@ -23,12 +24,16 @@ const connectDocSections = { types: constants.TYPES_SECTION_NAME, }; +const s3BucketName = + configs.ENVIRONMENT === Environments.DEVELOPMENT ? 'staging-connect-docs-jsons' : 'connect-docs-jsons'; +const docsJsonRoot = `https://s3.amazonaws.com/${s3BucketName}`; + const docsInfoConfig: DocsInfoConfig = { displayName: '0x Connect', subPackageName: 'connect', packageUrl: 'https://github.com/0xProject/0x.js', websitePath: WebsitePaths.Connect, - docsJsonRoot: 'https://s3.amazonaws.com/connect-docs-jsons', + docsJsonRoot, menu: { introduction: [connectDocSections.introduction], install: [connectDocSections.installation], diff --git a/packages/website/ts/pages/documentation/type.tsx b/packages/website/ts/pages/documentation/type.tsx index e989e7129..b306fa053 100644 --- a/packages/website/ts/pages/documentation/type.tsx +++ b/packages/website/ts/pages/documentation/type.tsx @@ -118,6 +118,23 @@ export function Type(props: TypeProps): any { typeName = type.name; break; + case TypeDocTypes.Intersection: + const intersectionsTypes = _.map(type.types, t => { + return ( + + ); + }); + typeName = _.reduce(intersectionsTypes, (prev: React.ReactNode, curr: React.ReactNode) => { + return [prev, '&', curr]; + }); + break; + default: throw utils.spawnSwitchErr('type.typeDocType', type.typeDocType); } diff --git a/packages/website/ts/types.ts b/packages/website/ts/types.ts index 19fc24852..645c9cc11 100644 --- a/packages/website/ts/types.ts +++ b/packages/website/ts/types.ts @@ -324,6 +324,7 @@ export enum TypeDocTypes { Reflection = 'reflection', Union = 'union', TypeParameter = 'typeParameter', + Intersection = 'intersection', Unknown = 'unknown', } -- cgit From 8201d5d1f8dbba530b71b7db8967e51406b8fe64 Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Wed, 14 Feb 2018 14:34:30 -0800 Subject: Add docs staging to 0x.js package --- packages/0x.js/scripts/stagedocs.js | 24 ++++++++++++++++++++++ packages/connect/scripts/stagedocs.js | 2 -- .../ts/containers/zero_ex_js_documentation.tsx | 9 ++++++-- 3 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 packages/0x.js/scripts/stagedocs.js (limited to 'packages') diff --git a/packages/0x.js/scripts/stagedocs.js b/packages/0x.js/scripts/stagedocs.js new file mode 100644 index 000000000..b48c23851 --- /dev/null +++ b/packages/0x.js/scripts/stagedocs.js @@ -0,0 +1,24 @@ +const execAsync = require('async-child-process').execAsync; +const postpublish_utils = require('../../../scripts/postpublish_utils'); + +const cwd = __dirname + '/..'; +const S3BucketPath = 's3://staging-0xjs-docs-jsons/'; +const jsonFilePath = __dirname + '/../' + postpublish_utils.generatedDocsDirectoryName + '/index.json'; +const version = process.env.DOCS_VERSION; + +execAsync('JSON_FILE_PATH=' + jsonFilePath + ' PROJECT_DIR=' + __dirname + '/.. yarn docs:json', { + cwd, +}) +.then(function(result) { + if (result.stderr !== '') { + throw new Error(result.stderr); + } + const fileName = 'v' + version + '.json'; + const s3Url = S3BucketPath + fileName; + return execAsync('S3_URL=' + s3Url + ' yarn upload_docs_json', { + cwd, + }); +}) +.catch(function(err) { + console.log(err); +}); diff --git a/packages/connect/scripts/stagedocs.js b/packages/connect/scripts/stagedocs.js index c7582cffa..868112a37 100644 --- a/packages/connect/scripts/stagedocs.js +++ b/packages/connect/scripts/stagedocs.js @@ -1,9 +1,7 @@ const execAsync = require('async-child-process').execAsync; const postpublish_utils = require('../../../scripts/postpublish_utils'); -const packageJSON = require('../package.json'); const cwd = __dirname + '/..'; -const subPackageName = packageJSON.name; const S3BucketPath = 's3://staging-connect-docs-jsons/'; const jsonFilePath = __dirname + '/../' + postpublish_utils.generatedDocsDirectoryName + '/index.json'; const version = process.env.DOCS_VERSION; diff --git a/packages/website/ts/containers/zero_ex_js_documentation.tsx b/packages/website/ts/containers/zero_ex_js_documentation.tsx index 96c8c257d..4715acafc 100644 --- a/packages/website/ts/containers/zero_ex_js_documentation.tsx +++ b/packages/website/ts/containers/zero_ex_js_documentation.tsx @@ -6,7 +6,8 @@ import { DocsInfo } from 'ts/pages/documentation/docs_info'; import { Documentation as DocumentationComponent, DocumentationAllProps } from 'ts/pages/documentation/documentation'; import { Dispatcher } from 'ts/redux/dispatcher'; import { State } from 'ts/redux/reducer'; -import { DocsInfoConfig, WebsitePaths } from 'ts/types'; +import { DocsInfoConfig, Environments, WebsitePaths } from 'ts/types'; +import { configs } from 'ts/utils/configs'; import { constants } from 'ts/utils/constants'; import { typeDocUtils } from 'ts/utils/typedoc_utils'; @@ -35,12 +36,16 @@ const zeroExJsDocSections = { types: constants.TYPES_SECTION_NAME, }; +const s3BucketName = + configs.ENVIRONMENT === Environments.DEVELOPMENT ? 'staging-0xjs-docs-jsons' : '0xjs-docs-jsons'; +const docsJsonRoot = `https://s3.amazonaws.com/${s3BucketName}`; + const docsInfoConfig: DocsInfoConfig = { displayName: '0x.js', packageUrl: 'https://github.com/0xProject/0x.js', subPackageName: '0x.js', websitePath: WebsitePaths.ZeroExJs, - docsJsonRoot: 'https://s3.amazonaws.com/0xjs-docs-jsons', + docsJsonRoot, menu: { introduction: [zeroExJsDocSections.introduction], install: [zeroExJsDocSections.installation], -- cgit