-
Notifications
You must be signed in to change notification settings - Fork 4
/
rn-cli.config.js
73 lines (69 loc) · 2.8 KB
/
rn-cli.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//var fs = require("fs");
/*let lstat_old = fs.lstatSync;
fs.lstat = function() {
//if ([].slice(arguments).find(a=>a.includes("Main\\android\\"))) {
if ([].slice(arguments).find(a=>a.includes("google-services"))) {
console.log("Hey2!" + file);
}
return lstat_old.apply(this, arguments);
}
let lstatSync_old = fs.lstatSync;
fs.lstatSync = function() {
//if ([].slice(arguments).find(a=>a.includes("Main\\android\\"))) {
if ([].slice(arguments).find(a=>a.includes("google-services"))) {
console.log("Hey3!" + file);
}
return lstatSync_old.apply(this, arguments);
}*/
/*let oldFSFuncs = {};
for (let key in fs) {
let oldFunc = fs[key];
if (typeof oldFunc == "function") {
oldFSFuncs[key] = oldFunc;
fs[key] = function() {
//if ([].slice(arguments).find(a=>a.includes("Main\\android\\"))) {
let badPath = [].slice(arguments).find(a=>a.includes("google-services"));
if (badPath) {
console.log("Hey4!" + badPath);
}
return oldFunc.apply(this, arguments);
};
fs[key].length = oldFunc.length;
}
}*/
// So apparently the packager can cause two types of file-access errors to occur during gradle syncing and building:
// 1) "EPERM: operation not permitted, lstat"
// 2) "java.io.IOException: Could not delete path"
// The first is caused by the built-in watchman node-module. You can solve it by installing the watchman executable, as described in Troubleshooting.md.
// The second is caused by the packager module. It is solved by the code below, which blacklists the "android" folders from packager processing.
var path = require("path");
let blacklist = require("metro-bundler/src/blacklist");
let config = {
getProjectRoots() {
return [path.resolve()];
// add "<project folder>/Build" as a root (so it can find "Build/index.android.js" consistently...)
//return [path.resolve(), path.resolve("Build")];
//return [path.resolve().replace(/\\/g, "/"), path.resolve("Build").replace(/\\/g, "/")];
//return [path.resolve("C:/Root/Apps/@V/LucidLink/Main"), path.resolve("C:/Root/Apps/@V/LucidLink/Main/Build")]
//return [path.resolve("node_modules"), path.resolve("Build")] // this was code when second-fix apparently worked
//return [path.resolve("C:/Root/Apps/@V/LucidLink/Main/node_modules"), path.resolve("C:/Root/Apps/@V/LucidLink/Main/Build")]
//return [path.resolve("../../../node_modules"), path.resolve("../../../Build")]
},
getBlacklistRE() {
console.log("Getting blacklist... @path:" + path.resolve());
return blacklist([
// Ignore IntelliJ directories
// /.*\.idea\/.*#/,
// ignore git directories
// /.*\.git\/.*#/,
// Ignore android directories
// /.*\/app\/build\/.*#/,
// /.*\/app\/build\/.*#/,
/.*\/android\/.*/,
// /.*\/node_modules\/.*#/, // apparently, this is needed
// /.*\/build\/.*#/,
// /react-native-chart\/dist.*#/,
]);
},
};
module.exports = config;