fix: fix @react-native-community/cli-platform-* packages not being found in monorepos#47308
fix: fix @react-native-community/cli-platform-* packages not being found in monorepos#47308
@react-native-community/cli-platform-* packages not being found in monorepos#47308Conversation
…found in pnpm setups
@react-native-community/cli-platform-* packages not being found in pnpm setups@react-native-community/cli-platform-* packages not being found in monorepos
9d3672a to
01e7c20
Compare
01e7c20 to
3e56095
Compare
Thanks for adding that comment - I don't love this assumption, but on the basis that the CLI is already making it, I'm OK building on it and calling this non-breaking. I think we should investigate using an optional peer dependency here though - the sticking point might be the number of non-CLI users on Yarn classic. |
|
@robhogan has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
|
This pull request was successfully merged by @tido64 in 7926d65 When will my fix make it into a release? | How to file a pick request? |
…found in monorepos (#47308) Summary: Fix `react-native-community/cli-platform-*` packages not being found in monorepos. Note that we are making the assumption that `process.cwd()` returns the project root. This is the same assumption that `react-native-community/cli` makes. Specifically, `findProjectRoot()` has an optional argument that defaults to `process.cwd()`: - [`findProjectRoot()`](https://github.com/react-native-community/cli/blob/14.x/packages/cli-tools/src/findProjectRoot.ts) - Which gets called without arguments in [`loadConfig()`](https://github.com/react-native-community/cli/blob/14.x/packages/cli-config/src/loadConfig.ts#L89) - `loadConfig()` gets called from [`setupAndRun()`](https://github.com/react-native-community/cli/blob/14.x/packages/cli/src/index.ts#L196), also without project root set As far as I can see, the project root argument is only ever used in tests. ## Changelog: [GENERAL] [FIXED] - Fix `react-native-community/cli-platform-*` packages not being found in monorepos Pull Request resolved: #47308 Test Plan: 1. Clone/check out this branch: microsoft/rnx-kit#3409 2. Cherry-pick #47304 3. Cherry-pick #47308 4. Run `react-native config` inside `packages/test-app` 5. Verify that `projects` is populated **Before:** ```js "healthChecks": [], "platforms": {}, "assets": [], "project": {} } ``` **After:** ```js "healthChecks": [], "platforms": { "ios": {}, "android": {} }, "assets": [], "project": { "ios": { "sourceDir": "/~/packages/test-app/ios", "xcodeProject": { "name": "SampleCrossApp.xcworkspace", "path": ".", "isWorkspace": true }, "automaticPodsInstallation": false, "assets": [] }, "android": { "sourceDir": "/~/packages/test-app/android", "appName": "app", "packageName": "com.msft.identity.client.sample.local", "applicationId": "com.msft.identity.client.sample.local", "mainActivity": "com.microsoft.reacttestapp.MainActivity", "assets": [] } } } ``` Reviewed By: cortinico Differential Revision: D69465533 Pulled By: robhogan fbshipit-source-id: 3d6cf32752a7a41d9c7e84f35b0f26ae7d7a971f
|
This pull request was successfully merged by @tido64 in ffe7bd1 When will my fix make it into a release? | How to file a pick request? |
Summary:
Fix
@react-native-community/cli-platform-*packages not being found in monorepos.Note that we are making the assumption that
process.cwd()returns the project root. This is the same assumption that@react-native-community/climakes. Specifically,findProjectRoot()has an optional argument that defaults toprocess.cwd():findProjectRoot()loadConfig()loadConfig()gets called fromsetupAndRun(), also without project root setAs far as I can see, the project root argument is only ever used in tests.
Changelog:
[GENERAL] [FIXED] - Fix
@react-native-community/cli-platform-*packages not being found in monoreposTest Plan:
react-nativeto 0.76 microsoft/rnx-kit#3409@react-native-community/clinot being found in monorepos #47304@react-native-community/cli-platform-*packages not being found in monorepos #47308react-native configinsidepackages/test-appprojectsis populatedBefore:
After: