From 2a0293906f306e73ac9cb211b6a21be643469207 Mon Sep 17 00:00:00 2001 From: Sota Ogo Date: Thu, 9 Sep 2021 17:24:24 -0700 Subject: [PATCH] Add an error message when there is no modules to process in codegen Summary: Adding an error message when codegen doesn't recognize any modules to help users understand what's going on. Changelog: [Internal] Reviewed By: RSNara Differential Revision: D30624535 fbshipit-source-id: 781f1f874a5b0c16a05191186b81c2d3892da95b --- .../src/cli/combine/combine-js-to-schema-cli.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/react-native-codegen/src/cli/combine/combine-js-to-schema-cli.js b/packages/react-native-codegen/src/cli/combine/combine-js-to-schema-cli.js index 64449287296335..c01b10f70a34e7 100644 --- a/packages/react-native-codegen/src/cli/combine/combine-js-to-schema-cli.js +++ b/packages/react-native-codegen/src/cli/combine/combine-js-to-schema-cli.js @@ -46,7 +46,16 @@ fileList.forEach(file => { } }); -const formattedSchema = JSON.stringify(combine(allFiles), null, 2); +const combined = combine(allFiles); + +// Warn users if there is no modules to process +if (Object.keys(combined.modules).length === 0) { + console.error( + 'No modules to process in combine-js-to-schema-cli. If this is unexpected, please check if you set up your NativeComponent correctly. See combine-js-to-schema.js for how codegen finds modules.', + ); +} +const formattedSchema = JSON.stringify(combined, null, 2); + if (outfile != null) { fs.writeFileSync(outfile, formattedSchema); } else {