@@ -7,41 +7,41 @@ import { ParameterHint, ParameterType } from './utils/options/declaration';
7
7
import { getOptionsHelp } from './utils/options/help' ;
8
8
9
9
export const enum ExitCode {
10
- OptionError = 1 ,
10
+ OptionError = 1 ,
11
11
NoInputFiles = 2 ,
12
- NoOutput = 3 ,
12
+ NoOutput = 3 ,
13
13
CompileError = 4 ,
14
- OutputError = 5
14
+ OutputError = 5
15
15
}
16
16
17
17
export class CliApplication extends Application {
18
18
@Option ( {
19
- name : 'out' ,
20
- help : 'Specifies the location the documentation should be written to.' ,
21
- hint : ParameterHint . Directory
19
+ name : 'out' ,
20
+ help : 'Specifies the location the documentation should be written to.' ,
21
+ hint : ParameterHint . Directory
22
22
} )
23
23
out ! : string ;
24
24
25
25
@Option ( {
26
- name : 'json' ,
27
- help : 'Specifies the location and file name a json file describing the project is written to.' ,
28
- hint : ParameterHint . File
26
+ name : 'json' ,
27
+ help : 'Specifies the location and file name a json file describing the project is written to.' ,
28
+ hint : ParameterHint . File
29
29
} )
30
30
json ! : string ;
31
31
32
32
@Option ( {
33
- name : 'version' ,
33
+ name : 'version' ,
34
34
short : 'v' ,
35
- help : 'Print the TypeDoc\'s version.' ,
36
- type : ParameterType . Boolean
35
+ help : 'Print the TypeDoc\'s version.' ,
36
+ type : ParameterType . Boolean
37
37
} )
38
38
version ! : boolean ;
39
39
40
40
@Option ( {
41
- name : 'help' ,
41
+ name : 'help' ,
42
42
short : 'h' ,
43
- help : 'Print this message.' ,
44
- type : ParameterType . Boolean
43
+ help : 'Print this message.' ,
44
+ type : ParameterType . Boolean
45
45
} )
46
46
help ! : boolean ;
47
47
@@ -61,9 +61,6 @@ export class CliApplication extends Application {
61
61
} else if ( result . inputFiles . length === 0 ) {
62
62
typescript . sys . write ( getOptionsHelp ( this . options ) ) ;
63
63
process . exit ( ExitCode . NoInputFiles ) ;
64
- } else if ( ! this . out && ! this . json ) {
65
- this . logger . error ( "You must either specify the 'out' or 'json' option." ) ;
66
- process . exit ( ExitCode . NoOutput ) ;
67
64
} else {
68
65
const src = this . expandInputFiles ( result . inputFiles ) ;
69
66
const project = this . convert ( src ) ;
@@ -74,6 +71,11 @@ export class CliApplication extends Application {
74
71
if ( this . json ) {
75
72
this . generateJson ( project , this . json ) ;
76
73
}
74
+ if ( ! this . out && ! this . json ) {
75
+ this . logger . log ( "No 'out' or 'json' option has been set" ) ;
76
+ this . logger . log ( "The './docs' directory has be set as the output location by default" ) ;
77
+ this . generateDocs ( project , './docs' ) ;
78
+ }
77
79
if ( this . logger . hasErrors ( ) ) {
78
80
process . exit ( ExitCode . OutputError ) ;
79
81
}
0 commit comments