Skip to content

Commit 4fa1bb9

Browse files
committed
Use api-extractor
1 parent f505128 commit 4fa1bb9

37 files changed

+845
-5
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
lib
55
node_modules
66
build
7+
review/api/temp

api-extractor-base.json

+373
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,373 @@
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": "<projectFolder>/lib/index.d.ts",
49+
50+
/**
51+
* A list of NPM package names whose exports should be treated as part of this package.
52+
*
53+
* For example, suppose that Webpack is used to generate a distributed bundle for the project "library1",
54+
* and another NPM package "library2" is embedded in this bundle. Some types from library2 may become part
55+
* of the exported API for library1, but by default API Extractor would generate a .d.ts rollup that explicitly
56+
* imports library2. To avoid this, we can specify:
57+
*
58+
* "bundledPackages": [ "library2" ],
59+
*
60+
* This would direct API Extractor to embed those types directly in the .d.ts rollup, as if they had been
61+
* local files for library1.
62+
*/
63+
"bundledPackages": [ ],
64+
65+
/**
66+
* Determines how the TypeScript compiler engine will be invoked by API Extractor.
67+
*/
68+
"compiler": {
69+
/**
70+
* Specifies the path to the tsconfig.json file to be used by API Extractor when analyzing the project.
71+
*
72+
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
73+
* prepend a folder token such as "<projectFolder>".
74+
*
75+
* Note: This setting will be ignored if "overrideTsconfig" is used.
76+
*
77+
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
78+
* DEFAULT VALUE: "<projectFolder>/tsconfig.json"
79+
*/
80+
// "tsconfigFilePath": "<projectFolder>/tsconfig.json",
81+
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+
/**
97+
* This option causes the compiler to be invoked with the --skipLibCheck option. This option is not recommended
98+
* and may cause API Extractor to produce incomplete or incorrect declarations, but it may be required when
99+
* dependencies contain declarations that are incompatible with the TypeScript engine that API Extractor uses
100+
* for its analysis. Where possible, the underlying issue should be fixed rather than relying on skipLibCheck.
101+
*
102+
* DEFAULT VALUE: false
103+
*/
104+
// "skipLibCheck": true,
105+
},
106+
107+
/**
108+
* Configures how the API report file (*.api.md) will be generated.
109+
*/
110+
"apiReport": {
111+
/**
112+
* (REQUIRED) Whether to generate an API report.
113+
*/
114+
"enabled": true,
115+
116+
/**
117+
* The filename for the API report files. It will be combined with "reportFolder" or "reportTempFolder" to produce
118+
* a full file path.
119+
*
120+
* The file extension should be ".api.md", and the string should not contain a path separator such as "\" or "/".
121+
*
122+
* SUPPORTED TOKENS: <packageName>, <unscopedPackageName>
123+
* DEFAULT VALUE: "<unscopedPackageName>.api.md"
124+
*/
125+
// "reportFileName": "<unscopedPackageName>.api.md",
126+
127+
/**
128+
* Specifies the folder where the API report file is written. The file name portion is determined by
129+
* the "reportFileName" setting.
130+
*
131+
* The API report file is normally tracked by Git. Changes to it can be used to trigger a branch policy,
132+
* e.g. for an API review.
133+
*
134+
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
135+
* prepend a folder token such as "<projectFolder>".
136+
*
137+
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
138+
* DEFAULT VALUE: "<projectFolder>/etc/"
139+
*/
140+
"reportFolder": "review/api",
141+
142+
/**
143+
* Specifies the folder where the temporary report file is written. The file name portion is determined by
144+
* the "reportFileName" setting.
145+
*
146+
* After the temporary file is written to disk, it is compared with the file in the "reportFolder".
147+
* If they are different, a production build will fail.
148+
*
149+
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
150+
* prepend a folder token such as "<projectFolder>".
151+
*
152+
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
153+
* DEFAULT VALUE: "<projectFolder>/temp/"
154+
*/
155+
"reportTempFolder": "review/api/temp/"
156+
},
157+
158+
/**
159+
* Configures how the doc model file (*.api.json) will be generated.
160+
*/
161+
"docModel": {
162+
/**
163+
* (REQUIRED) Whether to generate a doc model file.
164+
*/
165+
"enabled": true,
166+
167+
/**
168+
* The output path for the doc model file. The file extension should be ".api.json".
169+
*
170+
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
171+
* prepend a folder token such as "<projectFolder>".
172+
*
173+
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
174+
* DEFAULT VALUE: "<projectFolder>/temp/<unscopedPackageName>.api.json"
175+
*/
176+
"apiJsonFilePath": "review/api/temp/<unscopedPackageName>.api.json"
177+
},
178+
179+
/**
180+
* Configures how the .d.ts rollup file will be generated.
181+
*/
182+
"dtsRollup": {
183+
/**
184+
* (REQUIRED) Whether to generate the .d.ts rollup file.
185+
*/
186+
"enabled": false,
187+
188+
/**
189+
* Specifies the output path for a .d.ts rollup file to be generated without any trimming.
190+
* This file will include all declarations that are exported by the main entry point.
191+
*
192+
* If the path is an empty string, then this file will not be written.
193+
*
194+
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
195+
* prepend a folder token such as "<projectFolder>".
196+
*
197+
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
198+
* DEFAULT VALUE: "<projectFolder>/dist/<unscopedPackageName>.d.ts"
199+
*/
200+
// "untrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>.d.ts",
201+
202+
/**
203+
* Specifies the output path for a .d.ts rollup file to be generated with trimming for a "beta" release.
204+
* This file will include only declarations that are marked as "@public" or "@beta".
205+
*
206+
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
207+
* prepend a folder token such as "<projectFolder>".
208+
*
209+
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
210+
* DEFAULT VALUE: ""
211+
*/
212+
// "betaTrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>-beta.d.ts",
213+
214+
215+
/**
216+
* Specifies the output path for a .d.ts rollup file to be generated with trimming for a "public" release.
217+
* This file will include only declarations that are marked as "@public".
218+
*
219+
* If the path is an empty string, then this file will not be written.
220+
*
221+
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
222+
* prepend a folder token such as "<projectFolder>".
223+
*
224+
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
225+
* DEFAULT VALUE: ""
226+
*/
227+
// "publicTrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>-public.d.ts",
228+
229+
/**
230+
* When a declaration is trimmed, by default it will be replaced by a code comment such as
231+
* "Excluded from this release type: exampleMember". Set "omitTrimmingComments" to true to remove the
232+
* declaration completely.
233+
*
234+
* DEFAULT VALUE: false
235+
*/
236+
// "omitTrimmingComments": true
237+
},
238+
239+
/**
240+
* Configures how the tsdoc-metadata.json file will be generated.
241+
*/
242+
"tsdocMetadata": {
243+
/**
244+
* Whether to generate the tsdoc-metadata.json file.
245+
*
246+
* DEFAULT VALUE: true
247+
*/
248+
// "enabled": true,
249+
250+
/**
251+
* Specifies where the TSDoc metadata file should be written.
252+
*
253+
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
254+
* prepend a folder token such as "<projectFolder>".
255+
*
256+
* The default value is "<lookup>", which causes the path to be automatically inferred from the "tsdocMetadata",
257+
* "typings" or "main" fields of the project's package.json. If none of these fields are set, the lookup
258+
* falls back to "tsdoc-metadata.json" in the package folder.
259+
*
260+
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
261+
* DEFAULT VALUE: "<lookup>"
262+
*/
263+
// "tsdocMetadataFilePath": "<projectFolder>/dist/tsdoc-metadata.json"
264+
},
265+
266+
/**
267+
* Specifies what type of newlines API Extractor should use when writing output files. By default, the output files
268+
* will be written with Windows-style newlines. To use POSIX-style newlines, specify "lf" instead.
269+
* To use the OS's default newline kind, specify "os".
270+
*
271+
* DEFAULT VALUE: "crlf"
272+
*/
273+
// "newlineKind": "crlf",
274+
275+
/**
276+
* Configures how API Extractor reports error and warning messages produced during analysis.
277+
*
278+
* There are three sources of messages: compiler messages, API Extractor messages, and TSDoc messages.
279+
*/
280+
"messages": {
281+
/**
282+
* Configures handling of diagnostic messages reported by the TypeScript compiler engine while analyzing
283+
* the input .d.ts files.
284+
*
285+
* TypeScript message identifiers start with "TS" followed by an integer. For example: "TS2551"
286+
*
287+
* DEFAULT VALUE: A single "default" entry with logLevel=warning.
288+
*/
289+
"compilerMessageReporting": {
290+
/**
291+
* Configures the default routing for messages that don't match an explicit rule in this table.
292+
*/
293+
"default": {
294+
/**
295+
* Specifies whether the message should be written to the the tool's output log. Note that
296+
* the "addToApiReportFile" property may supersede this option.
297+
*
298+
* Possible values: "error", "warning", "none"
299+
*
300+
* Errors cause the build to fail and return a nonzero exit code. Warnings cause a production build fail
301+
* and return a nonzero exit code. For a non-production build (e.g. when "api-extractor run" includes
302+
* the "--local" option), the warning is displayed but the build will not fail.
303+
*
304+
* DEFAULT VALUE: "warning"
305+
*/
306+
"logLevel": "warning",
307+
308+
/**
309+
* When addToApiReportFile is true: If API Extractor is configured to write an API report file (.api.md),
310+
* then the message will be written inside that file; otherwise, the message is instead logged according to
311+
* the "logLevel" option.
312+
*
313+
* DEFAULT VALUE: false
314+
*/
315+
// "addToApiReportFile": false
316+
},
317+
318+
// "TS2551": {
319+
// "logLevel": "warning",
320+
// "addToApiReportFile": true
321+
// },
322+
//
323+
// . . .
324+
},
325+
326+
/**
327+
* Configures handling of messages reported by API Extractor during its analysis.
328+
*
329+
* API Extractor message identifiers start with "ae-". For example: "ae-extra-release-tag"
330+
*
331+
* DEFAULT VALUE: See api-extractor-defaults.json for the complete table of extractorMessageReporting mappings
332+
*/
333+
"extractorMessageReporting": {
334+
"default": {
335+
"logLevel": "warning",
336+
// "addToApiReportFile": false
337+
},
338+
339+
"ae-missing-release-tag": {
340+
"logLevel": "none"
341+
}
342+
343+
// "ae-extra-release-tag": {
344+
// "logLevel": "warning",
345+
// "addToApiReportFile": true
346+
// },
347+
//
348+
// . . .
349+
},
350+
351+
/**
352+
* Configures handling of messages reported by the TSDoc parser when analyzing code comments.
353+
*
354+
* TSDoc message identifiers start with "tsdoc-". For example: "tsdoc-link-tag-unescaped-text"
355+
*
356+
* DEFAULT VALUE: A single "default" entry with logLevel=warning.
357+
*/
358+
"tsdocMessageReporting": {
359+
"default": {
360+
"logLevel": "warning",
361+
// "addToApiReportFile": false
362+
}
363+
364+
// "tsdoc-link-tag-unescaped-text": {
365+
// "logLevel": "warning",
366+
// "addToApiReportFile": true
367+
// },
368+
//
369+
// . . .
370+
}
371+
}
372+
373+
}

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"private": true,
33
"scripts": {
4+
"api": "lerna run api",
45
"build": "lerna run build",
56
"build:examples": "lerna run build --scope \"@lumino/example-*\"",
67
"build:src": "lerna run build --scope \"@lumino/!(test-|example-)*\"",

0 commit comments

Comments
 (0)