const chalk = require('chalk');
const _ = require('lodash');
const glob = require('glob');
const env = require('dotenv').config({ silent: true });

const package = require('../../package.json');
const colorMap = {
    development: 'bgGreen',
    production: 'bgBlue'
};
const appList = [
    'module',
    'component',
    'pipe',
    'directive',
    'routes',
    'spec'
];
const mainColor = 'white';
const defaultColor = 'bgMagenta';
const appEnv = process.env.APP_ENV || 'development';
const nodeEnvColor = colorMap[process.env.NODE_ENV] || defaultColor;
const appEnvColor = colorMap[appEnv] || defaultColor;

console.log(chalk[mainColor].bold('Angular Webpack Starter ') + chalk[defaultColor].bold('%s'), package.version);
console.log(chalk.underline.bold('Environments:'));

if (!env) {
    console.log('- No ' + chalk.inverse('.env') + ' file is detected. You can create one from ' + chalk.inverse('.env.example'));
} else {
    console.log('- Loaded ' + chalk[mainColor].bold('%s') + ' values from ' + chalk.inverse('.env') + ' file', _.toArray(env).length);
}

console.log(chalk[mainColor]('- NODE_ENV: ') + chalk[nodeEnvColor]('%s'), process.env.NODE_ENV);
console.log(chalk[mainColor]('- APP_ENV: ') + chalk[appEnvColor]('%s'), appEnv);

console.log(chalk.underline.bold('\nDependencies:'));
console.log(chalk[mainColor]('- Main Dependencies: ') + chalk.bgGreen('%s'), _.toArray(package.dependencies).length);
console.log(chalk[mainColor]('- Dev Dependencies: ') + chalk.bgGreen('%s'), _.toArray(package.devDependencies).length);

console.log(chalk.underline.bold('\nApplication:'));
appList.forEach(function(type) {
    const files = glob.sync('src/app/**/*.' + type +'.ts');
    console.log(chalk[mainColor]('- %s: ') + chalk.bgGreen('%s'), type, files.length);
});
const files = glob.sync('e2e/**/*.spec.ts');
console.log(chalk[mainColor]('- %s: ') + chalk.bgGreen('%s'), 'e2e spec', files.length);
@@ -697,18 +697,20 @@
 %5D.bold('
+ 
 %25s
+ 
 '), pack
@@ -821,36 +821,38 @@
  chalk.inverse('
+ 
 .env
+ 
 ') + ' file is d
@@ -982,18 +982,20 @@
 %5D.bold('
+ 
 %25s
+ 
 ') + ' v
@@ -1024,20 +1024,22 @@
 nverse('
+ 
 .env
+ 
 ') + ' f
@@ -1135,26 +1135,28 @@
 eEnvColor%5D('
+ 
 %25s
+ 
 '), process.
@@ -1236,18 +1236,20 @@
 Color%5D('
+ 
 %25s
+ 
 '), appE
@@ -1371,34 +1371,36 @@
  chalk.bgGreen('
+ 
 %25s
+ 
 '), _.toArray(pa
@@ -1494,26 +1494,28 @@
 lk.bgGreen('
+ 
 %25s
+ 
 '), _.toArra
@@ -1753,26 +1753,28 @@
 lk.bgGreen('
+ 
 %25s
+ 
 '), type, fi
@@ -1891,18 +1891,20 @@
 gGreen('
+ 
 %25s
+ 
 '), 'e2e

fix spaces