Problem
The Sentry Cocoa and Android SDKs have automated public API tracking (Cocoa uses swift-api-digester, Android uses Metalava), but the React Native SDK has no equivalent. Public API changes can slip through without explicit review, risking accidental breaking changes.
Solution
Add @microsoft/api-extractor to generate a committed .api.md baseline report and a CI check that fails if the public API changes without updating it.
This mirrors the approach used by:
- sentry-cocoa:
swift-api-digester with committed JSON baselines + api-stability.yml CI workflow
- sentry-java (Android): Metalava with
api.txt + apiCheck Gradle task
- react-native core:
@microsoft/api-extractor in scripts/js-api/
Implementation
- Add
api-extractor.json config and a dedicated tsconfig.api-extractor.json
- Generate and commit the baseline report at
packages/core/etc/sentry-react-native.api.md
- Add
api-report:generate and api-report:check scripts
- Add a CI job in
buildandtest.yml that validates the report is up to date
- Add
yarn api-report root shortcut
Developer Workflow
When changing the public API:
yarn build:sdk
yarn api-report
# Review diff in packages/core/etc/sentry-react-native.api.md
# Commit the updated report alongside code changes
Problem
The Sentry Cocoa and Android SDKs have automated public API tracking (Cocoa uses
swift-api-digester, Android uses Metalava), but the React Native SDK has no equivalent. Public API changes can slip through without explicit review, risking accidental breaking changes.Solution
Add @microsoft/api-extractor to generate a committed
.api.mdbaseline report and a CI check that fails if the public API changes without updating it.This mirrors the approach used by:
swift-api-digesterwith committed JSON baselines +api-stability.ymlCI workflowapi.txt+apiCheckGradle task@microsoft/api-extractorinscripts/js-api/Implementation
api-extractor.jsonconfig and a dedicatedtsconfig.api-extractor.jsonpackages/core/etc/sentry-react-native.api.mdapi-report:generateandapi-report:checkscriptsbuildandtest.ymlthat validates the report is up to dateyarn api-reportroot shortcutDeveloper Workflow
When changing the public API: