aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.prettierignore1
-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
-rw-r--r--scripts/postpublish_utils.js56
-rw-r--r--yarn.lock64
23 files changed, 245 insertions, 110 deletions
diff --git a/.prettierignore b/.prettierignore
index 385c15654..5b8003c95 100644
--- a/.prettierignore
+++ b/.prettierignore
@@ -2,3 +2,4 @@ lib
.nyc_output
/packages/contracts/src/artifacts
package.json
+scripts/postpublish_utils.js
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)
diff --git a/scripts/postpublish_utils.js b/scripts/postpublish_utils.js
index 7ce01189c..6f990eb5e 100644
--- a/scripts/postpublish_utils.js
+++ b/scripts/postpublish_utils.js
@@ -1,3 +1,4 @@
+const _ = require('lodash');
const execAsync = require('async-child-process').execAsync;
const semverSort = require('semver-sort');
const publishRelease = require('publish-release');
@@ -11,23 +12,22 @@ module.exports = {
getLatestTagAndVersionAsync: function(subPackageName) {
const subPackagePrefix = subPackageName + '@';
const gitTagsCommand = 'git tag -l "' + subPackagePrefix + '*"';
- return execAsync(gitTagsCommand)
- .then(function(result) {
- if (result.stderr !== '') {
- throw new Error(result.stderr);
- }
- const tags = result.stdout.trim().split('\n');
- const versions = tags.map(function(tag) {
- return tag.slice(subPackagePrefix.length);
- });
- const sortedVersions = semverSort.desc(versions);
- const latestVersion = sortedVersions[0];
- const latestTag = subPackagePrefix + latestVersion;
- return {
- tag: latestTag,
- version: latestVersion
- };
+ return execAsync(gitTagsCommand).then(function(result) {
+ if (result.stderr !== '') {
+ throw new Error(result.stderr);
+ }
+ const tags = result.stdout.trim().split('\n');
+ const versions = tags.map(function(tag) {
+ return tag.slice(subPackagePrefix.length);
});
+ const sortedVersions = semverSort.desc(versions);
+ const latestVersion = sortedVersions[0];
+ const latestTag = subPackagePrefix + latestVersion;
+ return {
+ tag: latestTag,
+ version: latestVersion,
+ };
+ });
},
publishReleaseNotesAsync: function(tag, releaseName, assets) {
console.log('POSTPUBLISH: Releasing ', releaseName, '...');
@@ -43,7 +43,7 @@ module.exports = {
reuseRelease: true,
reuseDraftOnly: false,
assets: assets,
- });
+ });
},
getReleaseName(subPackageName, version) {
const releaseName = subPackageName + ' v' + version;
@@ -51,14 +51,26 @@ module.exports = {
},
standardPostPublishAsync: function(subPackageName) {
return this.getLatestTagAndVersionAsync(subPackageName)
- .then(function(result) {
- const releaseName = this.getReleaseName(subPackageName, result.version);
- const assets = [];
- return this.publishReleaseNotesAsync(result.tag, releaseName, assets);
- }.bind(this))
+ .then(
+ function(result) {
+ const releaseName = this.getReleaseName(subPackageName, result.version);
+ const assets = [];
+ return this.publishReleaseNotesAsync(result.tag, releaseName, assets);
+ }.bind(this)
+ )
.catch(function(err) {
throw err;
});
},
+ adjustFileIncludePaths: function(fileIncludes, cwd) {
+ const fileIncludesAdjusted = _.map(fileIncludes, fileInclude => {
+ if (_.startsWith(fileInclude, '../')) {
+ return cwd + '/../' + fileInclude;
+ } else if (_.startsWith('./')) {
+ return cwd + '/../' + fileInclude;
+ }
+ });
+ return fileIncludesAdjusted;
+ },
generatedDocsDirectoryName,
};
diff --git a/yarn.lock b/yarn.lock
index 55a91e1b0..a1e35e3f1 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -61,6 +61,12 @@
dependencies:
"@types/node" "*"
+"@types/fs-extra@5.0.0":
+ version "5.0.0"
+ resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-5.0.0.tgz#d3e225b35eb5c6d3a5a782c28219df365c781413"
+ dependencies:
+ "@types/node" "*"
+
"@types/fs-extra@^4.0.0":
version "4.0.7"
resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-4.0.7.tgz#02533262386b5a6b9a49797dc82feffdf269140a"
@@ -75,11 +81,11 @@
"@types/minimatch" "*"
"@types/node" "*"
-"@types/handlebars@^4.0.31", "@types/handlebars@^4.0.36":
+"@types/handlebars@4.0.36", "@types/handlebars@^4.0.31", "@types/handlebars@^4.0.36":
version "4.0.36"
resolved "https://registry.yarnpkg.com/@types/handlebars/-/handlebars-4.0.36.tgz#ff57c77fa1ab6713bb446534ddc4d979707a3a79"
-"@types/highlight.js@^9.1.8":
+"@types/highlight.js@9.12.2", "@types/highlight.js@^9.1.8":
version "9.12.2"
resolved "https://registry.yarnpkg.com/@types/highlight.js/-/highlight.js-9.12.2.tgz#6ee7cd395effe5ec80b515d3ff1699068cd0cd1d"
@@ -109,10 +115,18 @@
version "4.14.92"
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.92.tgz#6e3cb0b71a1e12180a47a42a744e856c3ae99a57"
+"@types/lodash@4.14.99":
+ version "4.14.99"
+ resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.99.tgz#e6e10c0a4cc16c7409b3181f1e66880d2fb7d4dc"
+
"@types/marked@0.0.28":
version "0.0.28"
resolved "https://registry.yarnpkg.com/@types/marked/-/marked-0.0.28.tgz#44ba754e9fa51432583e8eb30a7c4dd249b52faa"
+"@types/marked@0.3.0":
+ version "0.3.0"
+ resolved "https://registry.yarnpkg.com/@types/marked/-/marked-0.3.0.tgz#583c223dd33385a1dda01aaf77b0cd0411c4b524"
+
"@types/material-ui@0.18.0":
version "0.18.0"
resolved "https://registry.yarnpkg.com/@types/material-ui/-/material-ui-0.18.0.tgz#f3abc5431df8faa4592233c6c5377f2843eb807f"
@@ -124,7 +138,7 @@
version "2.0.0"
resolved "https://registry.yarnpkg.com/@types/mime/-/mime-2.0.0.tgz#5a7306e367c539b9f6543499de8dd519fac37a8b"
-"@types/minimatch@*":
+"@types/minimatch@*", "@types/minimatch@3.0.3":
version "3.0.3"
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d"
@@ -244,7 +258,7 @@
"@types/express-serve-static-core" "*"
"@types/mime" "*"
-"@types/shelljs@^0.7.0":
+"@types/shelljs@0.7.7", "@types/shelljs@^0.7.0":
version "0.7.7"
resolved "https://registry.yarnpkg.com/@types/shelljs/-/shelljs-0.7.7.tgz#1f7bfa28947661afea06365db9b1135bbc903ec4"
dependencies:
@@ -3757,6 +3771,14 @@ fs-extra@^4.0.0, fs-extra@^4.0.1:
jsonfile "^4.0.0"
universalify "^0.1.0"
+fs-extra@^5.0.0:
+ version "5.0.0"
+ resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-5.0.0.tgz#414d0110cdd06705734d055652c5411260c31abd"
+ dependencies:
+ graceful-fs "^4.1.2"
+ jsonfile "^4.0.0"
+ universalify "^0.1.0"
+
fs-write-stream-atomic@^1.0.8:
version "1.0.10"
resolved "https://registry.yarnpkg.com/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz#b47df53493ef911df75731e70a9ded0189db40c9"
@@ -5689,6 +5711,10 @@ markdown-escapes@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/markdown-escapes/-/markdown-escapes-1.0.1.tgz#1994df2d3af4811de59a6714934c2b2292734518"
+marked@^0.3.12:
+ version "0.3.17"
+ resolved "https://registry.yarnpkg.com/marked/-/marked-0.3.17.tgz#607f06668b3c6b1246b28f13da76116ac1aa2d2b"
+
marked@^0.3.5:
version "0.3.12"
resolved "https://registry.yarnpkg.com/marked/-/marked-0.3.12.tgz#7cf25ff2252632f3fe2406bde258e94eee927519"
@@ -8234,6 +8260,14 @@ shelljs@^0.7.0, shelljs@^0.7.3:
interpret "^1.0.0"
rechoir "^0.6.2"
+shelljs@^0.8.1:
+ version "0.8.1"
+ resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.8.1.tgz#729e038c413a2254c4078b95ed46e0397154a9f1"
+ dependencies:
+ glob "^7.0.0"
+ interpret "^1.0.0"
+ rechoir "^0.6.2"
+
shx@^0.2.2:
version "0.2.2"
resolved "https://registry.yarnpkg.com/shx/-/shx-0.2.2.tgz#0a304d020b0edf1306ad81570e80f0346df58a39"
@@ -9180,6 +9214,28 @@ typedoc-default-themes@^0.5.0:
version "0.5.0"
resolved "https://registry.yarnpkg.com/typedoc-default-themes/-/typedoc-default-themes-0.5.0.tgz#6dc2433e78ed8bea8e887a3acde2f31785bd6227"
+typedoc@0xProject/typedoc:
+ version "0.10.0"
+ resolved "https://codeload.github.com/0xProject/typedoc/tar.gz/a9970a52f0924fec2df608abe30ff81153b3def2"
+ dependencies:
+ "@types/fs-extra" "5.0.0"
+ "@types/handlebars" "4.0.36"
+ "@types/highlight.js" "9.12.2"
+ "@types/lodash" "4.14.99"
+ "@types/marked" "0.3.0"
+ "@types/minimatch" "3.0.3"
+ "@types/shelljs" "0.7.7"
+ fs-extra "^5.0.0"
+ handlebars "^4.0.6"
+ highlight.js "^9.0.0"
+ lodash "^4.13.1"
+ marked "^0.3.12"
+ minimatch "^3.0.0"
+ progress "^2.0.0"
+ shelljs "^0.8.1"
+ typedoc-default-themes "^0.5.0"
+ typescript "2.7.1"
+
typedoc@~0.8.0:
version "0.8.0"
resolved "https://registry.yarnpkg.com/typedoc/-/typedoc-0.8.0.tgz#d7172bc6a29964f451b7609c005beadadefe2361"