Skip to content

Commit 5558fa1

Browse files
committed

File tree

2 files changed

+52
-14
lines changed

2 files changed

+52
-14
lines changed

.watchmanconfig

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1 @@
1-
{
2-
"ignore_dirs": [
3-
".git",
4-
"node_modules",
5-
".gradle",
6-
".idea",
7-
"gradle",
8-
"build",
9-
"example",
10-
"android/.gradle",
11-
"android/gradle",
12-
"android/app/build"
13-
]
14-
}
1+
{}

example/rn-cli.config.js

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/**
2+
* @noflow
3+
*/
4+
5+
const fs = require('fs');
6+
const path = require('path');
7+
const blacklist = require('metro/src/blacklist');
8+
9+
module.exports = {
10+
getBlacklistRE() {
11+
return blacklist([
12+
/react\-native\-custom\-tabs\/node_modules\/react-native\/(.*)/,
13+
/react\-native\-custom\-tabs\/node_modules\/react\/(.*)/,
14+
]);
15+
},
16+
extraNodeModules: getNodeModulesForDirectory(path.resolve('.')),
17+
};
18+
19+
function getNodeModulesForDirectory(rootPath) {
20+
const nodeModulePath = path.join(rootPath, 'node_modules');
21+
const folders = fs.readdirSync(nodeModulePath);
22+
return folders.reduce((modules, folderName) => {
23+
const folderPath = path.join(nodeModulePath, folderName);
24+
if (folderName.startsWith('@')) {
25+
const scopedModuleFolders = fs.readdirSync(folderPath);
26+
const scopedModules = scopedModuleFolders.reduce(
27+
(scopedModules, scopedFolderName) => {
28+
scopedModules[
29+
`${folderName}/${scopedFolderName}`
30+
] = maybeResolveSymlink(path.join(folderPath, scopedFolderName));
31+
return scopedModules;
32+
},
33+
{}
34+
);
35+
return Object.assign({}, modules, scopedModules);
36+
}
37+
modules[folderName] = maybeResolveSymlink(folderPath);
38+
return modules;
39+
}, {});
40+
}
41+
42+
function maybeResolveSymlink(maybeSymlinkPath) {
43+
if (fs.lstatSync(maybeSymlinkPath).isSymbolicLink()) {
44+
const resolved = path.resolve(
45+
path.dirname(maybeSymlinkPath),
46+
fs.readlinkSync(maybeSymlinkPath)
47+
);
48+
return resolved;
49+
}
50+
return maybeSymlinkPath;
51+
}

0 commit comments

Comments
 (0)