Skip to content

Commit e08154d

Browse files
committed
Add api-extractor
1 parent 22a440a commit e08154d

8 files changed

+709
-9
lines changed

Gulpfile.js

+18
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,24 @@ const buildAll = () => buildProject("src");
9898

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

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

package-lock.json

+571
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"!**/.gitattributes"
4040
],
4141
"devDependencies": {
42+
"@microsoft/api-extractor": "^7.31.0",
4243
"@octokit/rest": "latest",
4344
"@types/async": "latest",
4445
"@types/chai": "latest",

src/api-extractor-base.json

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
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+
"projectFolder": "..",
4+
"mainEntryPointFilePath": "",
5+
"bundledPackages": [],
6+
"newlineKind": "crlf",
7+
"enumMemberOrder": "preserve",
8+
9+
"compiler": {
10+
"tsconfigFilePath": ""
11+
},
12+
"apiReport": {
13+
"enabled": false
14+
},
15+
"docModel": {
16+
"enabled": false
17+
},
18+
"dtsRollup": {
19+
"enabled": true,
20+
"untrimmedFilePath": "",
21+
"alphaTrimmedFilePath": "",
22+
"betaTrimmedFilePath": "",
23+
"publicTrimmedFilePath": "",
24+
"omitTrimmingComments": true
25+
},
26+
"tsdocMetadata": {
27+
"enabled": false
28+
},
29+
"messages": {
30+
"compilerMessageReporting": {
31+
"default": {
32+
"logLevel": "warning"
33+
}
34+
// "TS2551": {
35+
// "logLevel": "warning",
36+
// "addToApiReportFile": true
37+
// },
38+
//
39+
// . . .
40+
},
41+
"extractorMessageReporting": {
42+
"default": {
43+
"logLevel": "warning"
44+
// "addToApiReportFile": false
45+
},
46+
"ae-internal-missing-underscore": {
47+
"logLevel": "none",
48+
"addToApiReportFile": false
49+
},
50+
// TODO(jakebailey): should we explicitly mark things as public?
51+
"ae-missing-release-tag": {
52+
"logLevel": "none",
53+
"addToApiReportFile": false
54+
},
55+
// TODO(jakebailey): Fix these?
56+
"ae-unresolved-link": {
57+
"logLevel": "none",
58+
"addToApiReportFile": false
59+
},
60+
// This incorrectly fires for functions with partially internal overloads.
61+
"ae-internal-mixed-release-tag": {
62+
"logLevel": "none",
63+
"addToApiReportFile": false
64+
}
65+
// "ae-extra-release-tag": {
66+
// "logLevel": "warning",
67+
// "addToApiReportFile": true
68+
// },
69+
//
70+
// . . .
71+
},
72+
"tsdocMessageReporting": {
73+
"default": {
74+
"logLevel": "none",
75+
"addToApiReportFile": false
76+
}
77+
// "tsdoc-link-tag-unescaped-text": {
78+
// "logLevel": "warning",
79+
// "addToApiReportFile": true
80+
// },
81+
//
82+
// . . .
83+
}
84+
}
85+
}
+16
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+
+1-5
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

+16
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/typescript/typescript.d.ts",
9+
10+
"dtsRollup": {
11+
"enabled": true,
12+
"publicTrimmedFilePath": "<projectFolder>/built/local/typescript.d.ts",
13+
"untrimmedFilePath": "<projectFolder>/built/local/typescript.internal.d.ts"
14+
}
15+
}
16+

src/typescript/typescript.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
import * as ts from "./_namespaces/ts";
21
import { Debug, LogLevel } from "./_namespaces/ts";
32

4-
// TODO(jakebailey): replace const enum with enum in d.ts
5-
63
// enable deprecation logging
74
declare const console: any;
85
if (typeof console !== "undefined") {
@@ -18,4 +15,4 @@ if (typeof console !== "undefined") {
1815
};
1916
}
2017

21-
export = ts;
18+
export * from "./_namespaces/ts";

0 commit comments

Comments
 (0)