mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
chore: mock os.networkInterfaces
This commit is contained in:
@@ -1,12 +1,6 @@
|
||||
import os from 'os';
|
||||
|
||||
export function getIPS() {
|
||||
// todo: perhaps mock networkInterfaces instead?
|
||||
if (__TEST__) {
|
||||
// in tests we don't need the real ips
|
||||
return ['127.0.0.1', '192.168.0.10'];
|
||||
}
|
||||
|
||||
const interfaces = os.networkInterfaces();
|
||||
return Object.keys(interfaces)
|
||||
.map((name) => {
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
import { merge } from 'webpack-merge';
|
||||
|
||||
import { addVirtualEntry, addVirtualModule } from './virtualModules'
|
||||
import { getPackageJson, getProjectRootPath } from './project';
|
||||
import { addCopyRule, removeCopyRule } from './copyRules';
|
||||
import { determineProjectFlavor } from './flavor';
|
||||
import { error, info, warn } from './log';
|
||||
import { getValue } from './config';
|
||||
import { getIPS } from './host'
|
||||
import {
|
||||
getAllDependencies,
|
||||
hasDependency,
|
||||
getDependencyPath,
|
||||
} from './dependencies';
|
||||
import { getPackageJson, getProjectRootPath } from './project';
|
||||
import {
|
||||
addPlatform,
|
||||
getAbsoluteDistPath,
|
||||
@@ -20,6 +22,7 @@ import {
|
||||
getPlatformName,
|
||||
} from './platform';
|
||||
|
||||
|
||||
// intentionally populated manually
|
||||
// as this generates nicer typings
|
||||
// that show all the utils inline
|
||||
@@ -40,15 +43,14 @@ export default {
|
||||
flavor: {
|
||||
determineProjectFlavor,
|
||||
},
|
||||
host: {
|
||||
getIPS,
|
||||
},
|
||||
log: {
|
||||
error,
|
||||
info,
|
||||
warn,
|
||||
},
|
||||
project: {
|
||||
getProjectRootPath,
|
||||
getPackageJson,
|
||||
},
|
||||
platform: {
|
||||
addPlatform,
|
||||
getAbsoluteDistPath,
|
||||
@@ -58,4 +60,12 @@ export default {
|
||||
getPlatform,
|
||||
getPlatformName,
|
||||
},
|
||||
project: {
|
||||
getProjectRootPath,
|
||||
getPackageJson,
|
||||
},
|
||||
virtualModules: {
|
||||
addVirtualEntry,
|
||||
addVirtualModule
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user