Skip to content
Snippets Groups Projects
Commit 2765a3c2 authored by Aya Morisawa's avatar Aya Morisawa
Browse files

Extract EnvironmentInfo

parent eb10c3a8
No related branches found
No related tags found
No related merge requests found
......@@ -17,6 +17,7 @@ const isRoot = require('is-root');
import ProgressBar from './utils/cli/progressbar';
import initdb from './db/mongodb';
import LastCommitInfo from './utils/lastCommitInfo';
import EnvironmentInfo from './utils/environmentInfo';
import MachineInfo from './utils/machineInfo';
import DependencyInfo from './utils/dependencyInfo';
......@@ -24,10 +25,6 @@ import DependencyInfo from './utils/dependencyInfo';
require('babel-core/register');
require('babel-polyfill');
const env = process.env.NODE_ENV;
const IS_PRODUCTION = env === 'production';
const IS_DEBUG = !IS_PRODUCTION;
global.config = require('./config').default(`${__dirname}/../.config/config.yml`);
/**
......@@ -138,14 +135,7 @@ async function init(): Promise<State> {
Logger.info('Initializing...');
await LastCommitInfo.show();
let envLogger = new Logger('Env');
envLogger.info(typeof env == 'undefined' ? 'NODE_ENV is not set' : `NODE_ENV: ${env}`);
if (IS_DEBUG) {
envLogger.warn('The environment is not in production mode');
envLogger.warn('Do not use for production purpose');
}
EnvironmentInfo.show();
MachineInfo.show();
new DependencyInfo().showAll();
......
import Logger from './logger';
export default class EnvironmentInfo {
static show(): void {
const env = process.env.NODE_ENV;
let 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');
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment