Skip to content

Commit 62b555c

Browse files
author
Martynas Žilinskas
authored
Merge pull request #38 from SimplrJS/dev
v0.2.0
2 parents 7a30161 + abd21be commit 62b555c

29 files changed

+320
-323
lines changed

common/config/rush/npm-shrinkwrap.json

Lines changed: 23 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/ts-docs-gen/.vscode/settings.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,8 @@
88
"**/CVS": true,
99
"**/.DS_Store": true,
1010
"tests/cases/__tests__/**/*.test.ts": true
11-
}
11+
},
12+
"editor.insertSpaces": true,
13+
"editor.tabSize": 4,
14+
"editor.detectIndentation": false
1215
}

packages/ts-docs-gen/README.md

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,15 @@ ts-docs-gen -h
1919
#### Without config
2020

2121
If you want to use `ts-docs-gen` without config file, `entryFile` flag is required.
22-
```
22+
```sh
2323
ts-docs-gen --entryFile ./src/index.ts
2424
```
2525

2626
Multiple entry files:
27-
```
27+
```sh
2828
ts-docs-gen --entryFile ./src/index.ts --entryFile ./src/internal.ts
29+
# Or
30+
ts-docs-gen --entryFile ./src/index.ts ./src/internal.ts
2931
```
3032

3133
#### With config
@@ -37,9 +39,15 @@ ts-docs-gen --config ./docs-gen.json
3739
## Configuration
3840
JSON config properties and CLI flags.
3941

40-
| Property | CLI Flag | Required | Type | Default | Description |
41-
|-------------|-------------------|------------|----------|---------------------------|--------------------------------------------|
42-
| `entryFile` | `--entryFile` | _required_ | string[] | | TypeScript project entry files. |
43-
| `project` | `--project`, `-p` | _optional_ | string | Current working directory | Full path to TypeScript project directory. |
44-
| `output` | `--output`, `-o` | _optional_ | string | ./docs/api/ | Documentation output directory. |
45-
| `plugin` | `--plugin` | _optional_ | string[] | | Packagename or path to plugin. |
42+
| Property | CLI Flag | Required | Type | Default | Description |
43+
| ------------------- | --------------------- | ---------- | ----------------------------------------------------------------------- | ------------- | ------------------------------------------------------------------------------------------ |
44+
| | `--config` | _optional_ | string | | Relative path to config json file. |
45+
| `entryFile` | `--entryFile` | _required_ | string[] | | TypeScript project entry files. |
46+
| `project` | `--project`, `-p` | _optional_ | string | cwd | Full path to TypeScript project directory. |
47+
| `output` | `--output`, `-o` | _optional_ | string | ./docs/api/ | Documentation output directory. |
48+
| `plugin` | `--plugin` | _optional_ | string[] | | Package name or path to plugin. |
49+
| `exclude` | `--exclude` | _optional_ | string[] | | File locations that should not be included generated documentation. |
50+
| `externalPackage` | `--externalPackage` | _optional_ | string[] | | External package names to include in extracted data. |
51+
| `excludePrivateApi` | `--excludePrivateApi` | _optional_ | boolean | `true` | Excludes api items that has access modifier set to "private" or JSDoc tag "@private". |
52+
| `verbosity` | `--verbosity` | _optional_ | "None", "Critical", "Error", "Warning", "Information", "Debug", "Trace" | "Information" | Verbosity of output. |
53+
| `dryRun` | `--dryRun` | _optional_ | boolean | | Generates markdown files but not writes them. Outputs generated data in `Debug` log level. |

packages/ts-docs-gen/package.json

