Skip to content

Commit 0462858

Browse files
authored
Merge pull request microsoft#917 from sunilsurana/sunilsurana/issue912
[api-extractor] Add wrapper method to read config file for processing
2 parents c7237d9 + c594927 commit 0462858

3 files changed

Lines changed: 23 additions & 0 deletions

File tree

apps/api-extractor/src/extractor/Extractor.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,17 @@ export class Extractor {
158158
return analysisFilePaths;
159159
}
160160

161+
/**
162+
* Invokes the API Extractor engine, using the api extractor configuration file.
163+
* @param jsonConfigFile - Path to api extractor json config file.
164+
* @param options - IExtractor options.
165+
*/
166+
public static processProjectFromConfigFile(jsonConfigFile: string, options?: IExtractorOptions): void {
167+
const configObject: IExtractorConfig = JsonFile.loadAndValidate(jsonConfigFile, Extractor.jsonSchema);
168+
const extractor: Extractor = new Extractor(configObject, options);
169+
extractor.processProject();
170+
}
171+
161172
private static _applyConfigDefaults(config: IExtractorConfig): IExtractorConfig {
162173
// Use the provided config to override the defaults
163174
const normalized: IExtractorConfig = lodash.merge(
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@microsoft/api-extractor",
5+
"comment": "Added an api to invoke api extractor processor by supplying api extractor json config file.",
6+
"type": "minor"
7+
}
8+
],
9+
"packageName": "@microsoft/api-extractor",
10+
"email": "sunilsurana@users.noreply.github.com"
11+
}

common/reviews/api/api-extractor.api.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class Extractor {
1919
static generateFilePathsForAnalysis(inputFilePaths: string[]): string[];
2020
static jsonSchema: JsonSchema;
2121
processProject(options?: IAnalyzeProjectOptions): boolean;
22+
static processProjectFromConfigFile(jsonConfigFile: string, options?: IExtractorOptions): void;
2223
}
2324

2425
// @public

0 commit comments

Comments
 (0)