@@ -135,6 +135,13 @@ export interface IExtractorConfigPrepareOptions {
135
135
* `@microsoft/api-extractor/extends/tsdoc-base.json`.
136
136
*/
137
137
tsdocConfigFile ?: TSDocConfigFile ;
138
+
139
+ /**
140
+ * When preparing the configuration object, folder and file paths referenced in the configuration are checked
141
+ * for existence, and an error is reported if they are not found. This option can be used to disable this
142
+ * check. This may be useful when preparing a configuration file for an un-built project.
143
+ */
144
+ ignoreMissingConfigTargets ?: boolean ;
138
145
}
139
146
140
147
interface IExtractorConfigParameters {
@@ -732,7 +739,7 @@ export class ExtractorConfig {
732
739
// Use the manually specified "<lookup>" value
733
740
projectFolder = options . projectFolderLookupToken ;
734
741
735
- if ( ! FileSystem . exists ( options . projectFolderLookupToken ) ) {
742
+ if ( ! options . ignoreMissingConfigTargets && ! FileSystem . exists ( options . projectFolderLookupToken ) ) {
736
743
throw new Error (
737
744
'The specified "projectFolderLookupToken" path does not exist: ' +
738
745
options . projectFolderLookupToken
@@ -771,7 +778,7 @@ export class ExtractorConfig {
771
778
} else {
772
779
ExtractorConfig . _rejectAnyTokensInPath ( configObject . projectFolder , 'projectFolder' ) ;
773
780
774
- if ( ! FileSystem . exists ( configObject . projectFolder ) ) {
781
+ if ( ! options . ignoreMissingConfigTargets && ! FileSystem . exists ( configObject . projectFolder ) ) {
775
782
throw new Error ( 'The specified "projectFolder" path does not exist: ' + configObject . projectFolder ) ;
776
783
}
777
784
@@ -805,7 +812,7 @@ export class ExtractorConfig {
805
812
) ;
806
813
}
807
814
808
- if ( ! FileSystem . exists ( mainEntryPointFilePath ) ) {
815
+ if ( ! options . ignoreMissingConfigTargets && ! FileSystem . exists ( mainEntryPointFilePath ) ) {
809
816
throw new Error ( 'The "mainEntryPointFilePath" path does not exist: ' + mainEntryPointFilePath ) ;
810
817
}
811
818
@@ -826,7 +833,7 @@ export class ExtractorConfig {
826
833
if ( ! tsconfigFilePath ) {
827
834
throw new Error ( 'Either the "tsconfigFilePath" or "overrideTsconfig" setting must be specified' ) ;
828
835
}
829
- if ( ! FileSystem . exists ( tsconfigFilePath ) ) {
836
+ if ( ! options . ignoreMissingConfigTargets && ! FileSystem . exists ( tsconfigFilePath ) ) {
830
837
throw new Error ( 'The file referenced by "tsconfigFilePath" does not exist: ' + tsconfigFilePath ) ;
831
838
}
832
839
}
0 commit comments