Skip to content

SwiftPM autolinking: don't warn about spm fields mirrored in swiftpmConfig - #59634

Open
chrfalch wants to merge 1 commit into
mainfrom
chrfalch/spm-deprecation-warning-mirrored
Open

chrfalch wants to merge 1 commit into
mainfrom
chrfalch/spm-deprecation-warning-mirrored

Conversation

@chrfalch

Copy link
Copy Markdown
Collaborator

Summary:

A library that supports React Native 0.87 must keep its SwiftPM settings in the deprecated spm block of react-native.config.js, because 0.87 reads only that block. To support 0.88 too, the library also declares the same settings in swiftpmConfig in its package.json. One example is @sentry/react-native, which sets name: "RNSentry" in both places.

React Native 0.88 warned about every field in the spm block, even when swiftpmConfig had the same value. Users of these libraries saw the warning on each spm add, spm update and Xcode sync. The library author could not fix it without dropping 0.87 support.

What changes:

  1. A field in the spm block with the same value in swiftpmConfig is no longer warned about.
  2. A field that is only in the spm block, or that has a different value in swiftpmConfig, is still warned about, with the same message as before.
  3. The settings that React Native uses do not change. swiftpmConfig still wins over the spm block, field by field.

Changelog:

[IOS] [FIXED] - SwiftPM autolinking no longer warns about a deprecated spm field that swiftpmConfig in package.json sets to the same value

Test Plan:

Three new tests in packages/react-native/scripts/spm/__tests__/swiftpm-config-test.js: identical copies give no warning, a different value still warns, and the warning names only the fields that are not identical copies.

yarn jest --no-cache -i packages/react-native/scripts/spm/__tests__/swiftpm-config-test.js
  • Without the source change: 3 failed, 37 passed (the 3 new tests fail).
  • With the source change: 40 passed, 40 total.

yarn flow-check: 0 errors. ESLint (--max-warnings 0) and Prettier pass on both changed files.

…onfig

A library that supports React Native 0.87 must keep its SwiftPM settings
in the deprecated react-native.config.js 'spm' block, because 0.87 reads
only that block. To support 0.88 too, it also declares them in package.json
'swiftpmConfig'. 0.88 warned about every field in the 'spm' block, so these
libraries got a warning they could not fix.

Now a field whose value is the same in both places is not warned about.
Other fields in the 'spm' block are warned about as before.
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 29, 2026
@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Oct 29, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant