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

fix: don't ship generated code with the library #819

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

satya164
Copy link
Member

@satya164 satya164 commented Apr 11, 2025

Summary

We currently have includesGenerateCode: true which ships codegen specs with the library. The original idea was that the generated code is consistent regardless of React Native version, which can lead to better stability.

However, in a practical sense, a different React Native version may not support this generated code anyway, so the library may get locked to single React Native version anyway.

The generated code will use the React Native version defined inside your library. So if your library is shipping with React Native 0.76, the generated code will be based on that version. This could mean that the generated code is not compatible with apps using previous React Native version used by the app (e.g. an App running on React Native 0.75). - Including Generated Code into Libraries

This has caused issues for us - breaking our template almost every React Native release due to API changes in the codegen script, which adds a maintenance burden without any concrete benefits.

So, this change removes this option from the default template. The documentation has been updated as well with instructions on how to enable this.

Test plan

Generate the Turbo Module and Fabric templates and verify that the app builds and runs on Android & iOS.

@satya164 satya164 force-pushed the @satya164/no-codegen branch 3 times, most recently from 2a95af5 to 22a6393 Compare April 12, 2025 14:50
@satya164 satya164 marked this pull request as ready for review April 12, 2025 20:08
@satya164 satya164 force-pushed the @satya164/no-codegen branch from 22a6393 to 5260f9f Compare April 13, 2025 13:10
@satya164 satya164 force-pushed the @satya164/no-codegen branch from 5260f9f to e704ba0 Compare April 13, 2025 13:44
@satya164 satya164 requested a review from Copilot April 13, 2025 13:45
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 7 out of 11 changed files in this pull request and generated no comments.

Files not reviewed (4)
  • packages/create-react-native-library/templates/common-local/$package.json: Language not supported
  • packages/create-react-native-library/templates/common/$package.json: Language not supported
  • packages/create-react-native-library/templates/objc-library/ios/{%- project.name %}.h: Language not supported
  • packages/create-react-native-library/templates/objc-view-new/ios/{%- project.name %}View.mm: Language not supported

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant