Changeset View
Changeset View
Standalone View
Standalone View
native/utils/dev-hostname.js
Show All 16 Lines | function readHostnameFromNetworkJson(): string { | ||||
try { | try { | ||||
// this is your machine's hostname in the local network | // this is your machine's hostname in the local network | ||||
// usually it looks like this: 192.168.1.x | // usually it looks like this: 192.168.1.x | ||||
// to find it you may want to use `ifconfig | grep '192.168'` | // to find it you may want to use `ifconfig | grep '192.168'` | ||||
// command in the terminal | // command in the terminal | ||||
// example of native/facts/network.json: | // example of native/facts/network.json: | ||||
// { "natDevHostname": "192.168.1.x" } | // { "natDevHostname": "192.168.1.x" } | ||||
// $FlowExpectedError: It's a conditional require so the file may not exist | // $FlowExpectedError: It's a conditional require so the file may not exist | ||||
const hostname: string = require('../facts/network').natDevHostname; | const hostname: string = require('../facts/network.json').natDevHostname; | ||||
ashoat: This was missed in D6692 because it is a `require` statement, not an `import` | |||||
warnNatDevHostnameUndefined = false; | warnNatDevHostnameUndefined = false; | ||||
return hostname; | return hostname; | ||||
} catch (e) { | } catch (e) { | ||||
return defaultNatDevHostname; | return defaultNatDevHostname; | ||||
} | } | ||||
} | } | ||||
const natDevHostname: string = | const natDevHostname: string = | ||||
Show All 14 Lines |
This was missed in D6692 because it is a require statement, not an import