🎨 Replace colors module with chalk module
This commit is contained in:
+7
-6
@@ -1,5 +1,6 @@
|
||||
const ids = require('./ids.js')
|
||||
const robotNames = require('./assets/data/robot-names.json')
|
||||
const chalk = require('chalk')
|
||||
const HTMLEntities = require('html-entities')
|
||||
|
||||
class Chat
|
||||
@@ -38,8 +39,8 @@ class Chat
|
||||
// Debug
|
||||
if(this.config.debug >= 1)
|
||||
{
|
||||
console.log('chat > socket'.green.bold + ' - ' + 'connection'.cyan + ' - ' + socket.id.cyan)
|
||||
console.log('chat > user'.green.bold + ' - ' + 'create'.cyan + ' - ' + user.name.cyan)
|
||||
console.log(`${chalk.green.bold('chat > socket')} - ${chalk.cyan('connection')} - ${chalk.cyan(socket.id)}`)
|
||||
console.log(`${chalk.green.bold('chat > user')} - ${chalk.cyan('create')} - ${chalk.cyan(user.name)}`)
|
||||
}
|
||||
|
||||
// Send user infos
|
||||
@@ -71,7 +72,7 @@ class Chat
|
||||
// Debug
|
||||
if(this.config.debug >= 1)
|
||||
{
|
||||
console.log('chat > socket'.green.bold + ' - ' + 'message'.cyan + ' - ' + user.name.cyan + ' - ' + data.text.cyan)
|
||||
console.log(`${chalk.green.bold('chat > socket')} - ${chalk.cyan('message')} - ${chalk.cyan(user.name)} - ${chalk.cyan(data.text)}`)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -93,7 +94,7 @@ class Chat
|
||||
// Debug
|
||||
if(this.config.debug >= 1)
|
||||
{
|
||||
console.log('chat > socket'.green.bold + ' - ' + 'update_user'.cyan + ' - ' + (oldName + ' > ' + user.name).cyan)
|
||||
console.log(`${chalk.green.bold('chat > socket')} - ${chalk.cyan('update_user')} - ${chalk.cyan(oldName + ' > ' + user.name)}`)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -106,14 +107,14 @@ class Chat
|
||||
// Debug
|
||||
if(this.config.debug >= 1)
|
||||
{
|
||||
console.log('chat > socket'.green.bold + ' - ' + 'alert'.cyan + ' - ' + user.name.cyan)
|
||||
console.log(`${chalk.green.bold('chat > socket')} - ${chalk.cyan('alert')} - ${chalk.cyan(user.name)}`)
|
||||
}
|
||||
})
|
||||
|
||||
// On disconnect
|
||||
socket.on('disconnect', () =>
|
||||
{
|
||||
console.log('chat > socket'.green.bold + ' - ' + 'disconnect'.cyan + ' - ' + user.name.cyan)
|
||||
console.log(`${chalk.green.bold('chat > socket')} - ${chalk.cyan('disconnect')} - ${chalk.cyan(user.name)}`)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
+12
-11
@@ -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)}`)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
+5
-4
@@ -6,6 +6,7 @@ const JSZip = require('jszip')
|
||||
const glob = require('glob')
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const chalk = require('chalk')
|
||||
|
||||
class Project
|
||||
{
|
||||
@@ -50,7 +51,7 @@ class Project
|
||||
// Debug
|
||||
if(this.config.debug >= 1)
|
||||
{
|
||||
console.log('project > socket'.green.bold + ' - ' + 'connection'.cyan + ' - ' + socket.id.cyan)
|
||||
console.log(`${chalk.green.bold('project > socket')} - ${chalk.cyan('connection')} - ${chalk.cyan(socket.id)}`)
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -63,7 +64,7 @@ class Project
|
||||
// Debug
|
||||
if(this.config.debug >= 1)
|
||||
{
|
||||
console.log('project > zip'.green.bold + ' - ' + 'from cache'.cyan)
|
||||
console.log(`${chalk.green.bold('project > zip')} - ${chalk.cyan('from cache')}`)
|
||||
}
|
||||
|
||||
return this.zipBuffer
|
||||
@@ -96,7 +97,7 @@ class Project
|
||||
// Debug
|
||||
if(this.config.debug >= 1)
|
||||
{
|
||||
console.log('project > zip'.green.bold + ' - ' + 'create'.cyan)
|
||||
console.log(`${chalk.green.bold('project > zip')} - ${chalk.cyan('create')}`)
|
||||
}
|
||||
|
||||
return this.zipBuffer
|
||||
@@ -106,7 +107,7 @@ class Project
|
||||
*/
|
||||
addTestContents()
|
||||
{
|
||||
console.log('project'.green.bold + ' - ' + 'add test contents'.cyan)
|
||||
console.log(`${chalk.green.bold('project')} - ${chalk.cyan('add test content')}`)
|
||||
|
||||
// Add some with true contents
|
||||
this.files.createVersion('./test/file.css', `body {
|
||||
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
const Project = require('./project.js')
|
||||
const chalk = require('chalk')
|
||||
|
||||
class Projects
|
||||
{
|
||||
@@ -26,7 +27,7 @@ class Projects
|
||||
|
||||
if(this.config.debug >= 1)
|
||||
{
|
||||
console.log('projects > socket'.green.bold + ' - ' + 'connection'.cyan + ' - ' + socket.id.cyan)
|
||||
console.log(`${chalk.green.bold('projects > socket')} - ${chalk.cyan('connection')} - ${chalk.cyan(socket.id)}`)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
+4
-5
@@ -4,6 +4,7 @@ const helmet = require('helmet')
|
||||
const http = require('http')
|
||||
const colors = require('colors')
|
||||
const path = require('path')
|
||||
const chalk = require('chalk')
|
||||
|
||||
/**
|
||||
* Site class
|
||||
@@ -53,7 +54,7 @@ class Site
|
||||
{
|
||||
if(this.config.debug >= 1)
|
||||
{
|
||||
console.log('site'.green.bold + ' - ' + 'already running'.cyan)
|
||||
console.log(`${chalk.green.bold('site')} - ${chalk.cyan('already running')}`)
|
||||
}
|
||||
|
||||
// Callback
|
||||
@@ -68,7 +69,7 @@ class Site
|
||||
{
|
||||
if(this.config.debug >= 1)
|
||||
{
|
||||
console.log('site'.green.bold + ' - ' + 'unknow error'.cyan)
|
||||
console.log(`${chalk.green.bold('site')} - ${chalk.cyan('unknown error')}`)
|
||||
console.log(error)
|
||||
}
|
||||
|
||||
@@ -86,7 +87,7 @@ class Site
|
||||
// URL
|
||||
if(this.config.debug >= 1)
|
||||
{
|
||||
console.log('site'.green.bold + ' - ' + 'started'.cyan)
|
||||
console.log(`${chalk.green.bold('site')} - ${chalk.cyan('started')}`)
|
||||
}
|
||||
|
||||
if(typeof this.success === 'function')
|
||||
@@ -103,8 +104,6 @@ class Site
|
||||
{
|
||||
this.express.use('/', express.static(path.join(__dirname, '../site/dist')))
|
||||
|
||||
console.log('/' + _project.slug + '/download')
|
||||
|
||||
// Project download route
|
||||
this.express.get('/' + _project.slug + '/download', (request, response) =>
|
||||
{
|
||||
|
||||
+9
-8
@@ -6,6 +6,7 @@ const socketIoClient = require('socket.io-client')
|
||||
const opener = require('opener')
|
||||
const nodeNotifier = require('node-notifier')
|
||||
const path = require('path')
|
||||
const chalk = require('chalk')
|
||||
|
||||
/**
|
||||
* Watcher class
|
||||
@@ -49,7 +50,7 @@ class Watcher
|
||||
// Debug
|
||||
if(this.config.debug)
|
||||
{
|
||||
console.log('watcher > socket'.green.bold + ' - ' + 'connect'.cyan)
|
||||
console.log(`${chalk.green.bold('watcher > socket')} - ${chalk.cyan('connect')}`)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -59,7 +60,7 @@ class Watcher
|
||||
// Debug
|
||||
if(this.config.debug)
|
||||
{
|
||||
console.log('watcher > socket'.green.bold + ' - ' + 'disconnect'.cyan)
|
||||
console.log(`${chalk.green.bold('watcher > socket')} - ${chalk.cyan('disconnect')}`)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -127,7 +128,7 @@ class Watcher
|
||||
|
||||
if(this.config.debug >= 1)
|
||||
{
|
||||
console.log('watcher'.green.bold + ' - ' + 'start watching'.cyan + ' - ' + this.path.cyan)
|
||||
console.log(`${chalk.green.bold('watcher')} - ${chalk.cyan('start watching')} - ${chalk.cyan(this.path)}`)
|
||||
}
|
||||
|
||||
// Add event
|
||||
@@ -172,7 +173,7 @@ class Watcher
|
||||
// Debug
|
||||
if(this.config.debug >= 1)
|
||||
{
|
||||
console.log('watcher'.green.bold + ' - ' + 'add'.cyan + ' - ' + relativePath.cyan)
|
||||
console.log(`${chalk.green.bold('watcher')} - ${chalk.cyan('add')} - ${chalk.cyan(relativePath)}`)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -218,7 +219,7 @@ class Watcher
|
||||
// Debug
|
||||
if(this.config.debug >= 1)
|
||||
{
|
||||
console.log('watcher'.green.bold + ' - ' + 'change'.cyan + ' - ' + relativePath.cyan)
|
||||
console.log(`${chalk.green.bold('watcher')} - ${chalk.cyan('change')} - ${chalk.cyan(relativePath)}`)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -234,7 +235,7 @@ class Watcher
|
||||
// Debug
|
||||
if(this.config.debug >= 1)
|
||||
{
|
||||
console.log('watcher'.green.bold + ' - ' + 'unlink'.cyan + ' - ' + relativePath.cyan)
|
||||
console.log(`${chalk.green.bold('watcher')} - ${chalk.cyan('unlink')} - ${chalk.cyan(relativePath)}`)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -250,7 +251,7 @@ class Watcher
|
||||
// Debug
|
||||
if(this.config.debug >= 1)
|
||||
{
|
||||
console.log('watcher'.green.bold + ' - ' + 'addDir'.cyan + ' - ' + relativePath.cyan)
|
||||
console.log(`${chalk.green.bold('watcher')} - ${chalk.cyan('addDir')} - ${chalk.cyan(relativePath)}`)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -266,7 +267,7 @@ class Watcher
|
||||
// Debug
|
||||
if(this.config.debug >= 1)
|
||||
{
|
||||
console.log('watcher'.green.bold + ' - ' + 'unlinkDir'.cyan + ' - ' + relativePath.cyan)
|
||||
console.log(`${chalk.green.bold('watcher')} - ${chalk.cyan('unlinkDir')} - ${chalk.cyan(relativePath)}`)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user