Skip to content

Commit 00f1dfa

Browse files
authored
Merge pull request #3472 from D4N14L/user/danade/ApiExtractorConfigLoad
[api-extractor] Allow for loading the `ExtractorConfig` without validating existence of target typings
2 parents 6b1d2a6 + 3cd3837 commit 00f1dfa

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,14 @@ export interface IExtractorConfigPrepareOptions {
136136
* `@microsoft/api-extractor/extends/tsdoc-base.json`.
137137
*/
138138
tsdocConfigFile?: TSDocConfigFile;
139+
140+
/**
141+
* When preparing the configuration object, folder and file paths referenced in the configuration are checked
142+
* for existence, and an error is reported if they are not found. This option can be used to disable this
143+
* check for the main entry point module. This may be useful when preparing a configuration file for an
144+
* un-built project.
145+
*/
146+
ignoreMissingEntryPoint?: boolean;
139147
}
140148

141149
interface IExtractorConfigParameters {
@@ -811,7 +819,7 @@ export class ExtractorConfig {
811819
);
812820
}
813821

814-
if (!FileSystem.exists(mainEntryPointFilePath)) {
822+
if (!options.ignoreMissingEntryPoint && !FileSystem.exists(mainEntryPointFilePath)) {
815823
throw new Error('The "mainEntryPointFilePath" path does not exist: ' + mainEntryPointFilePath);
816824
}
817825

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@microsoft/api-extractor",
5+
"comment": "Add support for the \"ignoreMissingEntryPoint\" ExtractorConfig option to allow for loading an ExtractorConfig before the target project is built.",
6+
"type": "minor"
7+
}
8+
],
9+
"packageName": "@microsoft/api-extractor"
10+
}

common/reviews/api/api-extractor.api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ export interface IExtractorConfigLoadForFolderOptions {
243243
export interface IExtractorConfigPrepareOptions {
244244
configObject: IConfigFile;
245245
configObjectFullPath: string | undefined;
246+
ignoreMissingEntryPoint?: boolean;
246247
packageJson?: INodePackageJson | undefined;
247248
packageJsonFullPath: string | undefined;
248249
projectFolderLookupToken?: string;

0 commit comments

Comments
 (0)