diff options
author | Brandon Millman <brandon.millman@gmail.com> | 2018-02-15 06:34:30 +0800 |
---|---|---|
committer | Brandon Millman <brandon.millman@gmail.com> | 2018-02-15 06:35:31 +0800 |
commit | 8201d5d1f8dbba530b71b7db8967e51406b8fe64 (patch) | |
tree | e39b43a2256b63417da1f78283610e5a40fe0847 | |
parent | 2897b729672b0d98bf1eb2fc843c23f5d966f6ee (diff) | |
download | dexon-sol-tools-8201d5d1f8dbba530b71b7db8967e51406b8fe64.tar.gz dexon-sol-tools-8201d5d1f8dbba530b71b7db8967e51406b8fe64.tar.zst dexon-sol-tools-8201d5d1f8dbba530b71b7db8967e51406b8fe64.zip |
Add docs staging to 0x.js package
-rw-r--r-- | packages/0x.js/scripts/stagedocs.js | 24 | ||||
-rw-r--r-- | packages/connect/scripts/stagedocs.js | 2 | ||||
-rw-r--r-- | packages/website/ts/containers/zero_ex_js_documentation.tsx | 9 |
3 files changed, 31 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 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], |