Skip to content

Commit e666aad

Browse files
committed
Fix up api-extractor configs, add Gulp task
1 parent 275c748 commit e666aad

10 files changed

+80
-86
lines changed

Gulpfile.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,26 @@ const buildAll = () => buildProject("src");
9898

9999
task("moduleBuild", parallel(generateLibs, series(buildScripts, localize, buildAll)));
100100

101+
102+
const apiExtractor = async () => {
103+
async function runApiExtractor(configPath) {
104+
await exec(process.execPath, [
105+
"node_modules/@microsoft/api-extractor/bin/api-extractor",
106+
"run",
107+
"--local",
108+
"--config",
109+
configPath,
110+
]);
111+
}
112+
113+
// TODO(jakebailey): prepend copyright notice, replace const enums with regular enums
114+
await runApiExtractor("./src/typescript/api-extractor.json");
115+
await runApiExtractor("./src/tsserverlibrary/api-extractor.json");
116+
await runApiExtractor("./src/typescriptServices/api-extractor.json");
117+
};
118+
119+
task("api-extractor", series(task("moduleBuild"), apiExtractor));
120+
101121
const buildDebugTools = () => buildProject("src/debug");
102122
const cleanDebugTools = () => cleanProject("src/debug");
103123
cleanTasks.push(cleanDebugTools);

package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"!**/.gitattributes"
4040
],
4141
"devDependencies": {
42-
"@microsoft/api-extractor": "^7.30.0",
42+
"@microsoft/api-extractor": "^7.31.0",
4343
"@octokit/rest": "latest",
4444
"@types/async": "latest",
4545
"@types/chai": "latest",

src/api-extractor-base.json

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,7 @@
22
* Config file for API Extractor. For more info, please visit: https://api-extractor.com
33
*/
44
{
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"
5+
"$schema": "https://raw.githubusercontent.com/microsoft/rushstack/%40microsoft/api-extractor_v7.31.0/apps/api-extractor/src/schemas/api-extractor.schema.json",
206

217
/**
228
* Determines the "<projectFolder>" token that can be used with other config file settings. The project folder
@@ -135,7 +121,6 @@
135121
/**
136122
* (REQUIRED) Whether to generate an API report.
137123
*/
138-
// "enabled": true
139124
"enabled": false
140125

141126
/**
@@ -196,7 +181,6 @@
196181
/**
197182
* (REQUIRED) Whether to generate a doc model file.
198183
*/
199-
// "enabled": true
200184
"enabled": false
201185

202186
/**
@@ -396,6 +380,12 @@
396380
"ae-unresolved-link": {
397381
"logLevel": "none",
398382
"addToApiReportFile": false
383+
},
384+
385+
// This incorrectly fires for functions with partially internal overloads.
386+
"ae-internal-mixed-release-tag": {
387+
"logLevel": "none",
388+
"addToApiReportFile": false
399389
}
400390

401391
// "ae-extra-release-tag": {
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/microsoft/rushstack/%40microsoft/api-extractor_v7.31.0/apps/api-extractor/src/schemas/api-extractor.schema.json",
3+
"extends": "../api-extractor-base.json",
4+
"compiler": {
5+
"tsconfigFilePath": "./tsconfig.json"
6+
},
7+
8+
"mainEntryPointFilePath": "<projectFolder>/built/local/tsserverlibrary/tsserverlibrary.d.ts",
9+
10+
"dtsRollup": {
11+
"enabled": true,
12+
"publicTrimmedFilePath": "<projectFolder>/built/local/tsserverlibrary.d.ts",
13+
"untrimmedFilePath": "<projectFolder>/built/local/tsserverlibrary.internal.d.ts"
14+
}
15+
}
16+
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
import * as ts from "./_namespaces/ts";
2-
3-
// TODO(jakebailey): replace const enum with enum in d.ts
4-
5-
export = ts;
1+
export * from "./_namespaces/ts";

src/typescript/api-extractor.json

Lines changed: 9 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,16 @@
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-
*/
1+
{
2+
"$schema": "https://raw.githubusercontent.com/microsoft/rushstack/%40microsoft/api-extractor_v7.31.0/apps/api-extractor/src/schemas/api-extractor.schema.json",
183
"extends": "../api-extractor-base.json",
19-
20-
/**
21-
* Determines how the TypeScript compiler engine will be invoked by API Extractor.
22-
*/
23-
"compiler": {
24-
/**
25-
* Specifies the path to the tsconfig.json file to be used by API Extractor when analyzing the project.
26-
*
27-
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
28-
* prepend a folder token such as "<projectFolder>".
29-
*
30-
* Note: This setting will be ignored if "overrideTsconfig" is used.
31-
*
32-
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
33-
* DEFAULT VALUE: "<projectFolder>/tsconfig.json"
34-
*/
35-
"tsconfigFilePath": "./tsconfig.json"
4+
"compiler": {
5+
"tsconfigFilePath": "./tsconfig.json"
366
},
37-
38-
/**
39-
* (REQUIRED) Specifies the .d.ts file to be used as the starting point for analysis. API Extractor
40-
* analyzes the symbols exported by this module.
41-
*
42-
* The file extension must be ".d.ts" and not ".ts".
43-
*
44-
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
45-
* prepend a folder token such as "<projectFolder>".
46-
*
47-
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
48-
*/
7+
498
"mainEntryPointFilePath": "<projectFolder>/built/local/typescript/typescript.d.ts",
509

5110
"dtsRollup": {
52-
/**
53-
* (REQUIRED) Whether to generate the .d.ts rollup file.
54-
*/
55-
"enabled": true,
56-
"publicTrimmedFilePath": "<projectFolder>/built/local/typescript.d.ts"
11+
"enabled": true,
12+
"publicTrimmedFilePath": "<projectFolder>/built/local/typescript.d.ts",
13+
"untrimmedFilePath": "<projectFolder>/built/local/typescript.internal.d.ts"
5714
}
58-
}
15+
}
5916

src/typescript/typescript.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import { Debug, LogLevel } from "./_namespaces/ts";
22

3-
// TODO(jakebailey): replace const enum with enum in d.ts
4-
53
// enable deprecation logging
64
declare const console: any;
75
if (typeof console !== "undefined") {
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/microsoft/rushstack/%40microsoft/api-extractor_v7.31.0/apps/api-extractor/src/schemas/api-extractor.schema.json",
3+
"extends": "../api-extractor-base.json",
4+
"compiler": {
5+
"tsconfigFilePath": "./tsconfig.json"
6+
},
7+
8+
"mainEntryPointFilePath": "<projectFolder>/built/local/typescriptServices/typescriptServices.d.ts",
9+
10+
"dtsRollup": {
11+
"enabled": true,
12+
"publicTrimmedFilePath": "<projectFolder>/built/local/typescriptServices.d.ts",
13+
"untrimmedFilePath": "<projectFolder>/built/local/typescriptServices.internal.d.ts"
14+
}
15+
}
16+

src/typescriptServices/typescriptServices.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { Debug, LogLevel } from "./_namespaces/ts";
2-
3-
// TODO(jakebailey): replace const enum with enum in d.ts
2+
import * as _ts from "./_namespaces/ts";
43

54
// enable deprecation logging
65
declare const console: any;
@@ -16,3 +15,5 @@ if (typeof console !== "undefined") {
1615
}
1716
};
1817
}
18+
19+
// TODO(jakebailey): what does this export?

0 commit comments

Comments
 (0)