Reorganize monorepo structure

* Move all config files to './configs'
* Simplify './scripts' folder.
This commit is contained in:
Nicolas Gallagher
2022-06-30 23:17:16 -07:00
parent d31a8a1ec1
commit f81095442f
140 changed files with 110 additions and 98 deletions
@@ -0,0 +1,24 @@
/**
* Creates a map of exported modules, allowing the RNW babel plugin to rewrite
* paths only for modules it knows are exported by RNW.
*/
const fs = require('fs');
const path = require('path');
const isDirectory = (source) => fs.lstatSync(source).isDirectory();
const getDirectories = (source) =>
fs.readdirSync(source).filter((name) => isDirectory(path.join(source, name)));
const packagesDir = path.join(__dirname, '../packages/');
const exportsDir = path.join(packagesDir, 'react-native-web/src/exports');
const moduleMapOutfile = path.join(packagesDir, 'babel-plugin-react-native-web/src/moduleMap.js');
const moduleMap = getDirectories(exportsDir).reduce((acc, curr) => {
acc[curr] = true;
return acc;
}, {});
const data = `// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
module.exports = ${JSON.stringify(moduleMap, null, 2)}`;
fs.writeFileSync(moduleMapOutfile, data);