Skip to content

Commit

Permalink
Merge pull request #3472 from D4N14L/user/danade/ApiExtractorConfigLoad
Browse files Browse the repository at this point in the history
[api-extractor] Allow for loading the `ExtractorConfig` without validating existence of target typings
  • Loading branch information
D4N14L committed Jun 27, 2022
2 parents 6b1d2a6 + 3cd3837 commit 00f1dfa
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
10 changes: 9 additions & 1 deletion apps/api-extractor/src/api/ExtractorConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,14 @@ export interface IExtractorConfigPrepareOptions {
* `@microsoft/api-extractor/extends/tsdoc-base.json`.
*/
tsdocConfigFile?: TSDocConfigFile;

/**
* When preparing the configuration object, folder and file paths referenced in the configuration are checked
* for existence, and an error is reported if they are not found. This option can be used to disable this
* check for the main entry point module. This may be useful when preparing a configuration file for an
* un-built project.
*/
ignoreMissingEntryPoint?: boolean;
}

interface IExtractorConfigParameters {
Expand Down Expand Up @@ -811,7 +819,7 @@ export class ExtractorConfig {
);
}

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

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@microsoft/api-extractor",
"comment": "Add support for the \"ignoreMissingEntryPoint\" ExtractorConfig option to allow for loading an ExtractorConfig before the target project is built.",
"type": "minor"
}
],
"packageName": "@microsoft/api-extractor"
}
1 change: 1 addition & 0 deletions common/reviews/api/api-extractor.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ export interface IExtractorConfigLoadForFolderOptions {
export interface IExtractorConfigPrepareOptions {
configObject: IConfigFile;
configObjectFullPath: string | undefined;
ignoreMissingEntryPoint?: boolean;
packageJson?: INodePackageJson | undefined;
packageJsonFullPath: string | undefined;
projectFolderLookupToken?: string;
Expand Down

0 comments on commit 00f1dfa

Please sign in to comment.