fix(馃摝): mark the Apple binary packages as optional dependencies - #4042
Open
ForestSpark wants to merge 3 commits into
Open
ForestSpark wants to merge 3 commits into
ForestSpark wants to merge 3 commits into
Conversation
The podspec raises if `libs/macos` is missing, even when only iOS is being built. tvOS already handles its own absence gracefully a few lines below, so the two platforms behave inconsistently for the same condition. This matters for iOS-only apps. The `react-native-skia-apple-*` binaries are declared as hard `dependencies`, so every consumer downloads all of them. An iOS-only app can never use the macOS or tvOS xcframeworks, but pruning them with an override is blocked by the raise. Make macOS mirror the existing tvOS handling: fall back to an empty `vendored_frameworks` list when `libs/macos` is absent, and only hard-fail when `libs/ios` is missing. The error still fires for the case it was written for - a consumer who never ran `yarn install`, where `libs/ios` is also absent. No behaviour change when the packages are present, since libs/macos then exists and the original path is taken. Also document the npm-side story, which was previously a single sentence: which prebuilt packages exist, which can be pruned and how, and why react-native-skia-apple-ios, react-native-skia-android and canvaskit-wasm cannot. Clarifies that these packages affect node_modules and install time but not shipped app size, which is a recurring source of confusion.
The three react-native-skia-apple-* packages are only read by Xcode, which runs on macOS. Listing them as optionalDependencies lets package managers skip them on Linux and Windows once the packages declare os: [darwin], instead of downloading ~525 MB of xcframeworks those hosts cannot use. react-native-skia-android stays a hard dependency because Gradle runs on every OS. The release workflow's Graphite swap keeps the same split via the new graphiteOptionalDependencies field, and the podspec hint mentions that --omit=optional now also drops the iOS binaries.
Author
|
I have signed the CLA! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #4005, built on top of it (its two commits are included, the diff shrinks once it lands).
Every install downloads all four binary packages, about 750 MB. The three Apple ones are about 525 MB and only Xcode reads them, so Linux and Windows installs (web or Android CI) cannot use them.
This moves
react-native-skia-apple-ios,-macosand-tvostooptionalDependencies. Android stays a hard dependency because Gradle runs everywhere. The Graphite swap in the release workflow keeps the same split viagraphiteOptionalDependencies,yarn.lockrecords the optional flags, and the podspec hint and install docs mention that--omit=optionalnow also skips the iOS package.The skip only kicks in once the packages declare
"os": ["darwin"](wcandillon/react-native-skia-binaries#8) and the pins here are bumped. Then Linux and Windows get only the Android package and Mac installs do not change. Until that bump the only visible change is for--omit=optionalinstalls, which lose the Apple binaries. The pins are exact, so order does not matter. Docs for the per-OS behaviour will come with the pin bump.Tested on npm 10.9.4 and Yarn 4.18.0: both skip an optional package whose
osdoes not match, also one level down the tree, and a Linux-madepackage-lock.jsonstill installs it on a Mac withnpm ci. Yarn only evaluatesosbehind optional edges, so it needs this move too.