Lines changed: 74 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,80 @@
11
{
2-
"name": "ts-docs-gen",
3-
"version": "0.1.0",
4-
"description": "Generating documentation for TypeScript code",
5-
"main": "./dist/index.js",
6-
"typings": "./dist/index.d.ts",
7-
"scripts": {
8-
"pretest": "npm run build -- --noEmit && npm run build-tests",
9-
"test": "npm run tslint && jest && echo All tests passed successfully.",
10-
"test-ci": "npm run pretest && npm run tslint && jest --maxWorkers=4 -b",
11-
"test-watch": "start npm run build-tests -- --watchAll && jest --watchAll",
12-
"tslint": "tslint --project . --config ./tslint.json && echo Successfully passed tslint test.",
13-
"build": "tsc -p .",
14-
"build-tests": "test-generator-cli"
15-
},
16-
"engine": "node >= 7.5.0",
17-
"author": "simplrjs <[email protected]> (https://github.com/simplrjs)",
18-
"dependencies": {
19-
"@simplrjs/markdown": "^1.1.0",
20-
"@types/fs-extra": "^5.0.0",
21-
"@types/yargs": "^10.0.1",
22-
"fs-extra": "^5.0.0",
23-
"simplr-logger": "^1.0.1",
24-
"ts-extractor": "^4.0.0-rc.1",
25-
"typescript": "^2.6.2",
26-
"yargs": "^11.0.0"
27-
},
28-
"devDependencies": {
29-
"@simplrjs/test-generator-cli": "^0.1.3",
30-
"@types/jest": "^22.1.1",
31-
"@types/sinon": "^4.1.3",
32-
"jest": "^22.1.4",
33-
"simplr-tslint": "0.0.1",
34-
"sinon": "^4.2.2",
35-
"ts-jest": "^22.0.2",
36-
"tslint": "^5.9.1"
37-
},
38-
"bin": "./dist/cli/launcher.js",
39-
"jest": {
40-
"collectCoverage": true,
41-
"mapCoverage": true,
42-
"transform": {
43-
".(ts|tsx)": "<rootDir>/node_modules/ts-jest/preprocessor.js"
2+
"name": "ts-docs-gen",
3+
"version": "0.2.0",
4+
"description": "Generating documentation for TypeScript code",
5+
"main": "./dist/index.js",
6+
"typings": "./dist/index.d.ts",
7+
"scripts": {
8+
"pretest": "npm run build -- --noEmit && npm run build-tests",
9+
"test": "npm run tslint && jest && echo All tests passed successfully.",
10+
"test-ci": "npm run pretest && npm run tslint && jest --maxWorkers=4 -b",
11+
"test-watch": "start npm run build-tests -- --watchAll && jest --watchAll",
12+
"tslint": "tslint --project . --config ./tslint.json && echo Successfully passed tslint test.",
13+
"build": "tsc -p .",
14+
"build-tests": "test-generator-cli"
4415
},
45-
"globals": {
46-
"ts-jest": {
47-
"skipBabel": true,
48-
"tsConfigFile": "tests/tsconfig.json"
49-
}
16+
"engine": "node >= 7.5.0",
17+
"author": "simplrjs <[email protected]> (https://github.com/simplrjs)",
18+
"contributors": [
19+
"Martynas Žilinskas <[email protected]> (https://github.com/MartynasZilinskas)",
20+
"Deividas Bakanas <[email protected]> (https://github.com/DeividasBakanas)"
21+
],
22+
"repository": {
23+
"type": "git",
24+
"url": "https://github.com/SimplrJS/ts-docs-gen"
5025
},
51-
"testRegex": "/__tests__/.*\\.(test|spec).(ts|tsx|js)$",
52-
"moduleNameMapper": {
53-
"@src/(.*)": "<rootDir>/src/$1"
26+
"dependencies": {
27+
"@simplrjs/markdown": "^1.1.0",
28+
"@types/fs-extra": "^5.0.0",
29+
"@types/yargs": "^10.0.1",
30+
"fs-extra": "^5.0.0",
31+
"simplr-logger": "^1.0.1",
32+
"ts-extractor": "^4.0.0-rc.4",
33+
"typescript": "^2.7.1",
34+
"yargs": "^11.0.0"
5435
},
55-
"coveragePathIgnorePatterns": [
56-
"/node_modules/",
57-
"/tests/"
58-
],
59-
"moduleFileExtensions": [
60-
"ts",
61-
"tsx",
62-
"js"
36+
"devDependencies": {
37+
"@simplrjs/test-generator-cli": "^0.1.3",
38+
"@types/jest": "^22.1.1",
39+
"@types/sinon": "^4.1.3",
40+
"jest": "^22.1.4",
41+
"simplr-tslint": "0.0.1",
42+
"sinon": "^4.2.2",
43+
"ts-jest": "^22.0.2",
44+
"tslint": "^5.9.1"
45+
},
46+
"bin": "./dist/cli/launcher.js",
47+
"files": [
48+
"dist",
49+
"**/*.md",
50+
"@types",
51+
"!/examples"
6352
],
64-
"verbose": true
65-
}
53+
"jest": {
54+
"collectCoverage": true,
55+
"mapCoverage": true,
56+
"transform": {
57+
".(ts|tsx)": "<rootDir>/node_modules/ts-jest/preprocessor.js"
58+
},
59+
"globals": {
60+
"ts-jest": {
61+
"skipBabel": true,
62+
"tsConfigFile": "tests/tsconfig.json"
63+
}
64+
},
65+
"testRegex": "/__tests__/.*\\.(test|spec).(ts|tsx|js)$",
66+
"moduleNameMapper": {
67+
"@src/(.*)": "<rootDir>/src/$1"
68+
},
69+
"coveragePathIgnorePatterns": [
70+
"/node_modules/",
71+
"/tests/"
72+
],
73+
"moduleFileExtensions": [
74+
"ts",
75+
"tsx",
76+
"js"
77+
],
78+
"verbose": true
79+
}
6680
}

packages/ts-docs-gen/src/api-items/api-callable.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { ReferenceRenderHandler } from "../contracts/serialized-api-item";
1111
* Base class for callable api items.
1212
*/
1313
export abstract class ApiCallable<TKind extends Contracts.ApiCallableBaseDefinition> extends ApiDefinitionBase<TKind> {
14-
private parameters: ApiParameter[];
14+
private parameters: ApiParameter[] | undefined;
1515

1616
public get Parameters(): ApiParameter[] {
1717
if (this.parameters == null) {
@@ -23,7 +23,7 @@ export abstract class ApiCallable<TKind extends Contracts.ApiCallableBaseDefinit
2323
return this.parameters;
2424
}
2525

26-
private typeParameters: ApiTypeParameter[];
26+
private typeParameters: ApiTypeParameter[] | undefined;
2727

2828
public get TypeParameters(): ApiTypeParameter[] {
2929
if (this.typeParameters == null) {

packages/ts-docs-gen/src/api-items/api-definition-container.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export type ApiBaseItemContainerDto = Contracts.ApiBaseDefinition & { Members: C
1111
export abstract class ApiDefinitionContainer<TKind extends ApiBaseItemContainerDto = ApiBaseItemContainerDto>
1212
extends ApiDefinitionBase<TKind> {
1313

14-
private members: ApiDefinitions[];
14+
private members: ApiDefinitions[] | undefined;
1515

1616
public get Members(): ApiDefinitions[] {
1717
if (this.members == null) {

packages/ts-docs-gen/src/api-items/api-definition-with-type.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export type ApiBaseItemWithTypeDto = Contracts.ApiBaseDefinition & { Type: Contr
88
export abstract class ApiDefinitionWithType<TKind extends ApiBaseItemWithTypeDto = ApiBaseItemWithTypeDto>
99
extends ApiDefinitionBase<TKind> {
1010

11-
private type: ApiTypes;
11+
private type: ApiTypes | undefined;
1212

1313
public get Type(): ApiTypes {
1414
if (this.type == null) {

packages/ts-docs-gen/src/api-items/api-type-members-base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { GeneratorHelpers } from "../generator-helpers";
44
import { ApiTypes } from "./api-type-list";
55

66
export abstract class ApiTypeMembersBase<TKind extends Contracts.ApiMembersBaseType> extends ApiTypeBase<TKind> {
7-
private members: ApiTypes[];
7+
private members: ApiTypes[] | undefined;
88

99
public get Members(): ApiTypes[] {
1010
if (this.members == null) {

packages/ts-docs-gen/src/api-items/definitions/api-class.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { ApiTypeParameter } from "./api-type-parameter";
66
import { ReferenceRenderHandler } from "../../contracts/serialized-api-item";
77

88
export class ApiClass extends ApiDefinitionContainer<Contracts.ApiClassDto> {
9-
private typeParameters: ApiTypeParameter[];
9+
private typeParameters: ApiTypeParameter[] | undefined;
1010

1111
public get TypeParameters(): ApiTypeParameter[] {
1212
if (this.typeParameters == null) {
@@ -23,7 +23,7 @@ export class ApiClass extends ApiDefinitionContainer<Contracts.ApiClassDto> {
2323
return this.extends;
2424
}
2525

26-
private implements: ApiTypes[];
26+
private implements: ApiTypes[] | undefined;
2727

2828
public get Implements(): ApiTypes[] {
2929
if (this.implements == null) {

packages/ts-docs-gen/src/api-items/definitions/api-enum.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { ApiItemReference } from "../../contracts/api-item-reference";
77
import { ReferenceRenderHandler } from "../../contracts/serialized-api-item";
88

99
export class ApiEnum extends ApiDefinitionBase<Contracts.ApiEnumDto> {
10-
private enumMembers: ApiEnumMember[];
10+
private enumMembers: ApiEnumMember[] | undefined;
1111

1212
public get EnumMembers(): ApiEnumMember[] {
1313
if (this.enumMembers == null) {

0 commit comments

Comments
 (0)