Codegen fbsource: filter JS files for all cases, then enable codegen_module=True for react-native-github

Summary:
The specific file filtering in the CLI only covers the case where the input is a directory. We should filter when files are provided as well.

Changelog: [Internal]

Reviewed By: hramos

Differential Revision: D24399225

fbshipit-source-id: 186e39c157faf90bdd825ec5c5860017d49e9404
This commit is contained in:
Kevin Gozali
2020-10-19 15:30:05 -07:00
committed by Facebook GitHub Bot
parent 0a28b34dac
commit b05294dd99
@@ -19,6 +19,19 @@ const path = require('path');
const [outfile, ...fileList] = process.argv.slice(2);
function filterJSFile(file) {
return (
/^(Native.+|.+NativeComponent)/.test(path.basename(file)) &&
// NativeUIManager will be deprecated by Fabric UIManager.
// For now, ignore this spec completely because the types are not fully supported.
!file.endsWith('NativeUIManager.js') &&
// NativeSampleTurboModule is for demo purpose. It should be added manually to the
// app for now.
!file.endsWith('NativeSampleTurboModule.js') &&
!file.includes('__tests')
);
}
const allFiles = [];
fileList.forEach(file => {
if (fs.lstatSync(file).isDirectory()) {
@@ -26,19 +39,9 @@ fileList.forEach(file => {
.sync(`${file}/**/*.js`, {
nodir: true,
})
.filter(
f =>
/^(Native.+|.+NativeComponent)/.test(path.basename(f)) &&
// NativeUIManager will be deprecated by Fabric UIManager.
// For now, ignore this spec completely because the types are not fully supported.
!f.endsWith('NativeUIManager.js') &&
// NativeSampleTurboModule is for demo purpose. It should be added manually to the
// app for now.
!f.endsWith('NativeSampleTurboModule.js') &&
!f.includes('__tests'),
);
.filter(filterJSFile);
allFiles.push(...dirFiles);
} else {
} else if (filterJSFile(file)) {
allFiles.push(file);
}
});