aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-03-04 23:33:58 +0800
committerFabio Berger <me@fabioberger.com>2018-03-04 23:33:58 +0800
commit9ac1cce26fcf17d161b7d67b3240728d623a1085 (patch)
treeb00482542d91e1374f1a470314afc26957d2f35b /packages
parent02f82be094dbaf92a1ae6752b9f05dbf6188cf86 (diff)
parent0a597c94d6359c34dc0ab2d3cc4e1dfecaecf18a (diff)
downloaddexon-sol-tools-9ac1cce26fcf17d161b7d67b3240728d623a1085.tar
dexon-sol-tools-9ac1cce26fcf17d161b7d67b3240728d623a1085.tar.gz
dexon-sol-tools-9ac1cce26fcf17d161b7d67b3240728d623a1085.tar.bz2
dexon-sol-tools-9ac1cce26fcf17d161b7d67b3240728d623a1085.tar.lz
dexon-sol-tools-9ac1cce26fcf17d161b7d67b3240728d623a1085.tar.xz
dexon-sol-tools-9ac1cce26fcf17d161b7d67b3240728d623a1085.tar.zst
dexon-sol-tools-9ac1cce26fcf17d161b7d67b3240728d623a1085.zip
Merge branch 'development' into improveLedgerSubprovider
* development: (28 commits) Remove unnecessary type assertion Fix comments Add comments Don't need any external packages for 0x connect docs yet Instead of adding `@0xproject/types` to tsconfig.json, let's only add it when calling TypeDoc Fix styling Make prettier ignore postpublish_utils Add hack comment Add comment about typeDoc versions 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) Because we now include non-0x.js source, the keys changed. Needed to add both for backward compatibility with old doc JSON's Add support for backward compatibility for TypeDoc versions <0.9.0 Consolidate all same exports together Add @0xproject/types to 0x.js tsconfig `include` so that TypeDoc also includes these types in the generated doc JSON Fix small bug where onHover type declarations with comments was taking up the entire window width 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 Move web3 typings from devDeps to deps remove extrenuous comma Add PR number Add changelog entries from types and utils ... # Conflicts: # packages/subproviders/CHANGELOG.md
Diffstat (limited to 'packages')
-rw-r--r--packages/0x.js/CHANGELOG.md1
-rw-r--r--packages/0x.js/package.json8
-rw-r--r--packages/0x.js/scripts/postpublish.js9
-rw-r--r--packages/0x.js/scripts/stagedocs.js33
-rw-r--r--packages/0x.js/src/index.ts3
-rw-r--r--packages/base-contract/package.json8
-rw-r--r--packages/connect/package.json2
-rw-r--r--packages/connect/scripts/postpublish.js8
-rw-r--r--packages/connect/scripts/stagedocs.js32
-rw-r--r--packages/subproviders/CHANGELOG.md3
-rw-r--r--packages/subproviders/package.json2
-rw-r--r--packages/types/CHANGELOG.md3
-rw-r--r--packages/types/package.json6
-rw-r--r--packages/utils/CHANGELOG.md1
-rw-r--r--packages/utils/package.json8
-rw-r--r--packages/web3-wrapper/package.json6
-rw-r--r--packages/website/ts/containers/zero_ex_js_documentation.ts33
-rw-r--r--packages/website/ts/pages/documentation/type_definition.tsx4
-rw-r--r--packages/website/ts/types.ts2
-rw-r--r--packages/website/ts/utils/typedoc_utils.ts62
20 files changed, 150 insertions, 84 deletions
diff --git a/packages/0x.js/CHANGELOG.md b/packages/0x.js/CHANGELOG.md
index b882a1b31..cbb3d45f4 100644
--- a/packages/0x.js/CHANGELOG.md
+++ b/packages/0x.js/CHANGELOG.md
@@ -6,6 +6,7 @@
* Improve validation to force passing contract addresses on private networks (#385)
* Change `LogErrorContractEventArgs.errorId` type from `BigNumber` to `number` (#413)
* Rename all public `_unsubscribeAll` methods to `unsubscribeAll` (#415)
+ * Move web3 typings from devDep to dep since cannot use this package without it (#429)
## v0.32.2 - _February 9, 2018_
diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json
index cc01d15ae..e129fcc1d 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 $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'",
@@ -73,12 +73,11 @@
"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",
"ethers-typescript-typings": "^0.0.1",
- "web3-typescript-typings": "^0.9.11",
"webpack": "^3.1.0"
},
"dependencies": {
@@ -97,6 +96,7 @@
"js-sha3": "^0.7.0",
"lodash": "^4.17.4",
"uuid": "^3.1.0",
- "web3": "^0.20.0"
+ "web3": "^0.20.0",
+ "web3-typescript-typings": "^0.9.11"
}
}
diff --git a/packages/0x.js/scripts/postpublish.js b/packages/0x.js/scripts/postpublish.js
index 7cbabd8f6..1a9ab73ea 100644
--- a/packages/0x.js/scripts/postpublish.js
+++ b/packages/0x.js/scripts/postpublish.js
@@ -1,9 +1,16 @@
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;
+// 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'];
+const fileIncludesAdjusted = postpublish_utils.adjustFileIncludePaths(fileIncludes, __dirname);
+const projectFiles = fileIncludesAdjusted.join(' ');
const S3BucketPath = 's3://0xjs-docs-jsons/';
let tag;
@@ -20,7 +27,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 + ' PROJECT_FILES="' + projectFiles + '" yarn docs:json', {
cwd,
});
})
diff --git a/packages/0x.js/scripts/stagedocs.js b/packages/0x.js/scripts/stagedocs.js
index b48c23851..f0ba55205 100644
--- a/packages/0x.js/scripts/stagedocs.js
+++ b/packages/0x.js/scripts/stagedocs.js
@@ -1,24 +1,31 @@
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/';
+// 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'];
+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 + ' PROJECT_DIR=' + __dirname + '/.. yarn docs:json', {
+execAsync('JSON_FILE_PATH=' + jsonFilePath + ' PROJECT_FILES="' + projectFiles + '" 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/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';
diff --git a/packages/base-contract/package.json b/packages/base-contract/package.json
index 65a1653f1..888b2fc75 100644
--- a/packages/base-contract/package.json
+++ b/packages/base-contract/package.json
@@ -25,15 +25,15 @@
"npm-run-all": "^4.1.2",
"shx": "^0.2.2",
"tslint": "5.8.0",
- "typescript": "2.7.1",
- "ethers-typescript-typings": "^0.0.1",
- "web3-typescript-typings": "^0.9.11"
+ "typescript": "2.7.1"
},
"dependencies": {
"@0xproject/types": "^0.2.3",
"@0xproject/web3-wrapper": "^0.1.14",
"ethers-contracts": "^2.2.1",
+ "ethers-typescript-typings": "^0.0.1",
"lodash": "^4.17.4",
- "web3": "^0.20.0"
+ "web3": "^0.20.0",
+ "web3-typescript-typings": "^0.9.11"
}
}
diff --git a/packages/connect/package.json b/packages/connect/package.json
index 059d0efad..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 $PROJECT_DIR",
+ "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 869bad099..e447615f9 100644
--- a/packages/connect/scripts/postpublish.js
+++ b/packages/connect/scripts/postpublish.js
@@ -1,10 +1,16 @@
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/';
+// 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(' ');
let tag;
let version;
@@ -19,7 +25,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 + ' PROJECT_FILES="' + projectFiles + '" yarn docs:json', {
cwd,
});
})
diff --git a/packages/connect/scripts/stagedocs.js b/packages/connect/scripts/stagedocs.js
index 868112a37..58272ab86 100644
--- a/packages/connect/scripts/stagedocs.js
+++ b/packages/connect/scripts/stagedocs.js
@@ -1,24 +1,30 @@
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;
+// 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(' ');
-execAsync('JSON_FILE_PATH=' + jsonFilePath + ' PROJECT_DIR=' + __dirname + '/.. yarn docs:json', {
+execAsync('JSON_FILE_PATH=' + jsonFilePath + ' PROJECT_FILES="' + projectFiles + '" 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/subproviders/CHANGELOG.md b/packages/subproviders/CHANGELOG.md
index e9899363e..0ae534746 100644
--- a/packages/subproviders/CHANGELOG.md
+++ b/packages/subproviders/CHANGELOG.md
@@ -1,7 +1,8 @@
# CHANGELOG
-## v0.5.1 - _TBD, 2018_
+## v0.6.0 - _TBD_
+ * Move web3 types from being a devDep to a dep since one cannot use this package without it (#429)
* Add `numberOfAccounts` param to `LedgerSubprovider` method `getAccountsAsync`
## v0.5.0 - _February 16, 2018_
diff --git a/packages/subproviders/package.json b/packages/subproviders/package.json
index 5e9c2ed89..6b702fcb3 100644
--- a/packages/subproviders/package.json
+++ b/packages/subproviders/package.json
@@ -30,6 +30,7 @@
"lodash": "^4.17.4",
"semaphore-async-await": "^1.5.1",
"web3": "^0.20.0",
+ "web3-typescript-typings": "^0.9.11",
"web3-provider-engine": "^13.0.1"
},
"devDependencies": {
@@ -51,7 +52,6 @@
"types-bn": "^0.0.1",
"types-ethereumjs-util": "0xProject/types-ethereumjs-util",
"typescript": "2.7.1",
- "web3-typescript-typings": "^0.9.11",
"webpack": "^3.1.0"
}
}
diff --git a/packages/types/CHANGELOG.md b/packages/types/CHANGELOG.md
index a4f293d60..b35433d62 100644
--- a/packages/types/CHANGELOG.md
+++ b/packages/types/CHANGELOG.md
@@ -1,9 +1,10 @@
# CHANGELOG
-## v0.2.4 - _TBD, 2018_
+## v0.3.0 - _TBD, 2018_
* Add `data` to `TxData` (#413)
* Add `number` as an option to `ContractEventArg` (#413)
+ * Move web3 types from devDep to dep since required when using this package (#429)
## v0.2.1 - _February 9, 2018_
diff --git a/packages/types/package.json b/packages/types/package.json
index d88a3a2da..966308287 100644
--- a/packages/types/package.json
+++ b/packages/types/package.json
@@ -23,11 +23,11 @@
"@0xproject/tslint-config": "^0.4.9",
"shx": "^0.2.2",
"tslint": "5.8.0",
- "typescript": "2.7.1",
- "web3-typescript-typings": "^0.9.11"
+ "typescript": "2.7.1"
},
"dependencies": {
"bignumber.js": "~4.1.0",
- "web3": "^0.20.0"
+ "web3": "^0.20.0",
+ "web3-typescript-typings": "^0.9.11"
}
}
diff --git a/packages/utils/CHANGELOG.md b/packages/utils/CHANGELOG.md
index 81792bee8..b19656ed7 100644
--- a/packages/utils/CHANGELOG.md
+++ b/packages/utils/CHANGELOG.md
@@ -3,6 +3,7 @@
## v0.4.0 - _TBD, 2018_
* Use `ethers-contracts` as a backend to decode event args (#413)
+ * Move web3 types from devDep to dep since required when using this package (#429)
## v0.3.2 - _February 9, 2018_
diff --git a/packages/utils/package.json b/packages/utils/package.json
index 8b6dbc825..33890f15b 100644
--- a/packages/utils/package.json
+++ b/packages/utils/package.json
@@ -25,16 +25,16 @@
"npm-run-all": "^4.1.2",
"shx": "^0.2.2",
"tslint": "5.8.0",
- "typescript": "2.7.1",
- "ethers-typescript-typings": "^0.0.1",
- "web3-typescript-typings": "^0.9.11"
+ "typescript": "2.7.1"
},
"dependencies": {
"@0xproject/types": "^0.2.3",
"bignumber.js": "~4.1.0",
"ethers-contracts": "^2.2.1",
+ "ethers-typescript-typings": "^0.0.1",
"js-sha3": "^0.7.0",
"lodash": "^4.17.4",
- "web3": "^0.20.0"
+ "web3": "^0.20.0",
+ "web3-typescript-typings": "^0.9.11"
}
}
diff --git a/packages/web3-wrapper/package.json b/packages/web3-wrapper/package.json
index c4ec6f23a..38038f393 100644
--- a/packages/web3-wrapper/package.json
+++ b/packages/web3-wrapper/package.json
@@ -25,8 +25,7 @@
"npm-run-all": "^4.1.2",
"shx": "^0.2.2",
"tslint": "5.8.0",
- "typescript": "2.7.1",
- "web3-typescript-typings": "^0.9.11"
+ "typescript": "2.7.1"
},
"dependencies": {
"@0xproject/types": "^0.2.3",
@@ -34,6 +33,7 @@
"ethers-contracts": "^2.2.1",
"ethers-typescript-typings": "^0.0.1",
"lodash": "^4.17.4",
- "web3": "^0.20.0"
+ "web3": "^0.20.0",
+ "web3-typescript-typings": "^0.9.11"
}
}
diff --git a/packages/website/ts/containers/zero_ex_js_documentation.ts b/packages/website/ts/containers/zero_ex_js_documentation.ts
index a9d3249ee..d0d697e70 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',
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<TypeDefinitionProps, TypeDef
<code className="hljs">{codeSnippet}</code>
</pre>
</div>
- {customType.comment && <Comment comment={customType.comment} className="py2" />}
+ <div style={{ maxWidth: 620 }}>
+ {customType.comment && <Comment comment={customType.comment} className="py2" />}
+ </div>
</div>
);
}
diff --git a/packages/website/ts/types.ts b/packages/website/ts/types.ts
index f0db537e6..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[];
+ indexSignature?: TypeDocNode | TypeDocNode[]; // TypeDocNode in TypeDoc <V0.9.0, TypeDocNode[] in >V0.9.0
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..ce7df4dbb 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,23 @@ 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 {
+ // 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 = [
+ ...packageDefinitionWithMergedChildren.children,
+ ...packageDefinitions[i].children,
+ ];
+ }
}
// Since the `types.ts` file is the only file that does not export a module/class but
@@ -77,10 +87,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;
}
@@ -170,8 +180,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]
+ : (entity.indexSignature as TypeDocNode);
+ const indexSignatureIfExists = doesIndexSignatureExist
+ ? typeDocUtils._convertIndexSignature(indexSignature, sections, sectionName, docId)
: undefined;
const commentIfExists =
!_.isUndefined(entity.comment) && !_.isUndefined(entity.comment.shortText)