mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
chore: improve codegen error when native project not found (#53726)
Summary: While working on a somewhat non-standard library setup I ran into: `[Codegen] TypeError [ERR_INVALID_ARG_TYPE]: The "from" argument must be of type string. Received undefined` which was caused by `xcodeproj` file not found. The issue was on the project side rather than codegen, but the error message was rather unhelpful, so this improves it. ## Changelog: [General][Changed] - improve codegen error when ios native project not found Pull Request resolved: https://github.com/facebook/react-native/pull/53726 Test Plan: tested locally, received the improved error message: `[Codegen] Error: Cannot find .xcodeproj file inside /Users/some_project. This is required to determine codegen spec paths relative to native project.` Reviewed By: cortinico Differential Revision: D82226931 Pulled By: cipolleschi fbshipit-source-id: dd851205655048fc35ed9f5266cefdbfb067d211
This commit is contained in:
committed by
Facebook GitHub Bot
parent
c4d2ac6401
commit
bc3503452f
Vendored
+5
@@ -59,6 +59,11 @@ function getInputFiles(appPath /*: string */, appPkgJson /*: $FlowFixMe */) {
|
||||
!projectPath.includes('/Pods/') && // exclude Pods/Pods.xcodeproj
|
||||
!projectPath.includes('/node_modules/'), // exclude all the xcodeproj in node_modules of libraries
|
||||
)[0];
|
||||
if (!xcodeproj) {
|
||||
throw new Error(
|
||||
`Cannot find .xcodeproj file inside ${appPath}. This is required to determine codegen spec paths relative to native project.`,
|
||||
);
|
||||
}
|
||||
const jsFiles = '-name "Native*.js" -or -name "*NativeComponent.js"';
|
||||
const tsFiles = '-name "Native*.ts" -or -name "*NativeComponent.ts"';
|
||||
const findCommand = `find ${path.join(appPath, jsSrcsDir)} -type f -not -path "*/__mocks__/*" -and \\( ${jsFiles} -or ${tsFiles} \\)`;
|
||||
|
||||
Reference in New Issue
Block a user