From 160f74d53e8878a62619c3641b46da7f0c6d2b59 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Sat, 3 Mar 2018 13:46:42 +0100 Subject: Update to custom typeDoc fork with latest version (TS 2.7.0 support) + a bug fix allowing us to defer to the `include` in tsconfig.json on which files to run through TypeDoc --- packages/0x.js/package.json | 4 ++-- packages/0x.js/scripts/postpublish.js | 2 +- packages/0x.js/scripts/stagedocs.js | 26 +++++++++++++------------- packages/connect/package.json | 2 +- packages/connect/scripts/postpublish.js | 2 +- packages/connect/scripts/stagedocs.js | 26 +++++++++++++------------- 6 files changed, 31 insertions(+), 31 deletions(-) (limited to 'packages') diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json index 20af430d6..438ac066b 100644 --- a/packages/0x.js/package.json +++ b/packages/0x.js/package.json @@ -15,7 +15,7 @@ "build:watch": "tsc -w", "prebuild": "run-s clean generate_contract_wrappers", "build": "run-p build:umd:prod build:commonjs; exit 0;", - "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_DIR", + "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH", "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", "generate_contract_wrappers": "node ../abi-gen/lib/index.js --abis 'src/artifacts/@(Exchange|Token|TokenTransferProxy|EtherToken|TokenRegistry|DummyToken).json' --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/contract_wrappers/generated --backend ethers && prettier --write 'src/contract_wrappers/generated/**.ts'", "lint": "tslint --project . 'src/**/*.ts' 'test/**/*.ts'", @@ -73,7 +73,7 @@ "source-map-support": "^0.5.0", "truffle-hdwallet-provider": "^0.0.3", "tslint": "5.8.0", - "typedoc": "~0.8.0", + "typedoc": "0xProject/typedoc", "types-bn": "^0.0.1", "typescript": "2.7.1", "web3-provider-engine": "^13.0.1", diff --git a/packages/0x.js/scripts/postpublish.js b/packages/0x.js/scripts/postpublish.js index 7cbabd8f6..de2c5158e 100644 --- a/packages/0x.js/scripts/postpublish.js +++ b/packages/0x.js/scripts/postpublish.js @@ -20,7 +20,7 @@ postpublish_utils .then(function(release) { console.log('POSTPUBLISH: Release successful, generating docs...'); const jsonFilePath = __dirname + '/../' + postpublish_utils.generatedDocsDirectoryName + '/index.json'; - return execAsync('JSON_FILE_PATH=' + jsonFilePath + ' PROJECT_DIR=' + __dirname + '/.. yarn docs:json', { + return execAsync('JSON_FILE_PATH=' + jsonFilePath + ' yarn docs:json', { cwd, }); }) diff --git a/packages/0x.js/scripts/stagedocs.js b/packages/0x.js/scripts/stagedocs.js index b48c23851..c936757bf 100644 --- a/packages/0x.js/scripts/stagedocs.js +++ b/packages/0x.js/scripts/stagedocs.js @@ -6,19 +6,19 @@ 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', { +execAsync('JSON_FILE_PATH=' + jsonFilePath + ' 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, + .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); }); -}) -.catch(function(err) { - console.log(err); -}); diff --git a/packages/connect/package.json b/packages/connect/package.json index c5c8f4ea0..ebd45144f 100644 --- a/packages/connect/package.json +++ b/packages/connect/package.json @@ -15,7 +15,7 @@ "build:watch": "tsc -w", "build": "tsc", "clean": "shx rm -rf _bundles lib test_temp", - "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_DIR", + "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH", "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", "copy_test_fixtures": "copyfiles -u 2 './test/fixtures/**/*.json' ./lib/test/fixtures", "lint": "tslint --project . 'src/**/*.ts' 'test/**/*.ts'", diff --git a/packages/connect/scripts/postpublish.js b/packages/connect/scripts/postpublish.js index 869bad099..01c349cb8 100644 --- a/packages/connect/scripts/postpublish.js +++ b/packages/connect/scripts/postpublish.js @@ -19,7 +19,7 @@ postpublish_utils .then(function(release) { console.log('POSTPUBLISH: Release successful, generating docs...'); const jsonFilePath = __dirname + '/../' + postpublish_utils.generatedDocsDirectoryName + '/index.json'; - return execAsync('JSON_FILE_PATH=' + jsonFilePath + ' PROJECT_DIR=' + __dirname + '/.. yarn docs:json', { + return execAsync('JSON_FILE_PATH=' + jsonFilePath + ' yarn docs:json', { cwd, }); }) diff --git a/packages/connect/scripts/stagedocs.js b/packages/connect/scripts/stagedocs.js index 868112a37..c8f44d90f 100644 --- a/packages/connect/scripts/stagedocs.js +++ b/packages/connect/scripts/stagedocs.js @@ -6,19 +6,19 @@ 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', { +execAsync('JSON_FILE_PATH=' + jsonFilePath + ' 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, + .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); }); -}) -.catch(function(err) { - console.log(err); -}); -- cgit v1.2.3 From 45b9647ba0b5a29b0c021327398fe703c3ae1427 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Sat, 3 Mar 2018 13:47:39 +0100 Subject: Fix small bug where onHover type declarations with comments was taking up the entire window width --- packages/website/ts/pages/documentation/type_definition.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'packages') diff --git a/packages/website/ts/pages/documentation/type_definition.tsx b/packages/website/ts/pages/documentation/type_definition.tsx index d46eec76c..02bf63258 100644 --- a/packages/website/ts/pages/documentation/type_definition.tsx +++ b/packages/website/ts/pages/documentation/type_definition.tsx @@ -113,7 +113,9 @@ export class TypeDefinition extends React.Component{codeSnippet} - {customType.comment && } +
+ {customType.comment && } +
); } -- cgit v1.2.3 From cef82e72dc667746c57ad855395aa9dc2c7a1b0a Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Sat, 3 Mar 2018 16:49:56 +0100 Subject: Add @0xproject/types to 0x.js tsconfig `include` so that TypeDoc also includes these types in the generated doc JSON --- packages/0x.js/tsconfig.json | 1 + 1 file changed, 1 insertion(+) (limited to 'packages') diff --git a/packages/0x.js/tsconfig.json b/packages/0x.js/tsconfig.json index a6b5c71c2..70ef5a624 100644 --- a/packages/0x.js/tsconfig.json +++ b/packages/0x.js/tsconfig.json @@ -7,6 +7,7 @@ "include": [ "./src/**/*", "./test/**/*", + "../types/src/index.ts", "../../node_modules/types-bn/index.d.ts", "../../node_modules/types-ethereumjs-util/index.d.ts", "../../node_modules/ethers-typescript-typings/index.d.ts", -- cgit v1.2.3 From 6c6bd60a483220706bdecf31b1eef3dc637fade9 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Sat, 3 Mar 2018 16:50:17 +0100 Subject: Consolidate all same exports together --- packages/0x.js/src/index.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'packages') diff --git a/packages/0x.js/src/index.ts b/packages/0x.js/src/index.ts index 161945443..9879bbb56 100644 --- a/packages/0x.js/src/index.ts +++ b/packages/0x.js/src/index.ts @@ -34,6 +34,7 @@ export { BlockParam, ContractEventArg, LogWithDecodedArgs, + TransactionReceipt, TransactionReceiptWithDecodedLogs, } from '@0xproject/types'; @@ -58,5 +59,3 @@ export { ExchangeContractEventArgs, ExchangeEvents, } from './contract_wrappers/generated/exchange'; - -export { TransactionReceipt } from '@0xproject/types'; -- cgit v1.2.3 From 9e7b45ea4cf8d0fabec5f293efc448262e0a7cb2 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Sat, 3 Mar 2018 16:50:58 +0100 Subject: Add support for backward compatibility for TypeDoc versions <0.9.0 --- packages/website/ts/types.ts | 2 +- packages/website/ts/utils/typedoc_utils.ts | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'packages') diff --git a/packages/website/ts/types.ts b/packages/website/ts/types.ts index f0db537e6..5786787c0 100644 --- a/packages/website/ts/types.ts +++ b/packages/website/ts/types.ts @@ -308,7 +308,7 @@ export interface TypeDocNode { returns?: string; declaration: TypeDocNode; flags?: TypeDocFlags; - indexSignature?: TypeDocNode[]; + indexSignature?: TypeDocNode | TypeDocNode[]; signatures?: TypeDocNode[]; parameters?: TypeDocNode[]; typeParameter?: TypeDocNode[]; diff --git a/packages/website/ts/utils/typedoc_utils.ts b/packages/website/ts/utils/typedoc_utils.ts index 992475911..0f79410ae 100644 --- a/packages/website/ts/utils/typedoc_utils.ts +++ b/packages/website/ts/utils/typedoc_utils.ts @@ -170,8 +170,16 @@ export const typeDocUtils = { const methodIfExists = !_.isUndefined(entity.declaration) ? typeDocUtils._convertMethod(entity.declaration, isConstructor, sections, sectionName, docId) : undefined; - const indexSignatureIfExists = !_.isUndefined(entity.indexSignature) - ? typeDocUtils._convertIndexSignature(entity.indexSignature[0], sections, sectionName, docId) + const doesIndexSignatureExist = !_.isUndefined(entity.indexSignature); + const isIndexSignatureArray = _.isArray(entity.indexSignature); + // HACK: TypeDoc Versions <0.9.0 indexSignature is of type TypeDocNode[] + // Versions >0.9.0 have it as type TypeDocNode + const indexSignature = + doesIndexSignatureExist && isIndexSignatureArray + ? ((entity.indexSignature as TypeDocNode[])[0] as TypeDocNode) + : (entity.indexSignature as TypeDocNode); + const indexSignatureIfExists = doesIndexSignatureExist + ? typeDocUtils._convertIndexSignature(indexSignature, sections, sectionName, docId) : undefined; const commentIfExists = !_.isUndefined(entity.comment) && !_.isUndefined(entity.comment.shortText) -- cgit v1.2.3 From abb9eb0df4cff1bfc24831ae82707d8755486fc6 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Sat, 3 Mar 2018 16:51:45 +0100 Subject: Because we now include non-0x.js source, the keys changed. Needed to add both for backward compatibility with old doc JSON's --- .../ts/containers/zero_ex_js_documentation.ts | 33 ++++++++++++++++------ 1 file changed, 25 insertions(+), 8 deletions(-) (limited to 'packages') diff --git a/packages/website/ts/containers/zero_ex_js_documentation.ts b/packages/website/ts/containers/zero_ex_js_documentation.ts index 500bf8d96..536639ee5 100644 --- a/packages/website/ts/containers/zero_ex_js_documentation.ts +++ b/packages/website/ts/containers/zero_ex_js_documentation.ts @@ -102,6 +102,7 @@ const docsInfoConfig: DocsInfoConfig = { 'ApprovalContractEventArgs', 'TokenContractEventArgs', 'ZeroExConfig', + 'TransactionReceipt', 'TransactionReceiptWithDecodedLogs', 'LogWithDecodedArgs', 'EtherTokenEvents', @@ -124,17 +125,33 @@ const docsInfoConfig: DocsInfoConfig = { 'FilterObject', ], sectionNameToModulePath: { - [zeroExJsDocSections.zeroEx]: ['"src/0x"'], - [zeroExJsDocSections.exchange]: ['"src/contract_wrappers/exchange_wrapper"'], - [zeroExJsDocSections.tokenRegistry]: ['"src/contract_wrappers/token_registry_wrapper"'], - [zeroExJsDocSections.token]: ['"src/contract_wrappers/token_wrapper"'], - [zeroExJsDocSections.etherToken]: ['"src/contract_wrappers/ether_token_wrapper"'], + [zeroExJsDocSections.zeroEx]: ['"0x.js/src/0x"', '"src/0x"'], + [zeroExJsDocSections.exchange]: [ + '"0x.js/src/contract_wrappers/exchange_wrapper"', + '"src/contract_wrappers/exchange_wrapper"', + ], + [zeroExJsDocSections.tokenRegistry]: [ + '"0x.js/src/contract_wrappers/token_registry_wrapper"', + '"src/contract_wrappers/token_registry_wrapper"', + ], + [zeroExJsDocSections.token]: [ + '"0x.js/src/contract_wrappers/token_wrapper"', + '"src/contract_wrappers/token_wrapper"', + ], + [zeroExJsDocSections.etherToken]: [ + '"0x.js/src/contract_wrappers/ether_token_wrapper"', + '"src/contract_wrappers/ether_token_wrapper"', + ], [zeroExJsDocSections.proxy]: [ - '"src/contract_wrappers/proxy_wrapper"', + '"0x.js/src/contract_wrappers/proxy_wrapper"', + '"0x.js/src/contract_wrappers/token_transfer_proxy_wrapper"', '"src/contract_wrappers/token_transfer_proxy_wrapper"', ], - [zeroExJsDocSections.orderWatcher]: ['"src/order_watcher/order_state_watcher"'], - [zeroExJsDocSections.types]: ['"src/types"'], + [zeroExJsDocSections.orderWatcher]: [ + '"0x.js/src/order_watcher/order_state_watcher"', + '"src/order_watcher/order_state_watcher"', + ], + [zeroExJsDocSections.types]: ['"0x.js/src/types"', '"src/types"', '"types/src/index"'], }, menuSubsectionToVersionWhenIntroduced: { [zeroExJsDocSections.etherToken]: '0.7.1', -- cgit v1.2.3 From 456f09491354ca573475f0fc44009b83b2d72bf5 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Sat, 3 Mar 2018 16:52:59 +0100 Subject: Add support for merging multiple topLevel packages under a single section. For now, we simply merge the two package's children (works well for merging 0x.js types and @0xproject/types) --- packages/website/ts/utils/typedoc_utils.ts | 47 +++++++++++++++++------------- 1 file changed, 27 insertions(+), 20 deletions(-) (limited to 'packages') diff --git a/packages/website/ts/utils/typedoc_utils.ts b/packages/website/ts/utils/typedoc_utils.ts index 0f79410ae..7acb0a7cb 100644 --- a/packages/website/ts/utils/typedoc_utils.ts +++ b/packages/website/ts/utils/typedoc_utils.ts @@ -41,18 +41,17 @@ export const typeDocUtils = { isPrivateOrProtectedProperty(propertyName: string): boolean { return _.startsWith(propertyName, '_'); }, - getModuleDefinitionBySectionNameIfExists( - versionDocObj: TypeDocNode, - modulePaths: string[], - ): TypeDocNode | undefined { - const modules = versionDocObj.children; - for (const mod of modules) { - if (_.includes(modulePaths, mod.name)) { - const moduleWithName = mod; - return moduleWithName; - } - } - return undefined; + getModuleDefinitionsBySectionName(versionDocObj: TypeDocNode, configModulePaths: string[]): TypeDocNode[] { + const moduleDefinitions: TypeDocNode[] = []; + const jsonModules = versionDocObj.children; + _.each(jsonModules, jsonMod => { + _.each(configModulePaths, configModulePath => { + if (_.includes(configModulePath, jsonMod.name)) { + moduleDefinitions.push(jsonMod); + } + }); + }); + return moduleDefinitions; }, convertToDocAgnosticFormat(typeDocJson: TypeDocNode, docsInfo: DocsInfo): DocAgnosticFormat { const subMenus = _.values(docsInfo.getMenu()); @@ -63,12 +62,20 @@ export const typeDocUtils = { if (_.isUndefined(modulePathsIfExists)) { return; // no-op } - const packageDefinitionIfExists = typeDocUtils.getModuleDefinitionBySectionNameIfExists( - typeDocJson, - modulePathsIfExists, - ); - if (_.isUndefined(packageDefinitionIfExists)) { + const packageDefinitions = typeDocUtils.getModuleDefinitionsBySectionName(typeDocJson, modulePathsIfExists); + let packageDefinitionWithMergedChildren; + if (_.isEmpty(packageDefinitions)) { return; // no-op + } else if (packageDefinitions.length === 1) { + packageDefinitionWithMergedChildren = packageDefinitions[0]; + } else { + packageDefinitionWithMergedChildren = packageDefinitions[0]; + for (let i = 1; i < packageDefinitions.length; i++) { + packageDefinitionWithMergedChildren.children = [ + ...packageDefinitionWithMergedChildren.children, + ...packageDefinitions[i].children, + ]; + } } // Since the `types.ts` file is the only file that does not export a module/class but @@ -77,10 +84,10 @@ export const typeDocUtils = { let entities; let packageComment = ''; if (sectionName === docsInfo.sections.types) { - entities = packageDefinitionIfExists.children; + entities = packageDefinitionWithMergedChildren.children; } else { - entities = packageDefinitionIfExists.children[0].children; - const commentObj = packageDefinitionIfExists.children[0].comment; + entities = packageDefinitionWithMergedChildren.children[0].children; + const commentObj = packageDefinitionWithMergedChildren.children[0].comment; packageComment = !_.isUndefined(commentObj) ? commentObj.shortText : packageComment; } -- cgit v1.2.3 From 5794349d979be64deef0cf1cbb9e69b5691f99df Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Sat, 3 Mar 2018 17:02:12 +0100 Subject: Add comment about typeDoc versions --- packages/website/ts/types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages') diff --git a/packages/website/ts/types.ts b/packages/website/ts/types.ts index 5786787c0..28663270e 100644 --- a/packages/website/ts/types.ts +++ b/packages/website/ts/types.ts @@ -308,7 +308,7 @@ export interface TypeDocNode { returns?: string; declaration: TypeDocNode; flags?: TypeDocFlags; - indexSignature?: TypeDocNode | TypeDocNode[]; + indexSignature?: TypeDocNode | TypeDocNode[]; // TypeDocNode in TypeDoc V0.9.0 signatures?: TypeDocNode[]; parameters?: TypeDocNode[]; typeParameter?: TypeDocNode[]; -- cgit v1.2.3 From 1b5742fbf094ae9e5e745fa61760fb0a4eb871ec Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Sat, 3 Mar 2018 17:03:51 +0100 Subject: Add hack comment --- packages/website/ts/utils/typedoc_utils.ts | 3 +++ 1 file changed, 3 insertions(+) (limited to 'packages') diff --git a/packages/website/ts/utils/typedoc_utils.ts b/packages/website/ts/utils/typedoc_utils.ts index 7acb0a7cb..eb4b05e04 100644 --- a/packages/website/ts/utils/typedoc_utils.ts +++ b/packages/website/ts/utils/typedoc_utils.ts @@ -69,6 +69,9 @@ export const typeDocUtils = { } else if (packageDefinitions.length === 1) { packageDefinitionWithMergedChildren = packageDefinitions[0]; } else { + // HACK: For now, if there are two modules to display in a single section, + // we simply concat the children. This works for our limited use-case where + // we want to display types stored in two files under a single section packageDefinitionWithMergedChildren = packageDefinitions[0]; for (let i = 1; i < packageDefinitions.length; i++) { packageDefinitionWithMergedChildren.children = [ -- cgit v1.2.3 From 839e5895e41c849d69b493ad2a1e85c8504c38b2 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Sat, 3 Mar 2018 21:34:13 +0100 Subject: Instead of adding `@0xproject/types` to tsconfig.json, let's only add it when calling TypeDoc --- packages/0x.js/package.json | 2 +- packages/0x.js/scripts/postpublish.js | 6 +++++- packages/0x.js/scripts/stagedocs.js | 6 +++++- packages/0x.js/tsconfig.json | 1 - packages/connect/package.json | 2 +- packages/connect/scripts/postpublish.js | 6 +++++- packages/connect/scripts/stagedocs.js | 6 +++++- 7 files changed, 22 insertions(+), 7 deletions(-) (limited to 'packages') diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json index e51ad5def..85f865192 100644 --- a/packages/0x.js/package.json +++ b/packages/0x.js/package.json @@ -15,7 +15,7 @@ "build:watch": "tsc -w", "prebuild": "run-s clean generate_contract_wrappers", "build": "run-p build:umd:prod build:commonjs; exit 0;", - "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH", + "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", "generate_contract_wrappers": "node ../abi-gen/lib/index.js --abis 'src/artifacts/@(Exchange|Token|TokenTransferProxy|EtherToken|TokenRegistry|DummyToken).json' --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/contract_wrappers/generated --backend ethers && prettier --write 'src/contract_wrappers/generated/**.ts'", "lint": "tslint --project . 'src/**/*.ts' 'test/**/*.ts'", diff --git a/packages/0x.js/scripts/postpublish.js b/packages/0x.js/scripts/postpublish.js index de2c5158e..7358f76c7 100644 --- a/packages/0x.js/scripts/postpublish.js +++ b/packages/0x.js/scripts/postpublish.js @@ -1,9 +1,13 @@ const execAsync = require('async-child-process').execAsync; const postpublish_utils = require('../../../scripts/postpublish_utils'); const packageJSON = require('../package.json'); +const tsConfig = require('../tsconfig.json'); const cwd = __dirname + '/..'; const subPackageName = packageJSON.name; +const fileIncludes = [...tsConfig.include, '../types/src/index.ts']; +const fileIncludesAdjusted = postpublish_utils.adjustFileIncludePaths(fileIncludes, __dirname); +const projectFiles = fileIncludesAdjusted.join(' '); const S3BucketPath = 's3://0xjs-docs-jsons/'; let tag; @@ -20,7 +24,7 @@ postpublish_utils .then(function(release) { console.log('POSTPUBLISH: Release successful, generating docs...'); const jsonFilePath = __dirname + '/../' + postpublish_utils.generatedDocsDirectoryName + '/index.json'; - return execAsync('JSON_FILE_PATH=' + jsonFilePath + ' yarn docs:json', { + return execAsync('JSON_FILE_PATH=' + jsonFilePath + ' PROJECT_FILES="' + projectFiles + '" yarn docs:json', { cwd, }); }) diff --git a/packages/0x.js/scripts/stagedocs.js b/packages/0x.js/scripts/stagedocs.js index c936757bf..5f2546917 100644 --- a/packages/0x.js/scripts/stagedocs.js +++ b/packages/0x.js/scripts/stagedocs.js @@ -1,12 +1,16 @@ const execAsync = require('async-child-process').execAsync; const postpublish_utils = require('../../../scripts/postpublish_utils'); +const tsConfig = require('../tsconfig.json'); const cwd = __dirname + '/..'; const S3BucketPath = 's3://staging-0xjs-docs-jsons/'; +const fileIncludes = [...tsConfig.include, '../types/src/index.ts']; +const fileIncludesAdjusted = postpublish_utils.adjustFileIncludePaths(fileIncludes, __dirname); +const projectFiles = fileIncludesAdjusted.join(' '); const jsonFilePath = __dirname + '/../' + postpublish_utils.generatedDocsDirectoryName + '/index.json'; const version = process.env.DOCS_VERSION; -execAsync('JSON_FILE_PATH=' + jsonFilePath + ' yarn docs:json', { +execAsync('JSON_FILE_PATH=' + jsonFilePath + ' PROJECT_FILES="' + projectFiles + '" yarn docs:json', { cwd, }) .then(function(result) { diff --git a/packages/0x.js/tsconfig.json b/packages/0x.js/tsconfig.json index 70ef5a624..a6b5c71c2 100644 --- a/packages/0x.js/tsconfig.json +++ b/packages/0x.js/tsconfig.json @@ -7,7 +7,6 @@ "include": [ "./src/**/*", "./test/**/*", - "../types/src/index.ts", "../../node_modules/types-bn/index.d.ts", "../../node_modules/types-ethereumjs-util/index.d.ts", "../../node_modules/ethers-typescript-typings/index.d.ts", diff --git a/packages/connect/package.json b/packages/connect/package.json index 9cc41a10d..5ee2dcdcf 100644 --- a/packages/connect/package.json +++ b/packages/connect/package.json @@ -15,7 +15,7 @@ "build:watch": "tsc -w", "build": "tsc", "clean": "shx rm -rf _bundles lib test_temp", - "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH", + "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", "copy_test_fixtures": "copyfiles -u 2 './test/fixtures/**/*.json' ./lib/test/fixtures", "lint": "tslint --project . 'src/**/*.ts' 'test/**/*.ts'", diff --git a/packages/connect/scripts/postpublish.js b/packages/connect/scripts/postpublish.js index 01c349cb8..df201bab4 100644 --- a/packages/connect/scripts/postpublish.js +++ b/packages/connect/scripts/postpublish.js @@ -1,10 +1,14 @@ const execAsync = require('async-child-process').execAsync; const postpublish_utils = require('../../../scripts/postpublish_utils'); const packageJSON = require('../package.json'); +const tsConfig = require('../tsconfig.json'); const cwd = __dirname + '/..'; const subPackageName = packageJSON.name; const S3BucketPath = 's3://connect-docs-jsons/'; +const fileIncludes = [...tsConfig.include, '../types/src/index.ts']; +const fileIncludesAdjusted = postpublish_utils.adjustFileIncludePaths(fileIncludes, __dirname); +const projectFiles = fileIncludesAdjusted.join(' '); let tag; let version; @@ -19,7 +23,7 @@ postpublish_utils .then(function(release) { console.log('POSTPUBLISH: Release successful, generating docs...'); const jsonFilePath = __dirname + '/../' + postpublish_utils.generatedDocsDirectoryName + '/index.json'; - return execAsync('JSON_FILE_PATH=' + jsonFilePath + ' yarn docs:json', { + return execAsync('JSON_FILE_PATH=' + jsonFilePath + ' PROJECT_FILES="' + projectFiles + '" yarn docs:json', { cwd, }); }) diff --git a/packages/connect/scripts/stagedocs.js b/packages/connect/scripts/stagedocs.js index c8f44d90f..4b36864d9 100644 --- a/packages/connect/scripts/stagedocs.js +++ b/packages/connect/scripts/stagedocs.js @@ -1,12 +1,16 @@ const execAsync = require('async-child-process').execAsync; const postpublish_utils = require('../../../scripts/postpublish_utils'); +const tsConfig = require('../tsconfig.json'); const cwd = __dirname + '/..'; const S3BucketPath = 's3://staging-connect-docs-jsons/'; const jsonFilePath = __dirname + '/../' + postpublish_utils.generatedDocsDirectoryName + '/index.json'; const version = process.env.DOCS_VERSION; +const fileIncludes = [...tsConfig.include, '../types/src/index.ts']; +const fileIncludesAdjusted = postpublish_utils.adjustFileIncludePaths(fileIncludes, __dirname); +const projectFiles = fileIncludesAdjusted.join(' '); -execAsync('JSON_FILE_PATH=' + jsonFilePath + ' yarn docs:json', { +execAsync('JSON_FILE_PATH=' + jsonFilePath + ' PROJECT_FILES="' + projectFiles + '" yarn docs:json', { cwd, }) .then(function(result) { -- cgit v1.2.3 From d7a803d9fd117a3a36570b779738ac0209cce826 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Sat, 3 Mar 2018 21:37:36 +0100 Subject: Don't need any external packages for 0x connect docs yet --- packages/connect/scripts/postpublish.js | 4 +++- packages/connect/scripts/stagedocs.js | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'packages') diff --git a/packages/connect/scripts/postpublish.js b/packages/connect/scripts/postpublish.js index df201bab4..e447615f9 100644 --- a/packages/connect/scripts/postpublish.js +++ b/packages/connect/scripts/postpublish.js @@ -6,7 +6,9 @@ const tsConfig = require('../tsconfig.json'); const cwd = __dirname + '/..'; const subPackageName = packageJSON.name; const S3BucketPath = 's3://connect-docs-jsons/'; -const fileIncludes = [...tsConfig.include, '../types/src/index.ts']; +// Include any external packages that are part of the @0xproject/connect public interface +// to this array so that TypeDoc picks it up and adds it to the Docs JSON +const fileIncludes = [...tsConfig.include]; const fileIncludesAdjusted = postpublish_utils.adjustFileIncludePaths(fileIncludes, __dirname); const projectFiles = fileIncludesAdjusted.join(' '); diff --git a/packages/connect/scripts/stagedocs.js b/packages/connect/scripts/stagedocs.js index 4b36864d9..58272ab86 100644 --- a/packages/connect/scripts/stagedocs.js +++ b/packages/connect/scripts/stagedocs.js @@ -6,7 +6,9 @@ const cwd = __dirname + '/..'; const S3BucketPath = 's3://staging-connect-docs-jsons/'; const jsonFilePath = __dirname + '/../' + postpublish_utils.generatedDocsDirectoryName + '/index.json'; const version = process.env.DOCS_VERSION; -const fileIncludes = [...tsConfig.include, '../types/src/index.ts']; +// Include any external packages that are part of the @0xproject/connect public interface +// to this array so that TypeDoc picks it up and adds it to the Docs JSON +const fileIncludes = [...tsConfig.include]; const fileIncludesAdjusted = postpublish_utils.adjustFileIncludePaths(fileIncludes, __dirname); const projectFiles = fileIncludesAdjusted.join(' '); -- cgit v1.2.3 From aee15e5dff92c381bda06e77abe3706fe2671fec Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Sat, 3 Mar 2018 21:37:42 +0100 Subject: Add comments --- packages/0x.js/scripts/postpublish.js | 3 +++ packages/0x.js/scripts/stagedocs.js | 3 +++ 2 files changed, 6 insertions(+) (limited to 'packages') diff --git a/packages/0x.js/scripts/postpublish.js b/packages/0x.js/scripts/postpublish.js index 7358f76c7..7b1d79d8f 100644 --- a/packages/0x.js/scripts/postpublish.js +++ b/packages/0x.js/scripts/postpublish.js @@ -5,6 +5,9 @@ const tsConfig = require('../tsconfig.json'); const cwd = __dirname + '/..'; const subPackageName = packageJSON.name; +// Include any external packages that are part of the @0xproject/connect public interface +// to this array so that TypeDoc picks it up and adds it to the Docs JSON +// So far, we only have @0xproject/types as part of 0x.js's public interface. const fileIncludes = [...tsConfig.include, '../types/src/index.ts']; const fileIncludesAdjusted = postpublish_utils.adjustFileIncludePaths(fileIncludes, __dirname); const projectFiles = fileIncludesAdjusted.join(' '); diff --git a/packages/0x.js/scripts/stagedocs.js b/packages/0x.js/scripts/stagedocs.js index 5f2546917..717f96a15 100644 --- a/packages/0x.js/scripts/stagedocs.js +++ b/packages/0x.js/scripts/stagedocs.js @@ -4,6 +4,9 @@ const tsConfig = require('../tsconfig.json'); const cwd = __dirname + '/..'; const S3BucketPath = 's3://staging-0xjs-docs-jsons/'; +// Include any external packages that are part of the @0xproject/connect public interface +// to this array so that TypeDoc picks it up and adds it to the Docs JSON +// So far, we only have @0xproject/types as part of 0x.js's public interface. const fileIncludes = [...tsConfig.include, '../types/src/index.ts']; const fileIncludesAdjusted = postpublish_utils.adjustFileIncludePaths(fileIncludes, __dirname); const projectFiles = fileIncludesAdjusted.join(' '); -- cgit v1.2.3 From bd85fe0af3ce201710f92b995cf25dfc96fba953 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Sat, 3 Mar 2018 21:43:11 +0100 Subject: Fix comments --- packages/0x.js/scripts/postpublish.js | 2 +- packages/0x.js/scripts/stagedocs.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'packages') diff --git a/packages/0x.js/scripts/postpublish.js b/packages/0x.js/scripts/postpublish.js index 7b1d79d8f..1a9ab73ea 100644 --- a/packages/0x.js/scripts/postpublish.js +++ b/packages/0x.js/scripts/postpublish.js @@ -5,7 +5,7 @@ const tsConfig = require('../tsconfig.json'); const cwd = __dirname + '/..'; const subPackageName = packageJSON.name; -// Include any external packages that are part of the @0xproject/connect public interface +// Include any external packages that are part of the 0x.js public interface // to this array so that TypeDoc picks it up and adds it to the Docs JSON // So far, we only have @0xproject/types as part of 0x.js's public interface. const fileIncludes = [...tsConfig.include, '../types/src/index.ts']; diff --git a/packages/0x.js/scripts/stagedocs.js b/packages/0x.js/scripts/stagedocs.js index 717f96a15..f0ba55205 100644 --- a/packages/0x.js/scripts/stagedocs.js +++ b/packages/0x.js/scripts/stagedocs.js @@ -4,7 +4,7 @@ const tsConfig = require('../tsconfig.json'); const cwd = __dirname + '/..'; const S3BucketPath = 's3://staging-0xjs-docs-jsons/'; -// Include any external packages that are part of the @0xproject/connect public interface +// Include any external packages that are part of the 0x.js public interface // to this array so that TypeDoc picks it up and adds it to the Docs JSON // So far, we only have @0xproject/types as part of 0x.js's public interface. const fileIncludes = [...tsConfig.include, '../types/src/index.ts']; -- cgit v1.2.3 From 82c5be25644c69a71386b8ef50e4491356b47536 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Sun, 4 Mar 2018 15:29:14 +0100 Subject: Remove unnecessary type assertion --- packages/website/ts/utils/typedoc_utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages') diff --git a/packages/website/ts/utils/typedoc_utils.ts b/packages/website/ts/utils/typedoc_utils.ts index eb4b05e04..ce7df4dbb 100644 --- a/packages/website/ts/utils/typedoc_utils.ts +++ b/packages/website/ts/utils/typedoc_utils.ts @@ -186,7 +186,7 @@ export const typeDocUtils = { // Versions >0.9.0 have it as type TypeDocNode const indexSignature = doesIndexSignatureExist && isIndexSignatureArray - ? ((entity.indexSignature as TypeDocNode[])[0] as TypeDocNode) + ? (entity.indexSignature as TypeDocNode[])[0] : (entity.indexSignature as TypeDocNode); const indexSignatureIfExists = doesIndexSignatureExist ? typeDocUtils._convertIndexSignature(indexSignature, sections, sectionName, docId) -- cgit v1.2.3