-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: support custom library paths in react-native.config.js
for codegen on iOS
#34580
Conversation
Currently for codegen to work for a library on iOS, it needs to be located inside `node_modules`. This patch adds support for libraries defined in `react-native.config.js`. This is useful when developing libraries as well as monorepos where the library may exist outside of the `node_modules`. Example: ```js // react-native.config.js const path = require('path'); module.exports = { dependencies: { 'react-native-library-name': { root: path.join(__dirname, '..'), }, }, }; ```
Base commit: bf6a24b |
Base commit: bf6a24b |
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@satya164, thanks for the PR. Some tests on windows. Can you have a look at them, please? |
7b57cb9
to
ee5c594
Compare
ee5c594
to
357bbbc
Compare
@cipolleschi tests are passing now |
@cipolleschi 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 @satya164 in a562216. When will my fix make it into a release? | Upcoming Releases |
…degen on iOS (#34580) Summary: Currently for codegen to work for a library on iOS, it needs to be located inside `node_modules`. This patch adds support for libraries defined in `react-native.config.js`. This is useful when developing libraries as well as monorepos where the library may exist outside of the `node_modules`. Example: ```js // react-native.config.js const path = require('path'); module.exports = { dependencies: { 'react-native-library-name': { root: path.join(__dirname, '..'), }, }, }; ``` ## Changelog [Internal] [Added] - Support custom library paths in `react-native.config.js` for codegen on iOS Pull Request resolved: #34580 Test Plan: Tested on a test application and ensured that codegen finds the library specified in `react-native.config.js` https://user-images.githubusercontent.com/1174278/188141056-bce03730-2a13-4648-8889-9727aaf2c3c4.mp4 I have also added a basic test case for this scenario. Reviewed By: jacdebug, cortinico Differential Revision: D39257919 Pulled By: cipolleschi fbshipit-source-id: 131189f1941128a59b9b1e28af61a9038eb4536b
Summary: While working on 0.71 we noticed that we were hitting a "mock-fs not found" issue on CI, caused by the fact that the dependency was set in the wrong spot. This PR backports to main the fix: 05646f8 & ceaebc6 This is related to the black magics of repo-config, and the fact that devDeps from repo-config don't get propagated back to the root package.json when on stable branch. Because of that, this commit doesn't NOT have a yarn.lock entry (the dep is there in main). I'm confused as to how that dep ended in the devDeps of repo config, it seems something went wrong in migrating some commits from GH to monorepo and back? check out: * #34580 * f0ffd22 ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> [Internal] [Changed] - move mockfs to the right package.json Pull Request resolved: #35476 Test Plan: N/A, change is transparent Reviewed By: cortinico, cipolleschi, dmytrorykun Differential Revision: D41530265 Pulled By: jacdebug fbshipit-source-id: ec7a6426d9a2a766a98a3cccc339ca7ca090c3a0
…degen on iOS (facebook#34580) Summary: Currently for codegen to work for a library on iOS, it needs to be located inside `node_modules`. This patch adds support for libraries defined in `react-native.config.js`. This is useful when developing libraries as well as monorepos where the library may exist outside of the `node_modules`. Example: ```js // react-native.config.js const path = require('path'); module.exports = { dependencies: { 'react-native-library-name': { root: path.join(__dirname, '..'), }, }, }; ``` ## Changelog [Internal] [Added] - Support custom library paths in `react-native.config.js` for codegen on iOS Pull Request resolved: facebook#34580 Test Plan: Tested on a test application and ensured that codegen finds the library specified in `react-native.config.js` https://user-images.githubusercontent.com/1174278/188141056-bce03730-2a13-4648-8889-9727aaf2c3c4.mp4 I have also added a basic test case for this scenario. Reviewed By: jacdebug, cortinico Differential Revision: D39257919 Pulled By: cipolleschi fbshipit-source-id: 131189f1941128a59b9b1e28af61a9038eb4536b
) Summary: While working on 0.71 we noticed that we were hitting a "mock-fs not found" issue on CI, caused by the fact that the dependency was set in the wrong spot. This PR backports to main the fix: facebook@05646f8 & facebook@ceaebc6 This is related to the black magics of repo-config, and the fact that devDeps from repo-config don't get propagated back to the root package.json when on stable branch. Because of that, this commit doesn't NOT have a yarn.lock entry (the dep is there in main). I'm confused as to how that dep ended in the devDeps of repo config, it seems something went wrong in migrating some commits from GH to monorepo and back? check out: * facebook#34580 * facebook@f0ffd22 ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> [Internal] [Changed] - move mockfs to the right package.json Pull Request resolved: facebook#35476 Test Plan: N/A, change is transparent Reviewed By: cortinico, cipolleschi, dmytrorykun Differential Revision: D41530265 Pulled By: jacdebug fbshipit-source-id: ec7a6426d9a2a766a98a3cccc339ca7ca090c3a0
…act-native.config.js Summary: This feature was first introduced here facebook#34580 And then removed here facebook#41654 The motivation for its removing was that Node resolver should handle all those cases for which `react-native.config.js` was used. But it turns out that it fails for the setup that `react-native-builder-bob` has. This diff brings back support for defining external libraries in `react-native.config.js`. Changelog: [Internal] Differential Revision: D53267857
…act-native.config.js (facebook#42771) Summary: This feature was first introduced here facebook#34580 And then removed here facebook#41654 The motivation for its removing was that Node resolver should handle all those cases for which `react-native.config.js` was used. But it turns out that it fails for the setup that `react-native-builder-bob` has. This diff brings back support for defining external libraries in `react-native.config.js`. Changelog: [iOS][Fixed] - Bring back support for defining external libraries in react-native.config.js Reviewed By: cipolleschi Differential Revision: D53267857
…act-native.config.js (#42771) Summary: Pull Request resolved: #42771 This feature was first introduced here #34580 And then removed here #41654 The motivation for its removing was that Node resolver should handle all those cases for which `react-native.config.js` was used. But it turns out that it fails for the setup that `react-native-builder-bob` has. This diff brings back support for defining external libraries in `react-native.config.js`. Changelog: [iOS][Fixed] - Bring back support for defining external libraries in react-native.config.js Reviewed By: cipolleschi Differential Revision: D53267857 fbshipit-source-id: 7625dfe7b4a4651eb60eaec725f94f222a244e30
Summary
Currently for codegen to work for a library on iOS, it needs to be located
inside
node_modules
. This patch adds support for libraries defined inreact-native.config.js
.This is useful when developing libraries as well as monorepos where the library
may exist outside of the
node_modules
.Example:
Changelog
[Internal] [Added] - Support custom library paths in
react-native.config.js
for codegen on iOSTest Plan
Tested on a test application and ensured that codegen finds the library specified in
react-native.config.js
Kapture.2022-09-02.at.14.16.49.mp4
I have also added a basic test case for this scenario.