mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
6b40f35032
Summary: This diff adds snapshot `diff-api-snapshot` script for public JS API breaking change detection. ### Motivation Detecting if there are any breaking changes introduced in the commit. It is achieved by comparing `ReactNativeApi.d.ts` rollup from the current and previous revision. This is a naive implementation with a three possible outcomes: - BREAKING - POTENTIALLY_NOT_BREAKING, - NOT_BREAKING The algorithm analyses exported top-level statements (after inlining) in both rollups and tries to create a mapping between them by name. The **BREAKING** outcome happens whenever the statement is: - removed - renamed - changed - not exported anymore (private) The **POTENTIALLY_NOT_BREAKING** outcome happens if it's not BREAKING and the new statement is added. The **NOT_BREAKING** outcome happens if public API snapshot doesn't change. Changelog: [General][Added] - Add public JS API breaking change detection under `yarn diff-api-snapshot` script. Pull Request resolved: https://github.com/facebook/react-native/pull/51972 Test Plan: Signals, added tests. In `react-native-github` run: `yarn test scripts/diff-api-snapshot/__tests__/diffApiSnapshot-test.js` Rollback Plan: Reviewed By: j-piasecki Differential Revision: D76430965 Pulled By: coado fbshipit-source-id: 095a196aa4f643501db0af9262556ddefff5d30d