Skip to content

Conversation

@moskalakamil
Copy link

@moskalakamil moskalakamil commented Nov 10, 2025

Summary

As Nitro Modules docs recommend, this folder should be tracked in git to improve DX
(https://nitro.margelo.com/docs/nitrogen#2-generate-native-specs)
image


Note

Removes nitrogen/ from the template .gitignore so the folder is tracked.

Written by Cursor Bugbot for commit 862aa8c. This will update automatically on new commits. Configure here.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

This PR is being reviewed by Cursor Bugbot

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

Bug: Clean Script Breaks Git Workflow

Removing nitrogen/ from .gitignore conflicts with the react-native-builder-bob configuration in package.json which has "clean": "nitrogen/". This means the build tool will delete the nitrogen/ folder during clean operations, but since it's now tracked in git, developers will constantly have uncommitted deletions, causing merge conflicts and a poor developer experience.

packages/create-react-native-library/templates/common/$.gitignore#L83-L86

https://github.com/callstack/react-native-builder-bob/blob/862aa8c51d644994367d9b15e3084e813a074844/packages/create-react-native-library/templates/common/$.gitignore#L83-L86

Fix in Cursor Fix in Web


@moskalakamil
Copy link
Author

cc @mrousavy, @atlj, should we keep the nitrogen folder in .gitignore?
I saw you guys added it when introducing Nitro Modules support

@satya164
Copy link
Member

Thanks for the PR. However, the note is not entirely correct

This way your library will always ship a working package as a whole (including generated interfaces), and the user does not need to do anything else than to install your package.

Committing generated code to git is not needed for this to work. The generated code is always generated when publishing the package with the prepare script, which makes sure that the library always ships a working package including generated code, and the user doesn't need to do anything.

Committing generated files adds noise to PR reviews - so the only reason you'd commit them is if that's desirable for you and you want to review what changed in the generated code. Typically, it's not common for people to review changes in generated files, but you can always change the default if that's what you want.

So I'm closing the PR.

@satya164 satya164 closed this Nov 10, 2025
@mrousavy
Copy link
Contributor

Yea I agree with @satya164 is saying for this repository.

My repos (nitro itself, and my current nitro libraries) still commit the nitrogen/ folder, but I think at some point I will remove it from git too.
I just like to be fully aware of what exactly changed, as I am still actively improving Nitro.

If you just want to use Nitro to build a module, you likely don't care about the nitrogen/ folder.

So I think we can agree to;

  • DON'T push it to git for callstack/react-native-builder-bob
  • push it to git for mrousavy/nitro

And at some point I will probably remove it too.

@mrousavy
Copy link
Contributor

I just see a tiny problem with the approach that we don't commit it; the prepare / package script absolutely has to work.

If it for some reason fails, we don't want to push a package to npm that contains a broken nitrogen/ folder.

I believe nitrogen already works with exit codes, so if something couldn't be generated it continues to run for other HybridObjects, but still outputs a 1 exit code (I think) - then the package script/push to npm should fail

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.

3 participants