Skip to content

Commit

Permalink
Add an error message when there is no modules to process in codegen
Browse files Browse the repository at this point in the history
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
  • Loading branch information
sota000 authored and facebook-github-bot committed Sep 10, 2021
1 parent d40cb0e commit 2a02939
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 2a02939

Please sign in to comment.