-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathfix-build.js
executable file
·64 lines (62 loc) · 1.45 KB
/
fix-build.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
#!/usr/bin/env node
const cp = require("child_process");
const fs = require("fs");
const Path = require("path");
const glob = require("glob");
//Build glog
const cwd = process.cwd();
const glogpath = Path.join(
cwd,
"node_modules",
"react-native",
"third-party",
"glog-0.3.4"
);
if (!fs.existsSync(glogpath)) {
console.log(
"This can only fix after you have compiled at least once. Try react-native run-ios or the like, let it fail, then run this command again."
);
process.exit();
}
process.chdir(glogpath);
cp.execSync(
Path.join(
cwd,
"node_modules",
"react-native",
"scripts",
"ios-configure-glog.sh"
),
{ stdio: "inherit" }
);
const wspath = Path.join(
cwd,
"node_modules",
"react-native",
"Libraries",
"Websocket"
);
const g = Path.join(
process.env["HOME"],
"Library",
"Developer",
"Xcode",
"DerivedData",
Path.basename(cwd) + "*",
"**",
"libfishhook.a"
);
const g2 = Path.join(cwd, "ios", "build", "**", "libfishhook.a");
//Now that's done, let's go get the websocket
const results = glob.sync(g);
const backupResults = glob.sync(g2);
if (results.length > 0) {
fs.copyFileSync(results[0], Path.join(wspath, "libfishhook.a"));
} else if (backupResults.length > 0) {
fs.copyFileSync(backupResults[0], Path.join(wspath, "libfishhook.a"));
} else {
console.log(
"You probably have to build your project again before this will work. \nMissing fishhook file in deriveddata"
);
process.exit();
}