diff options
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | packages/website/ts/pages/documentation/doc_page.tsx | 21 |
2 files changed, 17 insertions, 5 deletions
@@ -26,6 +26,7 @@ This repository is a monorepo including the 0x protocol smart contracts and nume | [`web3-typescript-typings`](/packages/web3-typescript-typings) | [](https://www.npmjs.com/package/web3-typescript-typings) | Web3 typescript typings | | [`@0xproject/abi-gen`](/packages/abi-gen) | [](https://www.npmjs.com/package/@0xproject/abi-gen) | Tool to generate TS wrappers from smart contract ABIs | | [`@0xproject/assert`](/packages/assert) | [](https://www.npmjs.com/package/@0xproject/assert) | Type and schema assertions used by our packages | +| [`@0xproject/base-contract`](/packages/base-contract) | [](https://www.npmjs.com/package/@0xproject/base-contract) | BaseContract to derive all auto-generated wrappers from | | [`@0xproject/connect`](/packages/connect) | [](https://www.npmjs.com/package/@0xproject/connect) | A Javascript library for interacting with the standard relayer api | | [`@0xproject/dev-utils`](/packages/dev-utils) | [](https://www.npmjs.com/package/@0xproject/dev-utils) | Dev utils to be shared across 0x projects and packages | | [`@0xproject/json-schemas`](/packages/json-schemas) | [](https://www.npmjs.com/package/@0xproject/json-schemas) | 0x-related json schemas | diff --git a/packages/website/ts/pages/documentation/doc_page.tsx b/packages/website/ts/pages/documentation/doc_page.tsx index 2c8f1c103..098df5bfd 100644 --- a/packages/website/ts/pages/documentation/doc_page.tsx +++ b/packages/website/ts/pages/documentation/doc_page.tsx @@ -13,11 +13,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 } = { @@ -120,13 +122,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; } } |