feat: vite preview

This commit is contained in:
vben
2021-01-25 06:21:11 +08:00
parent 2eb2d2a075
commit c1a4600b8a
5 changed files with 66 additions and 405 deletions

View File

@@ -1,9 +1,7 @@
import fs from 'fs';
import path from 'path';
import { networkInterfaces } from 'os';
import dotenv from 'dotenv';
import chalk from 'chalk';
// import execa from 'execa';
export const isFunction = (arg: unknown): arg is (...args: any[]) => any =>
typeof arg === 'function';
@@ -11,25 +9,6 @@ export const isFunction = (arg: unknown): arg is (...args: any[]) => any =>
export const isRegExp = (arg: unknown): arg is RegExp =>
Object.prototype.toString.call(arg) === '[object RegExp]';
/**
* get client ip address
*/
export function getIPAddress() {
let interfaces = networkInterfaces();
for (let devName in interfaces) {
let iFace = interfaces[devName];
if (!iFace) return;
for (let i = 0; i < iFace.length; i++) {
let alias = iFace[i];
if (alias.family === 'IPv4' && alias.address !== '127.0.0.1' && !alias.internal) {
return alias.address;
}
}
}
return '';
}
export function isDevFn(mode: string): boolean {
return mode === 'development';
}