Skip to content

Commit

Permalink
docs: updates, typedoc fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
vasilev-alex authored Jul 2, 2020
1 parent 0b050bc commit 0bf55cb
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 8 deletions.
5 changes: 3 additions & 2 deletions docs-gen/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
],
"scripts": {
"lint": "tslint --project ./tsconfig.json",
"generate": "yarn build && typedoc --excludeExternals --includeDeclarations --plugin ./dist/index.js --hideSources --hideIndexes --out ../docs/Cube.js-Frontend --name @cubejs-client-core ../packages/cubejs-client-core/index.d.ts",
"dev-generate": "copyfiles --up 1 ./src/**/*.hbs ./dist/ && yarn generate",
"generate": "yarn build && yarn gen-docs",
"gen-docs": "typedoc --excludeExternals --includeDeclarations --plugin ./dist/index.js --hideSources --hideIndexes --out ../docs/Cube.js-Frontend --name @cubejs-client-core ../packages/cubejs-client-core/index.d.ts",
"dev-gen": "copyfiles --up 1 ./src/**/*.hbs ./dist/ && yarn gen-docs",
"build": "rm -rf dist && tsc --sourceMap false --declaration false && copyfiles --up 1 ./src/**/*.hbs ./dist/",
"watch": "tsc-watch",
"prepublishOnly": "yarn test",
Expand Down
8 changes: 7 additions & 1 deletion docs-gen/src/resources/helpers/declaration-title.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,13 @@ export function declarationTitle(this: DeclarationReflection, showSymbol: boolea
md.push(memberSymbol.call(this));
}

md.push(`**${this.name}**${isOptional ? '? ' : ''}:`);
md.push(`**${this.name}**${isOptional ? '? ' : ''}`);

// We want to display enum members like:
// • DAY = "day"
if (this.kind !== ReflectionKind.EnumMember) {
md.push(':');
}

if (this.type) {
md.push(`*${type.call(this.type)}*`);
Expand Down
6 changes: 3 additions & 3 deletions docs-gen/src/resources/helpers/member-title.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { DeclarationReflection } from 'typedoc';
export function memberTitle(this: DeclarationReflection) {
const md = [];

if (this.flags) {
md.push(this.flags.map((flag) => `\`${flag}\``).join(' '));
}
// if (this.flags) {
// md.push(this.flags.map((flag) => `\`${flag}\``).join(' '));
// }
md.push(this.name);
return md.join(' ');
}
3 changes: 1 addition & 2 deletions docs-gen/src/resources/helpers/meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ export function meta(this: ProjectReflection) {

(comment?.tags || []).forEach((tag: CommentTag) => {
if (tag.tagName !== 'description') {
const escape = tag.tagName !== 'menuorder';
const text = escape ? `'${tag.text}'` : tag.text;
const text = tag.text.startsWith('@') ? `'${tag.text}'` : tag.text;
md.push(`${tagConverter(tag.tagName)}: ${text}`.replace('\n', ''));
}
});
Expand Down
6 changes: 6 additions & 0 deletions docs-gen/src/resources/helpers/signature-title.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ export function signatureTitle(this: SignatureReflection, showSymbol: boolean) {
md.push(`${memberSymbol.call(this)} `);
}

// eg: `static`
if (this.parent?.flags) {
md.push(this.parent.flags.map((flag) => `\`${flag}\``).join(' ').toLowerCase());
md.push(' ');
}

if (this.name === '__get') {
md.push(`**get ${this.parent.name}**`);
} else if (this.name === '__set') {
Expand Down
15 changes: 15 additions & 0 deletions docs/Schema/dimensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,18 @@ dimensions: {
}
}
```

### meta
Custom metadata. Can be used to pass any information to the frontend.
```javascript
dimensions: {
usersCount: {
sql: `${Users.count}`,
type: `number`,
//...
meta: {
any: 'value
}
}
}
```
13 changes: 13 additions & 0 deletions docs/Schema/measures.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,19 @@ revenue: {
}
```

### meta
Custom metadata. Can be used to pass any information to the frontend.
```javascript
revenue: {
type: `sum`,
sql: `price`,
//...
meta: {
any: 'value'
}
}
```

## Calculated Measures
In the case where you need to specify a formula for measure calculating with other measures, you can compose a formula in `sql`. For example, you want to calculate the conversion of buyers of all users.

Expand Down

0 comments on commit 0bf55cb

Please sign in to comment.