Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add documentation for API guardian #13065

Merged
merged 1 commit into from
Nov 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
36 changes: 36 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ to follow:
- [Coding Rules](#rules)
- [Commit Message Guidelines](#commit)
- [Signing the CLA](#cla)
- [Updating the Public API](#public-api)

## <a name="coc"></a> Code of Conduct
Help us keep Angular open and inclusive. Please read and follow our [Code of Conduct][coc].
Expand Down Expand Up @@ -274,3 +275,38 @@ changes to be accepted, the CLA must be signed. It's a quick process, we promise
[individual-cla]: http://code.google.com/legal/individual-cla-v1.0.html
[js-style-guide]: https://google.github.io/styleguide/jsguide.html
[stackoverflow]: http://stackoverflow.com/questions/tagged/angular-devkit

## <a name="public-api"></a> Updating the Public API
Our Public API is protected with TS API Guardian. This is a tool that keeps track of public API surface of our packages.

To test if your change effect the public API you need to run the API guardian on that particular package.

For example in case `@angular-devkit/core` package was modified you need to run:

```bash
bazel test //etc/api:angular_devkit_core_api
```

You can also test all packages by running:
```bash
bazel test //etc/api ...
```

If you modified the public API, the test will fail. To update the golden files you need to run:

```bash
bazel run //etc/api:angular_devkit_core_api.accept
```

**Note**: In some cases we use aliased symbols to create namespaces.

Example:
```javascript
import * as foo from './foo';

export { foo };
```
There are currently not supported by the API guardian.
To overcome this limitiation we created `_golden-api.ts` in certain packages.

When adding a new API, it might be the case that you need to add it to `_golden-api.ts`.
36 changes: 36 additions & 0 deletions scripts/templates/contributing.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ to follow:
- [Coding Rules](#rules)
- [Commit Message Guidelines](#commit)
- [Signing the CLA](#cla)
- [Updating the Public API](#public-api)

## <a name="coc"></a> Code of Conduct
Help us keep Angular open and inclusive. Please read and follow our [Code of Conduct][coc].
Expand Down Expand Up @@ -263,3 +264,38 @@ changes to be accepted, the CLA must be signed. It's a quick process, we promise
[individual-cla]: http://code.google.com/legal/individual-cla-v1.0.html
[js-style-guide]: https://google.github.io/styleguide/jsguide.html
[stackoverflow]: http://stackoverflow.com/questions/tagged/angular-devkit

## <a name="public-api"></a> Updating the Public API
Our Public API is protected with TS API Guardian. This is a tool that keeps track of public API surface of our packages.

To test if your change effect the public API you need to run the API guardian on that particular package.

For example in case `@angular-devkit/core` package was modified you need to run:

```bash
bazel test //etc/api:angular_devkit_core_api
```

You can also test all packages by running:
```bash
bazel test //etc/api ...
```

If you modified the public API, the test will fail. To update the golden files you need to run:

```bash
bazel run //etc/api:angular_devkit_core_api.accept
```

**Note**: In some cases we use aliased symbols to create namespaces.

Example:
```javascript
import * as foo from './foo';

export { foo };
```
There are currently not supported by the API guardian.
To overcome this limitiation we created `_golden-api.ts` in certain packages.

When adding a new API, it might be the case that you need to add it to `_golden-api.ts`.