aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2017-11-29 05:42:27 +0800
committerFabio Berger <me@fabioberger.com>2017-11-29 05:42:27 +0800
commit629a0fa3a562a9df00eeeb5ce5b1bad853008ac3 (patch)
treed71d2d829576fe2f8b4b882c35bd5f4ee0028451
parent15ce862334be14a7effcd55840ca96e425912df8 (diff)
downloaddexon-sol-tools-629a0fa3a562a9df00eeeb5ce5b1bad853008ac3.tar
dexon-sol-tools-629a0fa3a562a9df00eeeb5ce5b1bad853008ac3.tar.gz
dexon-sol-tools-629a0fa3a562a9df00eeeb5ce5b1bad853008ac3.tar.bz2
dexon-sol-tools-629a0fa3a562a9df00eeeb5ce5b1bad853008ac3.tar.lz
dexon-sol-tools-629a0fa3a562a9df00eeeb5ce5b1bad853008ac3.tar.xz
dexon-sol-tools-629a0fa3a562a9df00eeeb5ce5b1bad853008ac3.tar.zst
dexon-sol-tools-629a0fa3a562a9df00eeeb5ce5b1bad853008ac3.zip
Add subPackageName and get rid of hard-coded 0x.js in sourceLink
-rw-r--r--packages/website/ts/containers/zero_ex_js_documentation.tsx1
-rw-r--r--packages/website/ts/pages/documentation/docs_info.ts2
-rw-r--r--packages/website/ts/pages/documentation/documentation.tsx1
-rw-r--r--packages/website/ts/pages/documentation/method_block.tsx1
-rw-r--r--packages/website/ts/pages/documentation/source_link.tsx13
-rw-r--r--packages/website/ts/types.ts1
6 files changed, 17 insertions, 2 deletions
diff --git a/packages/website/ts/containers/zero_ex_js_documentation.tsx b/packages/website/ts/containers/zero_ex_js_documentation.tsx
index 15a137de1..cbb8fce5f 100644
--- a/packages/website/ts/containers/zero_ex_js_documentation.tsx
+++ b/packages/website/ts/containers/zero_ex_js_documentation.tsx
@@ -41,6 +41,7 @@ const zeroExJsDocSections = {
const docsInfoConfig: DocsInfoConfig = {
packageName: '0x.js',
packageUrl: 'https://github.com/0xProject/0x.js',
+ subPackageName: '0x.js',
websitePath: WebsitePaths.ZeroExJs,
docsJsonRoot: 'https://s3.amazonaws.com/0xjs-docs-jsons',
menu: {
diff --git a/packages/website/ts/pages/documentation/docs_info.ts b/packages/website/ts/pages/documentation/docs_info.ts
index f607c2185..fd8e9df74 100644
--- a/packages/website/ts/pages/documentation/docs_info.ts
+++ b/packages/website/ts/pages/documentation/docs_info.ts
@@ -13,6 +13,7 @@ import {
export class DocsInfo {
public packageName: string;
public packageUrl: string;
+ public subPackageName?: string;
public websitePath: string;
public docsJsonRoot: string;
public menu: DocsMenu;
@@ -22,6 +23,7 @@ export class DocsInfo {
constructor(config: DocsInfoConfig) {
this.packageName = config.packageName;
this.packageUrl = config.packageUrl;
+ this.subPackageName = config.subPackageName;
this.websitePath = config.websitePath;
this.docsJsonRoot = config.docsJsonRoot;
this.sections = config.sections;
diff --git a/packages/website/ts/pages/documentation/documentation.tsx b/packages/website/ts/pages/documentation/documentation.tsx
index 288a8f79c..b56441bfe 100644
--- a/packages/website/ts/pages/documentation/documentation.tsx
+++ b/packages/website/ts/pages/documentation/documentation.tsx
@@ -335,6 +335,7 @@ export class Documentation extends
version={this.props.docsVersion}
source={property.source}
baseUrl={this.props.docsInfo.packageUrl}
+ subPackageName={this.props.docsInfo.subPackageName}
/>
}
{property.comment &&
diff --git a/packages/website/ts/pages/documentation/method_block.tsx b/packages/website/ts/pages/documentation/method_block.tsx
index 3f4eb7164..44e549211 100644
--- a/packages/website/ts/pages/documentation/method_block.tsx
+++ b/packages/website/ts/pages/documentation/method_block.tsx
@@ -95,6 +95,7 @@ export class MethodBlock extends React.Component<MethodBlockProps, MethodBlockSt
version={this.props.libraryVersion}
source={(method as TypescriptMethod).source}
baseUrl={this.props.docsInfo.packageUrl}
+ subPackageName={this.props.docsInfo.subPackageName}
/>
}
{method.comment &&
diff --git a/packages/website/ts/pages/documentation/source_link.tsx b/packages/website/ts/pages/documentation/source_link.tsx
index 408dcabc7..74fc6d4d5 100644
--- a/packages/website/ts/pages/documentation/source_link.tsx
+++ b/packages/website/ts/pages/documentation/source_link.tsx
@@ -1,3 +1,4 @@
+import * as _ from 'lodash';
import {colors} from 'material-ui/styles';
import * as React from 'react';
import {Source} from 'ts/types';
@@ -7,14 +8,22 @@ interface SourceLinkProps {
source: Source;
baseUrl: string;
version: string;
+ subPackageName: string;
}
-const SUB_PKG = '0x.js';
+const packagesWithNamespace = [
+ 'connect',
+];
export function SourceLink(props: SourceLinkProps) {
const src = props.source;
const url = props.baseUrl;
- const sourceCodeUrl = `${url}/blob/${SUB_PKG}%40${props.version}/packages/${SUB_PKG}/${src.fileName}#L${src.line}`;
+ const pkg = props.subPackageName;
+ let tagPrefix = pkg;
+ if (_.includes(packagesWithNamespace, pkg)) {
+ tagPrefix = `@0xproject/${pkg}`;
+ }
+ const sourceCodeUrl = `${url}/blob/${tagPrefix}%40${props.version}/packages/${pkg}/${src.fileName}#L${src.line}`;
return (
<div className="pt2" style={{fontSize: 14}}>
<a
diff --git a/packages/website/ts/types.ts b/packages/website/ts/types.ts
index e9af8cb81..ca38cecc8 100644
--- a/packages/website/ts/types.ts
+++ b/packages/website/ts/types.ts
@@ -682,6 +682,7 @@ export interface DocsInfoConfig {
sectionNameToMarkdown: {[sectionName: string]: string};
visibleConstructors: string[];
convertToDocAgnosticFormatFn: (docObj: DoxityDocObj|TypeDocNode, docsInfo?: any) => DocAgnosticFormat;
+ subPackageName?: string;
publicTypes?: string[];
sectionNameToModulePath?: {[sectionName: string]: string[]};
menuSubsectionToVersionWhenIntroduced?: {[sectionName: string]: string};