Skip to content

Commit b582586

Browse files
committed
Add "packageTypings" setting in config file
1 parent 6b6e94e commit b582586

5 files changed

Lines changed: 60 additions & 0 deletions

File tree

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

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,29 @@ export interface IExtractorApiJsonFileConfig {
142142
outputFolder?: string;
143143
}
144144

145+
/**
146+
* Configures how the package typings (*.d.ts) will be generated.
147+
* @remarks
148+
* API Extractor can generate a single unified *.d.ts file that contains all
149+
* the exported typings for the package entry point. It can also remove
150+
* \@alpha \@beta \@internal definitions depending on the release type.
151+
*
152+
* @beta
153+
*/
154+
export interface IExtractorPackageTypingsConfig {
155+
/**
156+
* Whether to generate package typings. The default is false.
157+
*/
158+
enabled: boolean;
159+
160+
/**
161+
* Specifies where the *.d.ts files should be written.
162+
*
163+
* The default value is "./dist"
164+
*/
165+
outputFolder?: string;
166+
}
167+
145168
/**
146169
* Configuration options for the API Extractor tool. These options can be loaded
147170
* from a JSON config file.
@@ -175,4 +198,10 @@ export interface IExtractorConfig {
175198
* {@inheritdoc IExtractorApiJsonFileConfig}
176199
*/
177200
apiJsonFile?: IExtractorApiJsonFileConfig;
201+
202+
/**
203+
* {@inheritdoc IExtractorPackageTypingsConfig}
204+
* @beta
205+
*/
206+
packageTypings?: IExtractorPackageTypingsConfig;
178207
}

‎apps/api-extractor/src/extractor/api-extractor-defaults.json‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,10 @@
2020
"apiJsonFile": {
2121
"enabled": true,
2222
"outputFolder": "./dist"
23+
},
24+
25+
"packageTypings": {
26+
"enabled": false,
27+
"outputFolder": "./dist"
2328
}
2429
}

‎apps/api-extractor/src/extractor/api-extractor.schema.json‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,23 @@
113113
},
114114
"required": [ "enabled" ],
115115
"additionalProperties": false
116+
},
117+
118+
"packageTypings": {
119+
"description": "Configures how the package typings (*.d.ts) will be generated.",
120+
"type": "object",
121+
"properties": {
122+
"enabled": {
123+
"description": "Whether to generate package typings. The default is false.",
124+
"type": "boolean"
125+
},
126+
"outputFolder": {
127+
"description": "Specifies where the *.d.ts files should be written. The default value is \"./dist\"",
128+
"type": "string"
129+
}
130+
},
131+
"required": [ "enabled" ],
132+
"additionalProperties": false
116133
}
117134
},
118135
"required": [ "compiler", "project" ],

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export {
1818
IExtractorPoliciesConfig,
1919
IExtractorApiReviewFileConfig,
2020
IExtractorApiJsonFileConfig,
21+
IExtractorPackageTypingsConfig,
2122
IExtractorConfig
2223
} from './extractor/IExtractorConfig';
2324

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@ interface IExtractorConfig {
175175
apiJsonFile?: IExtractorApiJsonFileConfig;
176176
apiReviewFile?: IExtractorApiReviewFileConfig;
177177
compiler: IExtractorTsconfigCompilerConfig | IExtractorRuntimeCompilerConfig;
178+
// @beta
179+
packageTypings?: IExtractorPackageTypingsConfig;
178180
policies?: IExtractorPoliciesConfig;
179181
project: IExtractorProjectConfig;
180182
}
@@ -186,6 +188,12 @@ interface IExtractorOptions {
186188
localBuild?: boolean;
187189
}
188190

191+
// @beta
192+
interface IExtractorPackageTypingsConfig {
193+
enabled: boolean;
194+
outputFolder?: string;
195+
}
196+
189197
// @public
190198
interface IExtractorPoliciesConfig {
191199
namespaceSupport: 'conservative' | 'permissive';

0 commit comments

Comments
 (0)