Loosen JS API breaking change detection, improve Danger message (#54901)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54901

At present, we're only using a rough heuristic for whether a code change to `ReactNativeApi.d.ts` is a breaking change. Introduce `POTENTIALLY_BREAKING` result level and update Danger warnings box.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D89287801

fbshipit-source-id: aced7911ecde37a1ad2c355d56ef0f0edde88fd4
This commit is contained in:
Alex Hunt authored and meta-codesync[bot] committed 2025-12-16 08:14:38 -08:00
1 parent 498514d12e
commit a22ab422e8
3 files changed
+18 -14

No files matched your search

@@ -14,6 +14,7 @@ const t = require('@babel/types');
const Result = {
BREAKING: 'BREAKING',
POTENTIALLY_BREAKING: 'POTENTIALLY_BREAKING',
POTENTIALLY_NON_BREAKING: 'POTENTIALLY_NON_BREAKING',
NON_BREAKING: 'NON_BREAKING',
} as const;
@@ -62,7 +63,7 @@ function analyzeSpecHashPairs(
const newHash = newSpecHashMapping[name];
if (hash !== newHash) {
// The hash has changed which means that the statement has changed
output.result = Result.BREAKING;
output.result = Result.POTENTIALLY_BREAKING;
output.changedApis.push(name);
}
delete newSpecHashMapping[name];
+3 -4
View File
@@ -35,10 +35,9 @@ async function main() {
Usage: node ./scripts/js-api/diff-api-snapshot <prev-snapshot> <new-snapshot>
Analyze changes between two versions of React Native's JavaScript API
snapshot (yarn build-types). Returns a JSON object with the following
fields:
- result: 'BREAKING', 'POTENTIALLY_NON_BREAKING' or 'NON_BREAKING'.
- changedApis: List of changed APIs.
snapshot (yarn build-types). Returns a JSON object with the following fields:
- result: 'BREAKING', 'POTENTIALLY_BREAKING', 'POTENTIALLY_NON_BREAKING' or 'NON_BREAKING'.
- changedApis: List of changed APIs.
`);
process.exitCode = 0;
return;