Skip to content

Commit a1ed346

Browse files
committed
Add initial API Extractor configs and output files
1 parent 14370d8 commit a1ed346

5 files changed

+1441
-0
lines changed

api-extractor.dt-types.json

+356
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,356 @@
1+
/**
2+
* Config file for API Extractor. For more info, please visit: https://api-extractor.com
3+
*/
4+
{
5+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
6+
7+
/**
8+
* Optionally specifies another JSON config file that this file extends from. This provides a way for
9+
* standard settings to be shared across multiple projects.
10+
*
11+
* If the path starts with "./" or "../", the path is resolved relative to the folder of the file that contains
12+
* the "extends" field. Otherwise, the first path segment is interpreted as an NPM package name, and will be
13+
* resolved using NodeJS require().
14+
*
15+
* SUPPORTED TOKENS: none
16+
* DEFAULT VALUE: ""
17+
*/
18+
// "extends": "./shared/api-extractor-base.json"
19+
// "extends": "my-package/include/api-extractor-base.json"
20+
21+
/**
22+
* Determines the "<projectFolder>" token that can be used with other config file settings. The project folder
23+
* typically contains the tsconfig.json and package.json config files, but the path is user-defined.
24+
*
25+
* The path is resolved relative to the folder of the config file that contains the setting.
26+
*
27+
* The default value for "projectFolder" is the token "<lookup>", which means the folder is determined by traversing
28+
* parent folders, starting from the folder containing api-extractor.json, and stopping at the first folder
29+
* that contains a tsconfig.json file. If a tsconfig.json file cannot be found in this way, then an error
30+
* will be reported.
31+
*
32+
* SUPPORTED TOKENS: <lookup>
33+
* DEFAULT VALUE: "<lookup>"
34+
*/
35+
"projectFolder": ".",
36+
37+
/**
38+
* (REQUIRED) Specifies the .d.ts file to be used as the starting point for analysis. API Extractor
39+
* analyzes the symbols exported by this module.
40+
*
41+
* The file extension must be ".d.ts" and not ".ts".
42+
*
43+
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
44+
* prepend a folder token such as "<projectFolder>".
45+
*
46+
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
47+
*/
48+
"mainEntryPointFilePath": "node_modules/@types/react-redux/index.d.ts",
49+
//"mainEntryPointFilePath": "/home/weber/tmp/rtk-origin-master/dist/index.d.ts",
50+
51+
/**
52+
* A list of NPM package names whose exports should be treated as part of this package.
53+
*
54+
* For example, suppose that Webpack is used to generate a distributed bundle for the project "library1",
55+
* and another NPM package "library2" is embedded in this bundle. Some types from library2 may become part
56+
* of the exported API for library1, but by default API Extractor would generate a .d.ts rollup that explicitly
57+
* imports library2. To avoid this, we can specify:
58+
*
59+
* "bundledPackages": [ "library2" ],
60+
*
61+
* This would direct API Extractor to embed those types directly in the .d.ts rollup, as if they had been
62+
* local files for library1.
63+
*/
64+
"bundledPackages": [],
65+
66+
/**
67+
* Determines how the TypeScript compiler engine will be invoked by API Extractor.
68+
*/
69+
"compiler": {
70+
/**
71+
* Specifies the path to the tsconfig.json file to be used by API Extractor when analyzing the project.
72+
*
73+
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
74+
* prepend a folder token such as "<projectFolder>".
75+
*
76+
* Note: This setting will be ignored if "overrideTsconfig" is used.
77+
*
78+
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
79+
* DEFAULT VALUE: "<projectFolder>/tsconfig.json"
80+
*/
81+
// "tsconfigFilePath": "<projectFolder>/tsconfig.json",
82+
/**
83+
* Provides a compiler configuration that will be used instead of reading the tsconfig.json file from disk.
84+
* The object must conform to the TypeScript tsconfig schema:
85+
*
86+
* http://json.schemastore.org/tsconfig
87+
*
88+
* If omitted, then the tsconfig.json file will be read from the "projectFolder".
89+
*
90+
* DEFAULT VALUE: no overrideTsconfig section
91+
*/
92+
// "overrideTsconfig": {
93+
// . . .
94+
// }
95+
/**
96+
* This option causes the compiler to be invoked with the --skipLibCheck option. This option is not recommended
97+
* and may cause API Extractor to produce incomplete or incorrect declarations, but it may be required when
98+
* dependencies contain declarations that are incompatible with the TypeScript engine that API Extractor uses
99+
* for its analysis. Where possible, the underlying issue should be fixed rather than relying on skipLibCheck.
100+
*
101+
* DEFAULT VALUE: false
102+
*/
103+
// "skipLibCheck": true,
104+
},
105+
106+
/**
107+
* Configures how the API report file (*.api.md) will be generated.
108+
*/
109+
"apiReport": {
110+
/**
111+
* (REQUIRED) Whether to generate an API report.
112+
*/
113+
"enabled": true,
114+
115+
/**
116+
* The filename for the API report files. It will be combined with "reportFolder" or "reportTempFolder" to produce
117+
* a full file path.
118+
*
119+
* The file extension should be ".api.md", and the string should not contain a path separator such as "\" or "/".
120+
*
121+
* SUPPORTED TOKENS: <packageName>, <unscopedPackageName>
122+
* DEFAULT VALUE: "<unscopedPackageName>.api.md"
123+
*/
124+
"reportFileName": "react-redux.dt-types.api.md",
125+
126+
/**
127+
* Specifies the folder where the API report file is written. The file name portion is determined by
128+
* the "reportFileName" setting.
129+
*
130+
* The API report file is normally tracked by Git. Changes to it can be used to trigger a branch policy,
131+
* e.g. for an API review.
132+
*
133+
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
134+
* prepend a folder token such as "<projectFolder>".
135+
*
136+
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
137+
* DEFAULT VALUE: "<projectFolder>/etc/"
138+
*/
139+
"reportFolder": "<projectFolder>/etc/"
140+
141+
/**
142+
* Specifies the folder where the temporary report file is written. The file name portion is determined by
143+
* the "reportFileName" setting.
144+
*
145+
* After the temporary file is written to disk, it is compared with the file in the "reportFolder".
146+
* If they are different, a production build will fail.
147+
*
148+
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
149+
* prepend a folder token such as "<projectFolder>".
150+
*
151+
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
152+
* DEFAULT VALUE: "<projectFolder>/temp/"
153+
*/
154+
// "reportTempFolder": "<projectFolder>/temp/"
155+
},
156+
157+
/**
158+
* Configures how the doc model file (*.api.json) will be generated.
159+
*/
160+
"docModel": {
161+
/**
162+
* (REQUIRED) Whether to generate a doc model file.
163+
*/
164+
"enabled": false
165+
166+
/**
167+
* The output path for the doc model file. The file extension should be ".api.json".
168+
*
169+
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
170+
* prepend a folder token such as "<projectFolder>".
171+
*
172+
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
173+
* DEFAULT VALUE: "<projectFolder>/temp/<unscopedPackageName>.api.json"
174+
*/
175+
// "apiJsonFilePath": "<projectFolder>/temp/<unscopedPackageName>.api.json"
176+
},
177+
178+
/**
179+
* Configures how the .d.ts rollup file will be generated.
180+
*/
181+
"dtsRollup": {
182+
/**
183+
* (REQUIRED) Whether to generate the .d.ts rollup file.
184+
*/
185+
"enabled": false,
186+
187+
/**
188+
* Specifies the output path for a .d.ts rollup file to be generated without any trimming.
189+
* This file will include all declarations that are exported by the main entry point.
190+
*
191+
* If the path is an empty string, then this file will not be written.
192+
*
193+
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
194+
* prepend a folder token such as "<projectFolder>".
195+
*
196+
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
197+
* DEFAULT VALUE: "<projectFolder>/dist/<unscopedPackageName>.d.ts"
198+
*/
199+
"untrimmedFilePath": "<projectFolder>/es/typings.d.ts"
200+
201+
/**
202+
* Specifies the output path for a .d.ts rollup file to be generated with trimming for a "beta" release.
203+
* This file will include only declarations that are marked as "@public" or "@beta".
204+
*
205+
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
206+
* prepend a folder token such as "<projectFolder>".
207+
*
208+
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
209+
* DEFAULT VALUE: ""
210+
*/
211+
// "betaTrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>-beta.d.ts",
212+
213+
/**
214+
* Specifies the output path for a .d.ts rollup file to be generated with trimming for a "public" release.
215+
* This file will include only declarations that are marked as "@public".
216+
*
217+
* If the path is an empty string, then this file will not be written.
218+
*
219+
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
220+
* prepend a folder token such as "<projectFolder>".
221+
*
222+
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
223+
* DEFAULT VALUE: ""
224+
*/
225+
// "publicTrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>-public.d.ts",
226+
227+
/**
228+
* When a declaration is trimmed, by default it will be replaced by a code comment such as
229+
* "Excluded from this release type: exampleMember". Set "omitTrimmingComments" to true to remove the
230+
* declaration completely.
231+
*
232+
* DEFAULT VALUE: false
233+
*/
234+
// "omitTrimmingComments": true
235+
},
236+
237+
/**
238+
* Configures how the tsdoc-metadata.json file will be generated.
239+
*/
240+
"tsdocMetadata": {
241+
/**
242+
* Whether to generate the tsdoc-metadata.json file.
243+
*
244+
* DEFAULT VALUE: true
245+
*/
246+
"enabled": false
247+
248+
/**
249+
* Specifies where the TSDoc metadata file should be written.
250+
*
251+
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
252+
* prepend a folder token such as "<projectFolder>".
253+
*
254+
* The default value is "<lookup>", which causes the path to be automatically inferred from the "tsdocMetadata",
255+
* "typings" or "main" fields of the project's package.json. If none of these fields are set, the lookup
256+
* falls back to "tsdoc-metadata.json" in the package folder.
257+
*
258+
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
259+
* DEFAULT VALUE: "<lookup>"
260+
*/
261+
// "tsdocMetadataFilePath": "<projectFolder>/dist/tsdoc-metadata.json"
262+
},
263+
264+
/**
265+
* Configures how API Extractor reports error and warning messages produced during analysis.
266+
*
267+
* There are three sources of messages: compiler messages, API Extractor messages, and TSDoc messages.
268+
*/
269+
"messages": {
270+
/**
271+
* Configures handling of diagnostic messages reported by the TypeScript compiler engine while analyzing
272+
* the input .d.ts files.
273+
*
274+
* TypeScript message identifiers start with "TS" followed by an integer. For example: "TS2551"
275+
*
276+
* DEFAULT VALUE: A single "default" entry with logLevel=warning.
277+
*/
278+
"compilerMessageReporting": {
279+
/**
280+
* Configures the default routing for messages that don't match an explicit rule in this table.
281+
*/
282+
"default": {
283+
/**
284+
* Specifies whether the message should be written to the the tool's output log. Note that
285+
* the "addToApiReportFile" property may supersede this option.
286+
*
287+
* Possible values: "error", "warning", "none"
288+
*
289+
* Errors cause the build to fail and return a nonzero exit code. Warnings cause a production build fail
290+
* and return a nonzero exit code. For a non-production build (e.g. when "api-extractor run" includes
291+
* the "--local" option), the warning is displayed but the build will not fail.
292+
*
293+
* DEFAULT VALUE: "warning"
294+
*/
295+
"logLevel": "warning"
296+
297+
/**
298+
* When addToApiReportFile is true: If API Extractor is configured to write an API report file (.api.md),
299+
* then the message will be written inside that file; otherwise, the message is instead logged according to
300+
* the "logLevel" option.
301+
*
302+
* DEFAULT VALUE: false
303+
*/
304+
// "addToApiReportFile": false
305+
}
306+
307+
// "TS2551": {
308+
// "logLevel": "warning",
309+
// "addToApiReportFile": true
310+
// },
311+
//
312+
// . . .
313+
},
314+
315+
/**
316+
* Configures handling of messages reported by API Extractor during its analysis.
317+
*
318+
* API Extractor message identifiers start with "ae-". For example: "ae-extra-release-tag"
319+
*
320+
* DEFAULT VALUE: See api-extractor-defaults.json for the complete table of extractorMessageReporting mappings
321+
*/
322+
"extractorMessageReporting": {
323+
"default": {
324+
"logLevel": "warning"
325+
// "addToApiReportFile": false
326+
},
327+
"ae-forgotten-export": {
328+
"logLevel": "none",
329+
"addToApiReportFile": false
330+
}
331+
//
332+
// . . .
333+
},
334+
335+
/**
336+
* Configures handling of messages reported by the TSDoc parser when analyzing code comments.
337+
*
338+
* TSDoc message identifiers start with "tsdoc-". For example: "tsdoc-link-tag-unescaped-text"
339+
*
340+
* DEFAULT VALUE: A single "default" entry with logLevel=warning.
341+
*/
342+
"tsdocMessageReporting": {
343+
"default": {
344+
"logLevel": "none"
345+
// "addToApiReportFile": false
346+
}
347+
348+
// "tsdoc-link-tag-unescaped-text": {
349+
// "logLevel": "warning",
350+
// "addToApiReportFile": true
351+
// },
352+
//
353+
// . . .
354+
}
355+
}
356+
}

0 commit comments

Comments
 (0)