diff --git a/lib/chat.js b/lib/chat.js index 302e302..5387702 100644 --- a/lib/chat.js +++ b/lib/chat.js @@ -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)}`) }) }) } diff --git a/lib/index.js b/lib/index.js index 518502a..3816491 100644 --- a/lib/index.js +++ b/lib/index.js @@ -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() @@ -76,7 +77,10 @@ class App '**/.DS_Store', 'node_modules/**', 'vendor/**', - '.git' + '.git', + '.vscode', + '.env', + '.log' ], type: 'array' }) @@ -154,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)}`) } } } @@ -173,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')}`) } ) } @@ -208,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 @@ -222,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) { @@ -241,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) { @@ -258,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) { @@ -275,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) { @@ -291,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)}`) } }) }) diff --git a/lib/project.js b/lib/project.js index 86f7b47..a739d36 100644 --- a/lib/project.js +++ b/lib/project.js @@ -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 { diff --git a/lib/projects.js b/lib/projects.js index 5fb7301..7de39de 100644 --- a/lib/projects.js +++ b/lib/projects.js @@ -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)}`) } }) } diff --git a/lib/site.js b/lib/site.js index d89a3f4..50b273b 100644 --- a/lib/site.js +++ b/lib/site.js @@ -2,8 +2,8 @@ const express = require('express') const helmet = require('helmet') const http = require('http') -const colors = require('colors') const path = require('path') +const chalk = require('chalk') /** * Site class @@ -53,7 +53,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 +68,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 +86,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 +103,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) => { diff --git a/lib/watcher.js b/lib/watcher.js index 976d0c0..fb610d0 100644 --- a/lib/watcher.js +++ b/lib/watcher.js @@ -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')}`) } }) @@ -67,7 +68,7 @@ class Watcher this.socket.on('started', () => { const url = this.config.domain - console.log('app'.green.bold + ' - ' + url.yellow) + console.log(`${chalk.green.bold('app')} - ${chalk.yellow.underline(url)}`) if(this.config.open) { @@ -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)}`) } }) } diff --git a/package-lock.json b/package-lock.json index 2eecb18..f7f3936 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "keppler", - "version": "1.2.1", + "version": "1.2.2", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -1332,30 +1332,27 @@ } }, "chalk": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.0.1.tgz", - "integrity": "sha512-Mp+FXEI+FrwY/XYV45b2YD3E8i3HwnEAoFcM0qlZzq/RZ9RwWitt2Y/c7cqRAz70U7hfekqx6qNYthuKFO6K0g==", - "dev": true, + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", + "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", "requires": { "ansi-styles": "3.2.0", "escape-string-regexp": "1.0.5", - "supports-color": "4.2.1" + "supports-color": "4.5.0" }, "dependencies": { "ansi-styles": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", - "dev": true, "requires": { "color-convert": "1.9.0" } }, "supports-color": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.2.1.tgz", - "integrity": "sha512-qxzYsob3yv6U+xMzPrv170y8AwGP7i74g+pbixCfD6rgso8BscLT2qXIuz6TpOaiJZ3mFgT5O9lyT9nMU4LfaA==", - "dev": true, + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", + "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", "requires": { "has-flag": "2.0.0" } @@ -1508,7 +1505,6 @@ "version": "1.9.0", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.0.tgz", "integrity": "sha1-Gsz5fdc5uYO/mU1W/sj5WFNkG3o=", - "dev": true, "requires": { "color-name": "1.1.3" } @@ -1516,8 +1512,7 @@ "color-name": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", - "dev": true + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" }, "color-string": { "version": "0.3.0", @@ -1542,7 +1537,8 @@ "colors": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz", - "integrity": "sha1-FopHAXVran9RoSzgyXv6KMCE7WM=" + "integrity": "sha1-FopHAXVran9RoSzgyXv6KMCE7WM=", + "dev": true }, "commander": { "version": "2.11.0", @@ -2442,8 +2438,7 @@ "escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", - "dev": true + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" }, "eslint": { "version": "4.3.0", @@ -3837,6 +3832,15 @@ "version": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=" }, + "gradient-string": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/gradient-string/-/gradient-string-1.0.0.tgz", + "integrity": "sha512-1jCBcPk2I9lmL8YBofayR7XQrrT9FYaihyooDNtcgxnsKVabGJi3N7WDFm2oMODGjQyvy51Vq5TKFB5oaOIY9Q==", + "requires": { + "chalk": "2.3.0", + "tinygradient": "0.3.1" + } + }, "growly": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/growly/-/growly-1.3.0.tgz", @@ -3892,8 +3896,7 @@ "has-flag": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", - "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=", - "dev": true + "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=" }, "hash-base": { "version": "2.0.2", @@ -4203,7 +4206,7 @@ "integrity": "sha512-G6WnRmdTt2jvJvY+aY+M0AO4YlbxE+slKPZb+jG2P2U9Tyxi3h1fYZ/DgiFU6DC6bv3XIEJoZt+f/kNh8BrWFw==", "dev": true, "requires": { - "chalk": "2.0.1", + "chalk": "2.3.0", "source-map": "0.5.6", "supports-color": "4.2.1" } @@ -5905,7 +5908,7 @@ "integrity": "sha512-G6WnRmdTt2jvJvY+aY+M0AO4YlbxE+slKPZb+jG2P2U9Tyxi3h1fYZ/DgiFU6DC6bv3XIEJoZt+f/kNh8BrWFw==", "dev": true, "requires": { - "chalk": "2.0.1", + "chalk": "2.3.0", "source-map": "0.5.6", "supports-color": "4.2.1" } @@ -5937,7 +5940,7 @@ "integrity": "sha512-G6WnRmdTt2jvJvY+aY+M0AO4YlbxE+slKPZb+jG2P2U9Tyxi3h1fYZ/DgiFU6DC6bv3XIEJoZt+f/kNh8BrWFw==", "dev": true, "requires": { - "chalk": "2.0.1", + "chalk": "2.3.0", "source-map": "0.5.6", "supports-color": "4.2.1" } @@ -5969,7 +5972,7 @@ "integrity": "sha512-G6WnRmdTt2jvJvY+aY+M0AO4YlbxE+slKPZb+jG2P2U9Tyxi3h1fYZ/DgiFU6DC6bv3XIEJoZt+f/kNh8BrWFw==", "dev": true, "requires": { - "chalk": "2.0.1", + "chalk": "2.3.0", "source-map": "0.5.6", "supports-color": "4.2.1" } @@ -6001,7 +6004,7 @@ "integrity": "sha512-G6WnRmdTt2jvJvY+aY+M0AO4YlbxE+slKPZb+jG2P2U9Tyxi3h1fYZ/DgiFU6DC6bv3XIEJoZt+f/kNh8BrWFw==", "dev": true, "requires": { - "chalk": "2.0.1", + "chalk": "2.3.0", "source-map": "0.5.6", "supports-color": "4.2.1" } @@ -7303,6 +7306,19 @@ "setimmediate": "1.0.5" } }, + "tinycolor2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.4.1.tgz", + "integrity": "sha1-9PrTM0R7wLB9TcjpIJ2POaisd+g=" + }, + "tinygradient": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/tinygradient/-/tinygradient-0.3.1.tgz", + "integrity": "sha1-LZ5PvjSMSX7RHih6QzaDWz/RECI=", + "requires": { + "tinycolor2": "1.4.1" + } + }, "tmp": { "version": "0.0.31", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.31.tgz", diff --git a/package.json b/package.json index b75b485..c94e313 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,16 @@ { "name": "keppler", - "version": "1.2.1", - "description": "", + "version": "1.2.2", + "description": "Real time code sharing for your lectures and presentations", + "keywords": [ + "keppler", + "teach", + "learn", + "code", + "presentation", + "live-coding", + "share" + ], "bin": { "keppler": "bin/index.js" }, @@ -23,11 +32,12 @@ }, "homepage": "https://github.com/brunosimon/keppler", "dependencies": { + "chalk": "^2.3.0", "chokidar": "^1.7.0", - "colors": "^1.1.2", "diff": "^3.3.0", "express": "^4.15.3", "glob": "^7.1.2", + "gradient-string": "^1.0.0", "helmet": "^3.8.1", "html-entities": "^1.2.1", "ip": "^1.1.5", @@ -50,7 +60,6 @@ "babel-preset-env": "^1.3.2", "babel-preset-stage-2": "^6.22.0", "babel-register": "^6.22.0", - "chalk": "^2.0.1", "connect-history-api-fallback": "^1.3.0", "copy-to-clipboard": "^3.0.8", "copy-webpack-plugin": "^4.0.1", diff --git a/readme.md b/readme.md index 601d216..eb89dce 100644 --- a/readme.md +++ b/readme.md @@ -4,8 +4,6 @@ ## What is keppler -Keppler lets you share your code during a presentation. - Start keppler inside your project folder, share the URL with your audience and start coding. Any time you save a file, viewers will receive those changes. They can browse through the files, go back in history, copy the code, download the project, preview images, chat with other viewers, ask the presenter to slow down, etc. @@ -78,7 +76,7 @@ Arguments list |---|---| |parameter|`--exclude`| |shortcut|`-e`| -|default value|*(string)*`**/.DS_Store,node_modules/**,vendor/**,.git`| +|default value|*(string)*`**/.DS_Store,node_modules/**,vendor/**,.git,.vscode,.env,.log`| |description|List of paths to exclude (comma seperated and wildcards support)| |||