Skip to content

Commit f392f18

Browse files
alan-agius4vikerman
authored andcommitted
docs: add documentation for API guardian (#13065)
1 parent cd66d27 commit f392f18

File tree

2 files changed

+72
-0
lines changed

2 files changed

+72
-0
lines changed

CONTRIBUTING.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ to follow:
1212
- [Coding Rules](#rules)
1313
- [Commit Message Guidelines](#commit)
1414
- [Signing the CLA](#cla)
15+
- [Updating the Public API](#public-api)
1516

1617
## <a name="coc"></a> Code of Conduct
1718
Help us keep Angular open and inclusive. Please read and follow our [Code of Conduct][coc].
@@ -274,3 +275,38 @@ changes to be accepted, the CLA must be signed. It's a quick process, we promise
274275
[individual-cla]: http://code.google.com/legal/individual-cla-v1.0.html
275276
[js-style-guide]: https://google.github.io/styleguide/jsguide.html
276277
[stackoverflow]: http://stackoverflow.com/questions/tagged/angular-devkit
278+
279+
## <a name="public-api"></a> Updating the Public API
280+
Our Public API is protected with TS API Guardian. This is a tool that keeps track of public API surface of our packages.
281+
282+
To test if your change effect the public API you need to run the API guardian on that particular package.
283+
284+
For example in case `@angular-devkit/core` package was modified you need to run:
285+
286+
```bash
287+
bazel test //etc/api:angular_devkit_core_api
288+
```
289+
290+
You can also test all packages by running:
291+
```bash
292+
bazel test //etc/api ...
293+
```
294+
295+
If you modified the public API, the test will fail. To update the golden files you need to run:
296+
297+
```bash
298+
bazel run //etc/api:angular_devkit_core_api.accept
299+
```
300+
301+
**Note**: In some cases we use aliased symbols to create namespaces.
302+
303+
Example:
304+
```javascript
305+
import * as foo from './foo';
306+
307+
export { foo };
308+
```
309+
There are currently not supported by the API guardian.
310+
To overcome this limitiation we created `_golden-api.ts` in certain packages.
311+
312+
When adding a new API, it might be the case that you need to add it to `_golden-api.ts`.

scripts/templates/contributing.ejs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ to follow:
1212
- [Coding Rules](#rules)
1313
- [Commit Message Guidelines](#commit)
1414
- [Signing the CLA](#cla)
15+
- [Updating the Public API](#public-api)
1516

1617
## <a name="coc"></a> Code of Conduct
1718
Help us keep Angular open and inclusive. Please read and follow our [Code of Conduct][coc].
@@ -263,3 +264,38 @@ changes to be accepted, the CLA must be signed. It's a quick process, we promise
263264
[individual-cla]: http://code.google.com/legal/individual-cla-v1.0.html
264265
[js-style-guide]: https://google.github.io/styleguide/jsguide.html
265266
[stackoverflow]: http://stackoverflow.com/questions/tagged/angular-devkit
267+
268+
## <a name="public-api"></a> Updating the Public API
269+
Our Public API is protected with TS API Guardian. This is a tool that keeps track of public API surface of our packages.
270+
271+
To test if your change effect the public API you need to run the API guardian on that particular package.
272+
273+
For example in case `@angular-devkit/core` package was modified you need to run:
274+
275+
```bash
276+
bazel test //etc/api:angular_devkit_core_api
277+
```
278+
279+
You can also test all packages by running:
280+
```bash
281+
bazel test //etc/api ...
282+
```
283+
284+
If you modified the public API, the test will fail. To update the golden files you need to run:
285+
286+
```bash
287+
bazel run //etc/api:angular_devkit_core_api.accept
288+
```
289+
290+
**Note**: In some cases we use aliased symbols to create namespaces.
291+
292+
Example:
293+
```javascript
294+
import * as foo from './foo';
295+
296+
export { foo };
297+
```
298+
There are currently not supported by the API guardian.
299+
To overcome this limitiation we created `_golden-api.ts` in certain packages.
300+
301+
When adding a new API, it might be the case that you need to add it to `_golden-api.ts`.

0 commit comments

Comments
 (0)