Merge environmentInfo and machineInfo into index.ts (#3319)

This commit is contained in:
Aya Morisawa
2018-11-19 13:39:10 +09:00
committed by GitHub
parent be52779bbc
commit ca0cb6fd42
3 changed files with 28 additions and 38 deletions

View File

@ -1,17 +0,0 @@
import Logger from './logger';
import isRoot = require('is-root');
export default class {
public static show(): void {
const env = process.env.NODE_ENV;
const logger = new Logger('Env');
logger.info(typeof env == 'undefined' ? 'NODE_ENV is not set' : `NODE_ENV: ${env}`);
if (env !== 'production') {
logger.warn('The environment is not in production mode');
logger.warn('Do not use for production purpose');
}
logger.info(`You ${isRoot() ? '' : 'do not '}have root privileges`);
}
}

View File

@ -1,17 +0,0 @@
import * as os from 'os';
import Logger from './logger';
import * as sysUtils from 'systeminformation';
export default class {
public static async show() {
const logger = new Logger('Machine');
logger.info(`Hostname: ${os.hostname()}`);
logger.info(`Platform: ${process.platform}`);
logger.info(`Architecture: ${process.arch}`);
logger.info(`CPU: ${os.cpus().length} core`);
const mem = await sysUtils.mem();
const totalmem = (mem.total / 1024 / 1024 / 1024).toFixed(1);
const availmem = (mem.available / 1024 / 1024 / 1024).toFixed(1);
logger.info(`MEM: ${totalmem}GB (available: ${availmem}GB)`);
}
}