You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit f8e2993
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: apps/api-extractor/README.md
+9-6Lines changed: 9 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,24 +11,27 @@
11
11
12
12
**API Extractor** helps you build better [TypeScript](https://www.typescriptlang.org/) library packages. Suppose for example that your company has published an NPM package called "**awesome-widgets**" that exports many classes and interfaces. As developers start to depend on your library, you may encounter issues such as...
13
13
14
-
-**Determining versions:** The [SemVer](http://semver.org/) standard uses version numbers to communicate the impact of upgrading to your consumers. But when it's time to publish a new release, how to determine whether it should be a "major", "minor", or "patch" version? For an active project with many source files, it's often not obvious how the API contract has changed.
15
-
16
14
-**Accidental breaks:** People keep reporting that their code won't compile after a supposedly "minor" update. To address this, you boldly propose that every **awesome-widgets** pull request must be approved by an experienced developer from your team. But that proves unrealistic -- nobody has time to look at every single PR! What you really need is a way to detect PRs that change API contracts, and flag them for review. That would focus attention in the right place... but how to do that?
17
15
18
16
-**Missing exports:** Suppose the **awesome-widgets** package exports an API function `AwesomeButton.draw()` that requires a parameter of type `DrawStyle`, but you forgot to export this enum. Things seem fine at first, but when a developer tries to call that function, they discover that there's no way to specify the `DrawStyle`. How to avoid these oversights?
19
17
20
-
-**Accidental exports:** You meant for your`DrawHelper` class to be kept internal, but one day you realize it's being exported by your package. When you try to remove it, you learn that some consumers are now relying on it. How do we avoid this in the future?
18
+
-**Accidental exports:** You meant for your `DrawHelper` class to be kept internal, but one day you realize it's a package export. When you try to remove it, consumers complain that they are using it. How do we avoid this in the future?
19
+
20
+
-**Alpha/Beta graduation:** You want to release previews of new APIs that are not ready for prime time yet. But if you did a major SemVer bump every time you change these definitions, the villagers would be after you with torches and pitchforks! A better approach is to designate certain classes/members as **alpha** quality, then promote them to **beta** and finally to **public** when they're mature. But how to indicate this to your consumers? (And how to detect scoping mistakes? A **public** function should never return a **beta** result.)
21
21
22
-
-**Alpha/Beta graduation:**You want to release previews of new APIs that are not ready for prime time yet. If you did a major SemVer bump every time you change these definitions, the villagers would be after you with torches and pitchforks. A better approach is to designate certain classes/members as "**alpha**" quality, then promote them to "**beta**" and finally to "**public**" when they're mature. But how to indicate this to your consumers? (And how to detect scoping mistakes? A "public" function should never return a "beta" result.)
22
+
-**\*.d.ts rollup:** You webpacked your library into a nice **\*.js** bundle file -- so why are you distributing your typings as a messy tree of **lib/\*.d.ts** files full of private definitions? Let's consolidate them into a tidy **\*.d.ts** rollup file. If you publish internal/beta/public releases, a semantic analyzer can trim the **\*.d.ts** rollup according to each release type. Developers working on a production project don't want to see a bunch of **internal** and **beta** members in their VS Code IntelliSense!
23
23
24
24
-**Online documentation:** You have faithfully annotated each TypeScript member with nice [JSDoc](http://usejsdoc.org/) descriptions. Now that your library is published, you should probably set up [a nicely formatted](https://docs.microsoft.com/en-us/javascript/api/sp-http) API reference. Which tool should we use to generate that? (What!? There aren't any good ones!?)
25
25
26
26
**API Extractor** provides an integrated, professional-quality solution for all these problems. It is invoked at build time by your toolchain and leverages the TypeScript compiler engine to:
27
27
28
28
- Detect a project's exported API surface
29
29
- Capture the contracts in a concise report designed to facilitate review
30
-
- Warn about common mistakes (e.g. missing exports, inconsistent visibility, etc)
31
-
- Generate API documentation in portable format that's easy to integrate with your publishing pipeline
30
+
- Warn about common mistakes (e.g. missing exports, inconsistent visibility, etc.)
31
+
- Generate \*.d.ts rollups
32
+
- Output API documentation in a portable format that's easy to integrate with your publishing pipeline
33
+
34
+
Best of all, **API Extractor** is free and open source. Join the community and create a pull request!
0 commit comments