Skip to content

Commit 6b6e94e

Browse files
committed
Add Extractor.config
1 parent 69e804e commit 6b6e94e

3 files changed

Lines changed: 47 additions & 9 deletions

File tree

‎apps/api-extractor/src/DebugRun.ts‎

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,57 @@
22
// See LICENSE in the project root for license information.
33

44
// NOTE: THIS SOURCE FILE IS FOR DEBUGGING PURPOSES ONLY.
5-
// IT IS INVOKED BY THE "Run.cmd" AND "Debug.cmd" BATCH FILES.
5+
// IT IS INVOKED BY THE 'Run.cmd' AND 'Debug.cmd' BATCH FILES.
66

77
import { Extractor } from './extractor/Extractor';
8+
import * as path from 'path';
89

910
const extractor: Extractor = new Extractor(
1011
{
1112
compiler: {
1213
configType: 'tsconfig',
13-
rootFolder: '.'
14+
overrideTsconfig: {
15+
'compilerOptions': {
16+
'target': 'es6',
17+
'forceConsistentCasingInFileNames': true,
18+
'module': 'commonjs',
19+
'declaration': true,
20+
'sourceMap': true,
21+
'experimentalDecorators': true,
22+
'types': [
23+
'node'
24+
],
25+
'lib': [
26+
'es5',
27+
'scripthost',
28+
'es2015.collection',
29+
'es2015.promise',
30+
'es2015.iterable',
31+
'dom'
32+
],
33+
'strictNullChecks': true
34+
},
35+
'include': [ 'lib/**/*.d.ts' ]
36+
},
37+
rootFolder: '../../libraries/node-core-library'
1438
},
1539
project: {
16-
entryPointSourceFile: 'src/index.ts',
17-
externalJsonFileFolders: ['./testInputs/external-api-json' ]
40+
entryPointSourceFile: 'lib/index.d.ts',
41+
externalJsonFileFolders: [ ]
1842
},
1943
apiReviewFile: {
20-
enabled: true,
21-
apiReviewFolder: __dirname
44+
enabled: false,
45+
apiReviewFolder: path.join(__dirname, 'debug')
2246
},
2347
apiJsonFile: {
24-
enabled: true
48+
enabled: true,
49+
outputFolder: path.join(__dirname, 'debug')
2550
}
2651
}
2752
);
2853

54+
console.log('CONFIG:' + JSON.stringify(extractor.config, undefined, ' '));
55+
2956
if (!extractor.processProject()) {
3057
console.log('processProject() failed the build');
3158
} else {

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

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,6 @@ export class Extractor {
105105

106106
this._config = Extractor._applyConfigDefaults(config);
107107

108-
this._monitoredLogger.logVerbose('API Extractor Config: ' + JSON.stringify(this._config));
109-
110108
if (!options) {
111109
options = { };
112110
}
@@ -160,6 +158,18 @@ export class Extractor {
160158
}
161159
}
162160

161+
/**
162+
* Returns the normalized configuration object after defaults have been applied.
163+
*
164+
* @remarks
165+
* This is a read-only object. The caller should NOT modify any member of this object.
166+
* It is provided for diagnostic purposes. For example, a build script could write
167+
* this object to a JSON file to report the final configuration options used by API Extractor.
168+
*/
169+
public get config(): IExtractorConfig {
170+
return this._config;
171+
}
172+
163173
/**
164174
* Invokes the API Extractor engine, using the configuration that was passed to the constructor.
165175
* @deprecated Use {@link Extractor.processProject} instead.

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ class Extractor {
1515
public constructor(config: IExtractorConfig, options?: IExtractorOptions);
1616
// @deprecated
1717
public analyzeProject(options?: IAnalyzeProjectOptions): void;
18+
public readonly config: IExtractorConfig;
1819
public static jsonSchema: JsonSchema;
1920
public processProject(options?: IAnalyzeProjectOptions): boolean;
2021
}

0 commit comments

Comments
 (0)