diff options
author | Fabio Berger <me@fabioberger.com> | 2018-03-06 18:11:35 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-03-06 18:11:35 +0800 |
commit | f014a97e9ad583f5bdcece330ce2baf4847a6661 (patch) | |
tree | 658582e6515f4334d359d62e04a66deec66cdd28 /packages/website/ts/pages | |
parent | 5a90fece8020f9be5c0f52f6ccf65dacb824b1cd (diff) | |
parent | 5dd065410517f511b2e087dcd91839526bac95b5 (diff) | |
download | dexon-sol-tools-f014a97e9ad583f5bdcece330ce2baf4847a6661.tar dexon-sol-tools-f014a97e9ad583f5bdcece330ce2baf4847a6661.tar.gz dexon-sol-tools-f014a97e9ad583f5bdcece330ce2baf4847a6661.tar.bz2 dexon-sol-tools-f014a97e9ad583f5bdcece330ce2baf4847a6661.tar.lz dexon-sol-tools-f014a97e9ad583f5bdcece330ce2baf4847a6661.tar.xz dexon-sol-tools-f014a97e9ad583f5bdcece330ce2baf4847a6661.tar.zst dexon-sol-tools-f014a97e9ad583f5bdcece330ce2baf4847a6661.zip |
Merge branch 'development' into extractDocs
* development:
Also show staging 0x.js docs on development
Fix source links in docs with a hack to support old and new versions of the TypeDoc JSON files
remove from devDeps
Remove date for now
Add ethers typescript typings to 0x.js deps. The library works without this atm since another dep of 0x.js has it as a dep. But it's more robust to have it here.
Add missing instructions to add external types to tsconfig.json after installing the package
Diffstat (limited to 'packages/website/ts/pages')
-rw-r--r-- | packages/website/ts/pages/documentation/doc_page.tsx | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/packages/website/ts/pages/documentation/doc_page.tsx b/packages/website/ts/pages/documentation/doc_page.tsx index b3b58c0c8..83da81189 100644 --- a/packages/website/ts/pages/documentation/doc_page.tsx +++ b/packages/website/ts/pages/documentation/doc_page.tsx @@ -14,11 +14,13 @@ import { constants } from 'ts/utils/constants'; import { docUtils } from 'ts/utils/doc_utils'; import { Translate } from 'ts/utils/translate'; +const ZERO_EX_JS_VERSION_MISSING_TOPLEVEL_PATH = '0.32.4'; + +const isDevelopment = configs.ENVIRONMENT === Environments.DEVELOPMENT; const docIdToS3BucketName: { [id: string]: string } = { - [DocPackages.ZeroExJs]: '0xjs-docs-jsons', + [DocPackages.ZeroExJs]: isDevelopment ? 'staging-0xjs-docs-jsons' : '0xjs-docs-jsons', [DocPackages.SmartContracts]: 'smart-contracts-docs-json', - [DocPackages.Connect]: - configs.ENVIRONMENT === Environments.DEVELOPMENT ? 'staging-connect-docs-jsons' : 'connect-docs-jsons', + [DocPackages.Connect]: isDevelopment ? 'staging-connect-docs-jsons' : 'connect-docs-jsons', }; const docIdToSubpackageName: { [id: string]: string } = { @@ -121,13 +123,22 @@ export class DocPage extends React.Component<DocPageProps, DocPageState> { } private _getSourceUrl() { const url = this.props.docsInfo.packageUrl; - const pkg = docIdToSubpackageName[this.props.docsInfo.id]; + let pkg = docIdToSubpackageName[this.props.docsInfo.id]; let tagPrefix = pkg; const packagesWithNamespace = ['connect']; if (_.includes(packagesWithNamespace, pkg)) { tagPrefix = `@0xproject/${pkg}`; } - const sourceUrl = `${url}/blob/${tagPrefix}%40${this.props.docsVersion}/packages/${pkg}`; + // HACK: The following three lines exist for backward compatibility reasons + // Before exporting types from other packages as part of the 0x.js interface, + // all TypeDoc generated paths omitted the topLevel `0x.js` segment. Now it + // adds it, and for that reason, we need to make sure we don't add it twice in + // the source links we generate. + const semvers = semverSort.desc([this.props.docsVersion, ZERO_EX_JS_VERSION_MISSING_TOPLEVEL_PATH]); + const isVersionAfterTopLevelPathChange = semvers[0] !== ZERO_EX_JS_VERSION_MISSING_TOPLEVEL_PATH; + pkg = this.props.docsInfo.id === DocPackages.ZeroExJs && isVersionAfterTopLevelPathChange ? '' : `/${pkg}`; + + const sourceUrl = `${url}/blob/${tagPrefix}%40${this.props.docsVersion}/packages${pkg}`; return sourceUrl; } } |