forked from EdgeApp/edge-react-gui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpostinstall.js
43 lines (38 loc) · 1.01 KB
/
postinstall.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
// @flow
const fs = require('fs')
const jsonFormat = require('json-format')
const fixModules = [
'eosjs',
'eosjs-ecc',
'edge-currency-monero',
'eosjs-api',
'fcbuffer',
'edge-ripple-lib',
'edge-currency-accountbased/node_modules/edge-ripple-lib'
]
const falseModules = ['https-proxy-agent', 'tls', 'isomorphic-fetch', 'request']
const jsonConfig = {
type: 'space',
size: 2
}
for (const lib of fixModules) {
const path = `./node_modules/${lib}/package.json`
if (fs.existsSync(path)) {
// $FlowFixMe
const packageJson = require(path)
if (!packageJson['react-native']) {
packageJson['react-native'] = {}
}
for (const fm of falseModules) {
packageJson['react-native'][fm] = false
}
if (packageJson.babel) {
packageJson.babel = undefined
}
// console.log(`---------- ${path} --------------`)
const out = jsonFormat(packageJson, jsonConfig)
// console.log(out)
// fs.writeFileSync('./packageJson.txt', out)
fs.writeFileSync(path, out)
}
}