@@ -55,30 +55,36 @@ const yamlApiSchema: JsonSchema = JsonSchema.fromFile(path.join(__dirname, '..',
5555export class YamlDocumenter {
5656 private readonly _apiModel : ApiModel ;
5757 private readonly _markdownEmitter : CustomMarkdownEmitter ;
58- private readonly _configFolder : string ;
59-
58+
6059 // This is used by the _linkToUidIfPossible() workaround.
6160 // It stores a mapping from type name (e.g. "MyClass") to the corresponding ApiItem.
6261 // If the mapping would be ambiguous (e.g. "MyClass" is defined by multiple packages)
6362 // then it is excluded from the mapping. Also excluded are ApiItem objects (such as package
6463 // and function) which are not typically used as a data type.
6564 private _apiItemsByTypeName : Map < string , ApiItem > ;
66-
65+
6766 private _outputFolder : string ;
6867
69- public constructor ( apiModel : ApiModel , configFolder : string ) {
68+ // ideally this needs to be an interface with a defined shape a config file can take. And whoever creates the config
69+ // should use it to leverage the type safety.
70+ private _config : { } ;
71+
72+ public constructor ( apiModel : ApiModel ) {
7073 this . _apiModel = apiModel ;
7174 this . _markdownEmitter = new CustomMarkdownEmitter ( this . _apiModel ) ;
7275 this . _apiItemsByTypeName = new Map < string , ApiItem > ( ) ;
73- this . _configFolder = configFolder ;
74-
76+
7577 this . _initApiItemsByTypeName ( ) ;
7678 }
77-
79+
7880 /** @virtual */
79- public generateFiles ( outputFolder : string ) : void {
81+ public generateFiles ( outputFolder : string , configFolder ?: string ) : void {
8082 this . _outputFolder = outputFolder ;
8183
84+ const configFilePath : string = configFolder ? path . join ( configFolder , 'api-documenter.json' ) : '' ;
85+ this . _config = configFilePath && JsonFile . load ( configFilePath ) ;
86+ console . log ( this . _config ) ;
87+
8288 console . log ( ) ;
8389 this . _deleteOldOutputFiles ( ) ;
8490
0 commit comments