Skip to content
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

Closed

Conversation

satya164
Copy link
Contributor

@satya164 satya164 commented Sep 2, 2022

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:

// 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

Test 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.

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, '..'),
    },
  },
};
```
@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Contributor A React Native contributor. p: Callstack Partner: Callstack Partner labels Sep 2, 2022
@github-actions
Copy link

github-actions bot commented Sep 2, 2022

Warnings
⚠️ 🔒 package.json - Changes were made to package.json. This will require a manual import by a Facebook employee.

Generated by 🚫 dangerJS against 357bbbc

@facebook-github-bot facebook-github-bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Sep 2, 2022
@react-native-bot react-native-bot added the Type: Enhancement A new feature or enhancement of an existing feature. label Sep 2, 2022
@analysis-bot
Copy link

analysis-bot commented Sep 2, 2022

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 7,635,165 -2,787
android hermes armeabi-v7a 7,047,162 -2,788
android hermes x86 7,937,127 -2,782
android hermes x86_64 7,909,156 -2,787
android jsc arm64-v8a 9,512,123 -1,626
android jsc armeabi-v7a 8,287,415 -1,632
android jsc x86 9,451,652 -1,638
android jsc x86_64 10,042,904 -1,630

Base commit: bf6a24b
Branch: main

@analysis-bot
Copy link

analysis-bot commented Sep 2, 2022

Platform Engine Arch Size (bytes) Diff
ios - universal n/a --

Base commit: bf6a24b
Branch: main

@facebook-github-bot
Copy link
Contributor

@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@cipolleschi
Copy link
Contributor

@satya164, thanks for the PR. Some tests on windows. Can you have a look at them, please?

@satya164 satya164 force-pushed the @satya164/codegen-custom-path branch from 7b57cb9 to ee5c594 Compare September 6, 2022 09:38
@satya164 satya164 force-pushed the @satya164/codegen-custom-path branch from ee5c594 to 357bbbc Compare September 6, 2022 10:33
@satya164
Copy link
Contributor Author

satya164 commented Sep 6, 2022

@cipolleschi tests are passing now

@facebook-github-bot
Copy link
Contributor

@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@react-native-bot
Copy link
Collaborator

This pull request was successfully merged by @satya164 in a562216.

When will my fix make it into a release? | Upcoming Releases

@react-native-bot react-native-bot added the Merged This PR has been merged. label Sep 8, 2022
@satya164 satya164 deleted the @satya164/codegen-custom-path branch September 8, 2022 10:34
dmytrorykun pushed a commit that referenced this pull request Sep 14, 2022
…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
facebook-github-bot pushed a commit that referenced this pull request Nov 25, 2022
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
OlimpiaZurek pushed a commit to OlimpiaZurek/react-native that referenced this pull request May 22, 2023
…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
OlimpiaZurek pushed a commit to OlimpiaZurek/react-native that referenced this pull request May 22, 2023
)

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
dmytrorykun added a commit to dmytrorykun/react-native that referenced this pull request Jan 31, 2024
…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
dmytrorykun added a commit to dmytrorykun/react-native that referenced this pull request Feb 1, 2024
…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
facebook-github-bot pushed a commit that referenced this pull request Feb 1, 2024
…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
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. Contributor A React Native contributor. Merged This PR has been merged. p: Callstack Partner: Callstack Partner Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. Type: Enhancement A new feature or enhancement of an existing feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants