🎨 Replace colors module with chalk module

This commit is contained in:
brunosimon
2017-12-26 14:29:00 +01:00
parent 494bd401b9
commit 73bc3e174a
8 changed files with 87 additions and 59 deletions
+12 -11
View File
@@ -5,9 +5,10 @@ const Watcher = require('./watcher.js')
const Projects = require('./projects.js')
const socketIo = require('socket.io')
const util = require('util')
const colors = require('colors')
const fs = require('fs')
const path = require('path')
const chalk = require('chalk')
const gradientString = require('gradient-string')
const packageJson = require('../package.json')
/**
@@ -21,7 +22,7 @@ class App
constructor()
{
console.log()
console.log('---'.rainbow + ' keppler '.bold.white + packageJson.version.bold.white + ' ----------------------'.rainbow)
console.log(`${gradientString.pastel('----------------------')} ${chalk.white.bold('keppler')} ${chalk.white.bold(packageJson.version)} ${gradientString.pastel('----------------------')}`)
console.log()
this.setConfig()
@@ -157,7 +158,7 @@ class App
for(const _configKey in this.config)
{
const _configValue = '' + this.config[_configKey]
console.log('app > config'.green.bold + ' - ' + _configKey.cyan + ' - ' + _configValue.cyan)
console.log(`${chalk.green.bold('app > config')} - ${chalk.cyan(_configKey)} - ${chalk.cyan(_configValue)}`)
}
}
}
@@ -176,8 +177,8 @@ class App
},
() =>
{
console.log('error'.red)
console.log('app'.green.bold + ' - ' + 'keppler seems to be running already'.cyan)
console.log(chalk.red('error'))
console.log(`${chalk.green.bold('app')} - ${chalk.cyan('keppler seems to be running already')}`)
}
)
}
@@ -211,7 +212,7 @@ class App
// Debug
if(this.config.debug >= 1)
{
console.log('app > socket'.green.bold + ' - ' + 'connect'.cyan + ' - ' + socket.id.cyan)
console.log(`${chalk.green.bold('app > socket')} - ${chalk.cyan('connect')} - ${chalk.cyan(socket.id)}`)
}
// Start project
@@ -225,7 +226,7 @@ class App
// Debug
if(this.config.debug >= 1)
{
console.log('app > socket'.green.bold + ' - ' + 'start_project'.cyan + ' - ' + project.slug.cyan)
console.log(`${chalk.green.bold('app > socket')} - ${chalk.cyan('start_project')} - ${chalk.cyan(project.slug)}`)
}
if(this.config.debug >= 2)
{
@@ -244,7 +245,7 @@ class App
// Debug
if(this.config.debug >= 1)
{
console.log('app > socket'.green.bold + ' - ' + 'update_file'.cyan + ' - ' + data.path.cyan)
console.log(`${chalk.green.bold('app > socket')} - ${chalk.cyan('update_file')} - ${chalk.cyan(data.path)}`)
}
if(this.config.debug >= 2)
{
@@ -261,7 +262,7 @@ class App
// Debug
if(this.config.debug >= 1)
{
console.log('app > socket'.green.bold + ' - ' + 'update_file'.cyan + ' - ' + data.path.cyan)
console.log(`${chalk.green.bold('app > socket')} - ${chalk.cyan('create_file')} - ${chalk.cyan(data.path)}`)
}
if(this.config.debug >= 2)
{
@@ -278,7 +279,7 @@ class App
// Debug
if(this.config.debug >= 1)
{
console.log('app > socket'.green.bold + ' - ' + 'update_file'.cyan + ' - ' + data.path.cyan)
console.log(`${chalk.green.bold('app > socket')} - ${chalk.cyan('delete_file')} - ${chalk.cyan(data.path)}`)
}
if(this.config.debug >= 2)
{
@@ -294,7 +295,7 @@ class App
// Debug
if(this.config.debug >= 1)
{
console.log('app > socket'.green.bold + ' - ' + 'disconnect'.cyan + ' - ' + socket.id.cyan)
console.log(`${chalk.green.bold('app > socket')} - ${chalk.cyan('disconnect')} - ${chalk.cyan(socket.id)}`)
}
})
})