diff options
-rw-r--r-- | packages/0x.js/scripts/stagedocs.js | 24 | ||||
-rw-r--r-- | packages/connect/scripts/stagedocs.js | 24 | ||||
-rw-r--r-- | packages/connect/src/http_client.ts | 8 | ||||
-rw-r--r-- | packages/connect/test/http_client_test.ts | 6 | ||||
-rw-r--r-- | packages/contracts/package.json | 3 | ||||
-rw-r--r-- | packages/deployer/package.json | 3 | ||||
-rw-r--r-- | packages/website/ts/containers/connect_documentation.tsx | 9 | ||||
-rw-r--r-- | packages/website/ts/containers/zero_ex_js_documentation.tsx | 9 | ||||
-rw-r--r-- | packages/website/ts/pages/documentation/type.tsx | 17 | ||||
-rw-r--r-- | packages/website/ts/types.ts | 1 |
10 files changed, 91 insertions, 13 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/connect/src/http_client.ts b/packages/connect/src/http_client.ts index 815d42e67..9e5f0f448 100644 --- a/packages/connect/src/http_client.ts +++ b/packages/connect/src/http_client.ts @@ -23,7 +23,7 @@ import { relayerResponseJsonParsers } from './utils/relayer_response_json_parser const TRAILING_SLASHES_REGEX = /\/+$/; const DEFAULT_PAGED_REQUEST_OPTS: PagedRequestOpts = { - page: 0, + page: 1, perPage: 100, }; /** @@ -66,7 +66,7 @@ export class HttpClient implements Client { } /** * Retrieve token pair info from the API - * @param requestOpts Options specifying token information to retrieve and page information, defaults to { page: 0, perPage: 100 } + * @param requestOpts Options specifying token information to retrieve and page information, defaults to { page: 1, perPage: 100 } * @return The resulting TokenPairsItems that match the request */ public async getTokenPairsAsync(requestOpts?: TokenPairsRequestOpts & PagedRequestOpts): Promise<TokenPairsItem[]> { @@ -83,7 +83,7 @@ export class HttpClient implements Client { } /** * Retrieve orders from the API - * @param requestOpts Options specifying orders to retrieve and page information, defaults to { page: 0, perPage: 100 } + * @param requestOpts Options specifying orders to retrieve and page information, defaults to { page: 1, perPage: 100 } * @return The resulting SignedOrders that match the request */ public async getOrdersAsync(requestOpts?: OrdersRequestOpts & PagedRequestOpts): Promise<SignedOrder[]> { @@ -112,7 +112,7 @@ export class HttpClient implements Client { /** * Retrieve an orderbook from the API * @param request An OrderbookRequest instance describing the specific orderbook to retrieve - * @param requestOpts Options specifying page information, defaults to { page: 0, perPage: 100 } + * @param requestOpts Options specifying page information, defaults to { page: 1, perPage: 100 } * @return The resulting OrderbookResponse that matches the request */ public async getOrderbookAsync( diff --git a/packages/connect/test/http_client_test.ts b/packages/connect/test/http_client_test.ts index 93b252ace..311dc96e6 100644 --- a/packages/connect/test/http_client_test.ts +++ b/packages/connect/test/http_client_test.ts @@ -41,7 +41,7 @@ describe('HttpClient', () => { describe('#getTokenPairsAsync', () => { const url = `${relayUrl}/token_pairs`; it('gets token pairs with default options when none are provided', async () => { - const urlWithQuery = `${url}?page=0&per_page=100`; + const urlWithQuery = `${url}?page=1&per_page=100`; fetchMock.get(urlWithQuery, tokenPairsResponseJSON); const tokenPairs = await relayerClient.getTokenPairsAsync(); expect(tokenPairs).to.be.deep.equal(tokenPairsResponse); @@ -66,7 +66,7 @@ describe('HttpClient', () => { describe('#getOrdersAsync', () => { const url = `${relayUrl}/orders`; it('gets orders with default options when none are provided', async () => { - const urlWithQuery = `${url}?page=0&per_page=100`; + const urlWithQuery = `${url}?page=1&per_page=100`; fetchMock.get(urlWithQuery, ordersResponseJSON); const orders = await relayerClient.getOrdersAsync(); expect(orders).to.be.deep.equal(ordersResponse); @@ -110,7 +110,7 @@ describe('HttpClient', () => { it('gets orderbook with default page options when none are provided', async () => { const urlWithQuery = `${url}?baseTokenAddress=${ request.baseTokenAddress - }&page=0&per_page=100"eTokenAddress=${request.quoteTokenAddress}`; + }&page=1&per_page=100"eTokenAddress=${request.quoteTokenAddress}`; fetchMock.get(urlWithQuery, orderbookJSON); const orderbook = await relayerClient.getOrderbookAsync(request); expect(orderbook).to.be.deep.equal(orderbookResponse); diff --git a/packages/contracts/package.json b/packages/contracts/package.json index 7e7caa002..fd411f820 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -16,7 +16,7 @@ "run_mocha": "mocha 'lib/test/**/*.js' --timeout 10000 --bail --exit", "compile:comment": "Yarn workspaces do not link binaries correctly so we need to reference them directly https://github.com/yarnpkg/yarn/issues/3846", "compile": "node ../deployer/lib/src/cli.js compile --contracts-dir src/contracts --artifacts-dir src/artifacts", - "clean": "rm -rf ./lib", + "clean": "shx rm -rf ./lib", "generate_contract_wrappers": "node ../abi-gen/lib/index.js --abis 'src/artifacts/@(DummyToken|TokenTransferProxy|Exchange|TokenRegistry|MultiSigWallet|MultiSigWalletWithTimeLock|MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress|TokenRegistry|ZRXToken).json' --template contract_templates/contract.handlebars --partials 'contract_templates/partials/**/*.handlebars' --output src/contract_wrappers/generated", "migrate": "node ../deployer/lib/src/cli.js migrate", "lint": "tslint --project . 'migrations/**/*.ts' 'test/**/*.ts' 'util/**/*.ts' 'deploy/**/*.ts'", @@ -51,6 +51,7 @@ "mocha": "^4.0.1", "npm-run-all": "^4.1.2", "solc": "^0.4.18", + "shx": "^0.2.2", "tslint": "5.8.0", "types-bn": "^0.0.1", "types-ethereumjs-util": "0xProject/types-ethereumjs-util", diff --git a/packages/deployer/package.json b/packages/deployer/package.json index af5c33354..89dfd3ef1 100644 --- a/packages/deployer/package.json +++ b/packages/deployer/package.json @@ -9,7 +9,7 @@ "build": "yarn clean && copyfiles 'test/fixtures/contracts/**/*' src/solc/solc_bin/* ./lib && tsc", "test": "npm run build; mocha lib/test/*_test.js", "compile": "npm run build; node lib/src/cli.js compile", - "clean": "rm -rf ./lib", + "clean": "shx rm -rf ./lib", "migrate": "npm run build; node lib/src/cli.js migrate", "lint": "tslint --project . 'src/**/*.ts' 'test/**/*.ts'", "test:circleci": "yarn test" @@ -31,6 +31,7 @@ "@0xproject/tslint-config": "^0.4.9", "chai": "^4.0.1", "copyfiles": "^1.2.0", + "shx": "^0.2.2", "mocha": "^4.0.1", "tslint": "5.8.0", "types-bn": "^0.0.1", 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', } |