Docs update script (#312)

* fix build issues

* Fix docs script
This commit is contained in:
Atul R 2019-12-29 10:45:40 +05:30 committed by GitHub
parent 9fada0e168
commit 7680c0e6ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 518 additions and 8 deletions

View File

@ -15,7 +15,7 @@
"test": "qode ./node_modules/jest/bin/jest -i",
"lint:cpp": "clang-format -i --glob=src/cpp/**/*.[h,c]*",
"lint:ts": "tsc --noEmit && cross-env eslint './src/**/*.{ts,tsx,js,jsx}' --fix",
"docs": "typedoc && mv ./website/website/sidebars.js ./website/docs/api/sidebar-gen.js && rm -rf website/docs/api/generated/index.md"
"docs": "typedoc && node ./website/docs/scripts/fixdocs.js"
},
"dependencies": {
"@nodegui/qode": "^1.0.6",

View File

@ -33,6 +33,8 @@ Its the root base class in NodeGui world.
↳ [QIcon](qicon.md)
↳ [QFont](qfont.md)
↳ [EventWidget](eventwidget.md)
↳ [QSize](qsize.md)

View File

@ -345,16 +345,13 @@ ___
### setFont
**setFont**(`family`: string, `pointSize`: number, `weight`: number, `italic`: boolean): *void*
**setFont**(`font`: [QFont](qfont.md)): *void*
**Parameters:**
Name | Type | Default |
------ | ------ | ------ |
`family` | string | - |
`pointSize` | number | -1 |
`weight` | number | -1 |
`italic` | boolean | false |
Name | Type |
------ | ------ |
`font` | [QFont](qfont.md) |
**Returns:** *void*

View File

@ -0,0 +1,272 @@
---
id: "qfont"
title: "QFont"
sidebar_label: "QFont"
---
## Hierarchy
* [Component](component.md)
↳ **QFont**
## Index
### Constructors
* [constructor](qfont.md#constructor)
### Properties
* [native](qfont.md#native)
* [nodeChildren](qfont.md#nodechildren)
* [nodeParent](qfont.md#optional-nodeparent)
### Methods
* [capitalization](qfont.md#capitalization)
* [family](qfont.md#family)
* [italic](qfont.md#italic)
* [pointSize](qfont.md#pointsize)
* [setCapitalization](qfont.md#setcapitalization)
* [setFamily](qfont.md#setfamily)
* [setItalic](qfont.md#setitalic)
* [setNodeParent](qfont.md#setnodeparent)
* [setPointSize](qfont.md#setpointsize)
* [setStretch](qfont.md#setstretch)
* [setWeight](qfont.md#setweight)
* [stretch](qfont.md#stretch)
* [toString](qfont.md#tostring)
* [weight](qfont.md#weight)
* [fromQVariant](qfont.md#static-fromqvariant)
## Constructors
### constructor
\+ **new QFont**(): *[QFont](qfont.md)*
*Overrides [Component](component.md).[constructor](component.md#constructor)*
**Returns:** *[QFont](qfont.md)*
\+ **new QFont**(`font?`: [QFont](qfont.md)): *[QFont](qfont.md)*
*Overrides [Component](component.md).[constructor](component.md#constructor)*
**Parameters:**
Name | Type |
------ | ------ |
`font?` | [QFont](qfont.md) |
**Returns:** *[QFont](qfont.md)*
\+ **new QFont**(`family?`: undefined | string, `pointSize?`: undefined | number, `weight?`: undefined | number, `italic?`: undefined | false | true): *[QFont](qfont.md)*
*Overrides [Component](component.md).[constructor](component.md#constructor)*
**Parameters:**
Name | Type |
------ | ------ |
`family?` | undefined | string |
`pointSize?` | undefined | number |
`weight?` | undefined | number |
`italic?` | undefined | false | true |
**Returns:** *[QFont](qfont.md)*
## Properties
### native
**native**: *[NativeElement](../globals.md#nativeelement)*
*Overrides [Component](component.md).[native](component.md#abstract-native)*
___
### nodeChildren
**nodeChildren**: *Set[Component](component.md)*
*Inherited from [Component](component.md).[nodeChildren](component.md#nodechildren)*
___
### `Optional` nodeParent
**nodeParent**? : *[Component](component.md)*
*Inherited from [Component](component.md).[nodeParent](component.md#optional-nodeparent)*
## Methods
### capitalization
**capitalization**(): *[QFontCapitalization](../enums/qfontcapitalization.md)*
**Returns:** *[QFontCapitalization](../enums/qfontcapitalization.md)*
___
### family
**family**(): *string*
**Returns:** *string*
___
### italic
**italic**(): *boolean*
**Returns:** *boolean*
___
### pointSize
**pointSize**(): *number*
**Returns:** *number*
___
### setCapitalization
**setCapitalization**(`caps`: [QFontCapitalization](../enums/qfontcapitalization.md)): *void*
**Parameters:**
Name | Type |
------ | ------ |
`caps` | [QFontCapitalization](../enums/qfontcapitalization.md) |
**Returns:** *void*
___
### setFamily
**setFamily**(`family`: string): *void*
**Parameters:**
Name | Type |
------ | ------ |
`family` | string |
**Returns:** *void*
___
### setItalic
**setItalic**(`enable`: boolean): *void*
**Parameters:**
Name | Type |
------ | ------ |
`enable` | boolean |
**Returns:** *void*
___
### setNodeParent
**setNodeParent**(`parent?`: [Component](component.md)): *void*
*Inherited from [Component](component.md).[setNodeParent](component.md#setnodeparent)*
**Parameters:**
Name | Type |
------ | ------ |
`parent?` | [Component](component.md) |
**Returns:** *void*
___
### setPointSize
**setPointSize**(`value`: number): *void*
**Parameters:**
Name | Type |
------ | ------ |
`value` | number |
**Returns:** *void*
___
### setStretch
**setStretch**(`factor`: [QFontStretch](../enums/qfontstretch.md)): *void*
**Parameters:**
Name | Type |
------ | ------ |
`factor` | [QFontStretch](../enums/qfontstretch.md) |
**Returns:** *void*
___
### setWeight
**setWeight**(`weight`: [QFontWeight](../enums/qfontweight.md)): *void*
**Parameters:**
Name | Type |
------ | ------ |
`weight` | [QFontWeight](../enums/qfontweight.md) |
**Returns:** *void*
___
### stretch
**stretch**(): *[QFontStretch](../enums/qfontstretch.md)*
**Returns:** *[QFontStretch](../enums/qfontstretch.md)*
___
### toString
**toString**(): *string*
**Returns:** *string*
___
### weight
**weight**(): *[QFontWeight](../enums/qfontweight.md)*
**Returns:** *[QFontWeight](../enums/qfontweight.md)*
___
### `Static` fromQVariant
**fromQVariant**(`variant`: [QVariant](qvariant.md)): *[QFont](qfont.md)*
**Parameters:**
Name | Type |
------ | ------ |
`variant` | [QVariant](qvariant.md) |
**Returns:** *[QFont](qfont.md)*

View File

@ -0,0 +1,45 @@
---
id: "qfontcapitalization"
title: "QFontCapitalization"
sidebar_label: "QFontCapitalization"
---
## Index
### Enumeration members
* [AllLowercase](qfontcapitalization.md#alllowercase)
* [AllUppercase](qfontcapitalization.md#alluppercase)
* [Capitalize](qfontcapitalization.md#capitalize)
* [MixedCase](qfontcapitalization.md#mixedcase)
* [SmallCaps](qfontcapitalization.md#smallcaps)
## Enumeration members
### AllLowercase
**AllLowercase**: = 2
___
### AllUppercase
**AllUppercase**: = 1
___
### Capitalize
**Capitalize**: = 4
___
### MixedCase
**MixedCase**: = 0
___
### SmallCaps
**SmallCaps**: = 3

View File

@ -0,0 +1,80 @@
---
id: "qfontstretch"
title: "QFontStretch"
sidebar_label: "QFontStretch"
---
## Index
### Enumeration members
* [AnyStretch](qfontstretch.md#anystretch)
* [Condensed](qfontstretch.md#condensed)
* [Expanded](qfontstretch.md#expanded)
* [ExtraCondensed](qfontstretch.md#extracondensed)
* [ExtraExpanded](qfontstretch.md#extraexpanded)
* [SemiCondensed](qfontstretch.md#semicondensed)
* [SemiExpanded](qfontstretch.md#semiexpanded)
* [UltraCondensed](qfontstretch.md#ultracondensed)
* [UltraExpanded](qfontstretch.md#ultraexpanded)
* [Unstretched](qfontstretch.md#unstretched)
## Enumeration members
### AnyStretch
**AnyStretch**: = 0
___
### Condensed
**Condensed**: = 75
___
### Expanded
**Expanded**: = 125
___
### ExtraCondensed
**ExtraCondensed**: = 62
___
### ExtraExpanded
**ExtraExpanded**: = 150
___
### SemiCondensed
**SemiCondensed**: = 87
___
### SemiExpanded
**SemiExpanded**: = 112
___
### UltraCondensed
**UltraCondensed**: = 50
___
### UltraExpanded
**UltraExpanded**: = 200
___
### Unstretched
**Unstretched**: = 100

View File

@ -0,0 +1,73 @@
---
id: "qfontweight"
title: "QFontWeight"
sidebar_label: "QFontWeight"
---
## Index
### Enumeration members
* [Black](qfontweight.md#black)
* [Bold](qfontweight.md#bold)
* [DemiBold](qfontweight.md#demibold)
* [ExtraBold](qfontweight.md#extrabold)
* [ExtraLight](qfontweight.md#extralight)
* [Light](qfontweight.md#light)
* [Medium](qfontweight.md#medium)
* [Normal](qfontweight.md#normal)
* [Thin](qfontweight.md#thin)
## Enumeration members
### Black
**Black**: = 87
___
### Bold
**Bold**: = 75
___
### DemiBold
**DemiBold**: = 63
___
### ExtraBold
**ExtraBold**: = 81
___
### ExtraLight
**ExtraLight**: = 12
___
### Light
**Light**: = 25
___
### Medium
**Medium**: = 57
___
### Normal
**Normal**: = 50
___
### Thin
**Thin**: = 0

View File

@ -76,6 +76,9 @@ sidebar_label: "Globals"
* [ParsingMode](enums/parsingmode.md)
* [PenStyle](enums/penstyle.md)
* [QClipboardMode](enums/qclipboardmode.md)
* [QFontCapitalization](enums/qfontcapitalization.md)
* [QFontStretch](enums/qfontstretch.md)
* [QFontWeight](enums/qfontweight.md)
* [QIconMode](enums/qiconmode.md)
* [QIconState](enums/qiconstate.md)
* [QStylePixelMetric](enums/qstylepixelmetric.md)
@ -138,6 +141,7 @@ sidebar_label: "Globals"
* [QCursor](classes/qcursor.md)
* [QDial](classes/qdial.md)
* [QFileDialog](classes/qfiledialog.md)
* [QFont](classes/qfont.md)
* [QFontDatabase](classes/qfontdatabase.md)
* [QGridLayout](classes/qgridlayout.md)
* [QGroupBox](classes/qgroupbox.md)

View File

View File

@ -20,6 +20,7 @@ module.exports = {
"api/generated/classes/qcursor",
"api/generated/classes/qdial",
"api/generated/classes/qfiledialog",
"api/generated/classes/qfont",
"api/generated/classes/qfontdatabase",
"api/generated/classes/qgridlayout",
"api/generated/classes/qgroupbox",
@ -130,6 +131,9 @@ module.exports = {
"api/generated/enums/parsingmode",
"api/generated/enums/penstyle",
"api/generated/enums/qclipboardmode",
"api/generated/enums/qfontcapitalization",
"api/generated/enums/qfontstretch",
"api/generated/enums/qfontweight",
"api/generated/enums/qiconmode",
"api/generated/enums/qiconstate",
"api/generated/enums/qstylepixelmetric",

View File

@ -0,0 +1,33 @@
const fs = require('fs');
const path = require('path');
async function renameFile(oldPath, newPath) {
return new Promise((resolve, reject) => {
fs.rename(oldPath, newPath, err => (err ? reject(err) : resolve()));
});
}
async function writeFile(filePath, fileContent) {
return new Promise((resolve, reject) => {
fs.writeFile(filePath, fileContent, err => (err ? reject(err) : resolve()));
});
}
async function moveGeneratedSideBar() {
const src = path.resolve(__dirname, `../../../website/website/sidebars.js`);
const dest = path.resolve(__dirname, `../../../website/docs/api/sidebar-gen.js`);
await renameFile(src, dest);
}
async function emptyIndexMd() {
const src = path.resolve(__dirname, `../../../website/docs/api/generated/index.md`);
await writeFile(src, '');
}
async function fixDocs() {
console.log('Fixing Docs...');
await moveGeneratedSideBar();
await emptyIndexMd();
console.log('Docs fixed successfully.');
}
fixDocs().catch(console.error);