From 74fda1070266df13e1b58680a670dde3acf9d205 Mon Sep 17 00:00:00 2001 From: Krystof Woldrich Date: Sun, 9 Oct 2022 15:52:41 -0700 Subject: [PATCH] Fix rn config file load codegen (#34895) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: Resolves https://github.com/facebook/react-native/issues/34894 ## Changelog [General][Fixed] - Load react-native.config.js from correct path during codegen Pull Request resolved: https://github.com/facebook/react-native/pull/34895 Test Plan: Command line output after fix with extra console logs to show the correctness ( hopefully :) ) of the fix. ```bash ~/repos/sentry-react-native � � krystofwoldrich/multipleRNsamples ± �node node_modules/react-native/scripts/generate-artifacts.js --path sample-new-architecture --outputPath codegen [Codegen] Processing react-native core libraries [Codegen] Found react-native [Codegen] >>>>> Searching for codegen-enabled libraries in /Users/krystofwoldrich/repos/sentry-react-native/node_modules [Codegen] >>>>> Searching for codegen-enabled libraries in react-native.config.js cwd /Users/krystofwoldrich/repos/sentry-react-native rnConfigFilePath sample-new-architecture/react-native.config.js rnConfigFilePath - resolved /Users/krystofwoldrich/repos/sentry-react-native/sample-new-architecture/react-native.config.js [Codegen] Found sentry/react-native [Codegen] >>>>> Searching for codegen-enabled libraries in the app [Codegen] >>>>> Processing FBReactNativeSpec [Codegen] Generated schema: /var/folders/tl/jddrmdy97gj0cljrcwb_qkzc0000gn/T/FBReactNativeSpecrHeknw/schema.json [Codegen] Generated artifacts: codegen/build/generated/ios [Codegen] >>>>> Processing rncore [Codegen] Generated schema: /var/folders/tl/jddrmdy97gj0cljrcwb_qkzc0000gn/T/rncorehCjmlJ/schema.json [Codegen] Generated artifacts: codegen/build/generated/ios [Codegen] >>>>> Processing RNSentrySpec [Codegen] Generated schema: /var/folders/tl/jddrmdy97gj0cljrcwb_qkzc0000gn/T/RNSentrySpectMmDpf/schema.json [Codegen] Generated artifacts: codegen/build/generated/ios >>>>> Creating component provider Generated schema list: /var/folders/tl/jddrmdy97gj0cljrcwb_qkzc0000gn/T/rn-tmp-schema-list.json Generated provider in: codegen/build/generated/ios [Codegen] Done. ``` Reviewed By: rshest Differential Revision: D40177746 Pulled By: rshest fbshipit-source-id: 970f016db26fda003ee3b47d50e80549fdb88415 --- scripts/codegen/generate-artifacts-executor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/codegen/generate-artifacts-executor.js b/scripts/codegen/generate-artifacts-executor.js index c937dc3c5253e2..d51bceb8c811fe 100644 --- a/scripts/codegen/generate-artifacts-executor.js +++ b/scripts/codegen/generate-artifacts-executor.js @@ -216,7 +216,7 @@ function handleLibrariesFromReactNativeConfig( `\n\n[Codegen] >>>>> Searching for codegen-enabled libraries in ${rnConfigFileName}`, ); - const rnConfigFilePath = path.join(appRootDir, rnConfigFileName); + const rnConfigFilePath = path.resolve(appRootDir, rnConfigFileName); if (fs.existsSync(rnConfigFilePath)) { const rnConfig = require(rnConfigFilePath);