Repository navigation
feat(macos): Add config-macos CLI for finding react-native-macos package path in hoisted style module - #3125
Open
RakaDoank (RakaDoank) wants to merge 3 commits into
Open
RakaDoank (RakaDoank) wants to merge 3 commits into
RakaDoank (RakaDoank) wants to merge 3 commits into
Conversation
…-native-macos package path
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Author
|
@microsoft-github-policy-service agree
|
…into RakaDoank/config-macos-cli
This branch has not been deployed
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.
Summary:
Our
autolinking.rbscript file is resolving areactNativePathresult to the "react-native" package path instead of "react-native-macos", and because of that, I saw ourPodfiletemplate (for init) file is manually pointing to the "react-native-macos" path. This is not a perfect for hoisted style module in monorepo project with Bun, and pnpm.For this issue, I have created a new community custom command called
config-macosThis command is just an extension of the
@react-native-community/cli. The only difference is this command resolves theconfig.reactNativePathto the "react-native-macos" path, only ifreactNativePathis not configured by user manually in theirreact-native.config.jsfile.This command allows our
autolinking.rbscript to get real "react-native-macos" package path, and provide the resolved path to theuse_react_nativeandreact_native_post_installdef in the user's Podfile (at our init template file to be exact).What's changed:
react-native-macos/react-native.config.jsreact-native-macos/local-cli/config-macosfile for the functionreact-native-macos/scripts/cocoapods/autolinking.rbreact-native-macos/local-cli/config-macos/config-macos.jsreactNativePathresult from @react-native-community/cli to the "react-native-macos" path only ifreactNativePathproperty is not found in userreact-native.config.jsfilereact-native-macos/local-cli/config-macos/read-config-from-disk.jsThis is an helper for the config-macos.js to get user
react-native.config.js. This is a similar function of readConfigFromDisk.ts from @react-native-community/cli-config, but we have to reinvent this because the original function is not exported publiclyreact-native-macos/scripts/cocoapods/autolinking.rbThe default command to get the JSON config has been changed from "config" to "config-macos"
react-native-macos/generator-macos/PodfileThis is an exact copy Podfile template from https://github.com/react-native-community/template/blob/main/template/ios/Podfile