chore: keep generated code out of git by default - #129
Open
huhuanming wants to merge 1 commit into
Open
huhuanming wants to merge 1 commit into
huhuanming wants to merge 1 commit into
Conversation
The nitrogen output in react-native-image and react-native-native-list was not an accident of those two packages; nothing in the repo stopped it. Three gaps, all closed here. The root .gitignore already covers builder-bob output (native-*/*/lib/) and CMake output (native-*/*/android/.cxx/) for every workspace, but had no rule for nitrogen. Add native-modules/*/nitrogen/ and native-views/*/nitrogen/ so codegen output is ignored repo-wide instead of depending on each package carrying its own .gitignore. create-nitro-module.js writes a .gitignore from scripts/nitro/template; create-nitro-view.js had no equivalent, and scripts/nitro-view/template shipped no .gitignore at all, so every view package scaffolded from it was born without one. react-native-image and react-native-native-list, the two newest view packages, are exactly the two that committed their nitrogen trees. Add the template file and emit it in step 8. Thirteen older packages never had a .gitignore either. They are all non-Nitro today, so nothing leaked yet, but they are one codegen run away from the same thing. Give them the same file the other packages use. No currently tracked file matches the new rules. Also drop scripts/nitro/template/android/.gradle: ten Gradle lock and checksum binaries that get copied into every module created from that template. The template's own .gitignore has listed .gradle since it was written, but these files were already tracked, so the rule never applied. The root ignore entry for the view template's .gradle is generalized to scripts/*/template/android/.gradle/ to cover both. The 117 generated files themselves are removed in the OK-63873 branch; this change only stops them coming back. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
#126 removes 117 committed
nitrogen/generatedfiles fromreact-native-imageandreact-native-native-list. That was not an accident of those two packages — nothing in the repo stopped it. Three gaps:.gitignorehas no nitrogen rule. It already covers builder-bob output (native-modules/*/lib/,native-views/*/lib/) and CMake output (native-*/*/android/.cxx/) for every workspace, so those artifacts are protected repo-wide. Nitrogen output was left entirely to each package's own.gitignore..gitignore.create-nitro-module.jswrites one fromscripts/nitro/template/.gitignore;create-nitro-view.jshas no equivalent, andscripts/nitro-view/templateships no.gitignoreat all.react-native-image(2026-09-03) andreact-native-native-list(2026-09-14) are the two newest view packages, and they are exactly the two that committed their nitrogen trees. Older view packages have the file because it was copied in by hand at creation..gitignore. All non-Nitro today, so nothing has leaked, but one codegen run away from the same thing.Plus
scripts/nitro/template/android/.gradle/: 10 Gradle lock and checksum binaries (40 KB) that get copied into every module created from that template. The template's own.gitignorehas listed.gradlesince it was written, but these files were already tracked, so the rule never applied.Fix
.gitignore: addnative-modules/*/nitrogen/andnative-views/*/nitrogen/next to the existing bob and CMake rules.scripts/nitro-view/template/.gitignoreand write it out in step 8 ofcreate-nitro-view.js, mirroringcreate-nitro-module.js..gitignoreto the 13 packages that had none:aes-crypto,async-storage,cloud-fs,dns-lookup,network-info,network-throttle,pbkdf2,ping,sni-connect,split-bundle-loader,tcp-socket,native-sheet,text-input.git rm --cached scripts/nitro/template/android/.gradle, and generalize the root entry toscripts/*/template/android/.gradle/so it covers both templates.Verification
git ls-files -i -c --exclude-standardreturns exactly the 117 files #126 deletes and nothing else, so the 13 new.gitignorefiles catch no currently tracked file.node scripts/create-nitro-view.js; the generated package now carries a.gitignoreidentical to the other view packages. Test package deleted.node --check scripts/create-nitro-view.js.Notes
.gitignoreis not in any package's npmfiles, so published tarballs are unchanged. No CHANGELOG entry, which also keeps this clear of #126.🤖 Generated with Claude Code