Fix codegen for projects in hidden folders - #55259
Conversation
|
Hi @dinisnunes1! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
|
@cortinico has imported this pull request. If you are a Meta employee, you can view this in D91122133. |
|
This pull request was successfully merged by @dinisnunes1 in a12b442 When will my fix make it into a release? | How to file a pick request? |
|
@cortinico merged this pull request in a12b442. |
Summary: Fixes #55243 Fixes an issue where iOS codegen fails when the React Native project is located inside a hidden folder (a folder starting with `.`, such as `~/.jenkins/workspace/` or `/.buildkite/builds/`). The issue was reported for React Native 0.79.4, but the bug affects all subsequent versions including the current main branch. The `findFilesWithExtension` function was checking if the entire absolute path contained `/.` to skip hidden folders. This caused false positives when the project workspace itself was under a hidden folder, resulting in all files being incorrectly filtered out and codegen producing empty results. The fix changes the check to only look at the current filename being iterated (`file.startsWith('.')`) rather than the full path, while preserving the existing `.pnpm` exception. ## Changelog: [iOS] [Fixed] - Fix codegen failing when project is inside a hidden folder Pull Request resolved: #55259 Test Plan: Added unit tests for `findFilesWithExtension` that verify: - Hidden files/folders are still correctly skipped - The `.pnpm` folder exception still works - Projects under hidden folders (e.g., `/.jenkins/workspace/`) now work correctly Run tests with: ```bash yarn jest packages/react-native/scripts/codegen/__tests__/generate-artifacts-executor-test.js --testNamePattern="findFilesWithExtension" ``` All 3 tests pass. The critical test `works when project is under a hidden folder` fails without the fix (returns empty array) and passes with the fix. ### Example of the codegen failing on a dotted path 🔴 <img width="970" height="609" alt="Screenshot 2026-01-21 at 09 54 21" src="https://github.com/user-attachments/assets/247576c4-ce06-4656-93d7-06e880e779e3" /> - [`pod install` logs on Github Actions](https://github.com/dinisnunes1/.react-native-codegen-dotted-paths/actions/runs/21204831248/job/60998728238) - [example based on the Reproducer repo](dinisnunes1/.react-native-codegen-dotted-paths@main...test-dotted-path-codegen) ### Example of the codegen crawling working on a dotted path - with the fix ✅ <img width="938" height="700" alt="Screenshot 2026-01-21 at 10 15 56" src="https://github.com/user-attachments/assets/f36ef04d-e5ca-454e-907f-9af1fcd0a6d9" /> - [`pod install` logs on Github Actions](https://github.com/dinisnunes1/.react-native-codegen-dotted-paths/actions/runs/21205599303/job/61001213856) - [example based on the Reproducer repo - branch with RN `0.83.1` patched](dinisnunes1/.react-native-codegen-dotted-paths@main...test-codegen-fix) Reviewed By: cipolleschi Differential Revision: D91122133 Pulled By: cortinico fbshipit-source-id: 762564c874d5081521811e3a20d850a89861b99f
|
This pull request was successfully merged by @dinisnunes1 in 4733593 When will my fix make it into a release? | How to file a pick request? |
Summary:
Fixes #55243
Fixes an issue where iOS codegen fails when the React Native project is located inside a hidden folder (a folder starting with
., such as~/.jenkins/workspace/or/.buildkite/builds/).The issue was reported for React Native 0.79.4, but the bug affects all subsequent versions including the current main branch.
The
findFilesWithExtensionfunction was checking if the entire absolute path contained/.to skip hidden folders. This caused false positives when the project workspace itself was under a hidden folder, resulting in all files being incorrectly filtered out and codegen producing empty results.The fix changes the check to only look at the current filename being iterated (
file.startsWith('.')) rather than the full path, while preserving the existing.pnpmexception.Changelog:
[iOS] [Fixed] - Fix codegen failing when project is inside a hidden folder
Test Plan:
Added unit tests for
findFilesWithExtensionthat verify:.pnpmfolder exception still works/.jenkins/workspace/) now work correctlyRun tests with:
yarn jest packages/react-native/scripts/codegen/__tests__/generate-artifacts-executor-test.js --testNamePattern="findFilesWithExtension"All 3 tests pass. The critical test
works when project is under a hidden folderfails without the fix (returns empty array) and passes with the fix.Example of the codegen failing on a dotted path 🔴
pod installlogs on Github ActionsExample of the codegen crawling working on a dotted path - with the fix ✅
pod installlogs on Github Actions0.83.1patched