aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorBrandon Millman <brandon@0xproject.com>2018-02-15 06:45:33 +0800
committerGitHub <noreply@github.com>2018-02-15 06:45:33 +0800
commit0dfb36e6759e67a82ed720bf31185aadfbea2c63 (patch)
tree62df7f1fb52645d150c3b95825ec263b6fa4a5a4 /packages
parent95a9d7730182d4f8ed7b4dd953b4bb78f22d59d6 (diff)
parent8201d5d1f8dbba530b71b7db8967e51406b8fe64 (diff)
downloaddexon-sol-tools-0dfb36e6759e67a82ed720bf31185aadfbea2c63.tar
dexon-sol-tools-0dfb36e6759e67a82ed720bf31185aadfbea2c63.tar.gz
dexon-sol-tools-0dfb36e6759e67a82ed720bf31185aadfbea2c63.tar.bz2
dexon-sol-tools-0dfb36e6759e67a82ed720bf31185aadfbea2c63.tar.lz
dexon-sol-tools-0dfb36e6759e67a82ed720bf31185aadfbea2c63.tar.xz
dexon-sol-tools-0dfb36e6759e67a82ed720bf31185aadfbea2c63.tar.zst
dexon-sol-tools-0dfb36e6759e67a82ed720bf31185aadfbea2c63.zip
Merge pull request #398 from 0xProject/feature/website/stage-documentation
Add support for intersection types and staged connect documentation
Diffstat (limited to 'packages')
-rw-r--r--packages/0x.js/scripts/stagedocs.js24
-rw-r--r--packages/connect/scripts/stagedocs.js24
-rw-r--r--packages/website/ts/containers/connect_documentation.tsx9
-rw-r--r--packages/website/ts/containers/zero_ex_js_documentation.tsx9
-rw-r--r--packages/website/ts/pages/documentation/type.tsx17
-rw-r--r--packages/website/ts/types.ts1
6 files changed, 80 insertions, 4 deletions
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
new file mode 100644
index 000000000..868112a37
--- /dev/null
+++ b/packages/connect/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-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);
+});
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/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],
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 (
+ <Type
+ key={`type-${t.name}-${t.value}-${t.typeDocType}`}
+ type={t}
+ sectionName={props.sectionName}
+ typeDefinitionByName={props.typeDefinitionByName}
+ docsInfo={props.docsInfo}
+ />
+ );
+ });
+ 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',
}