Skip to content

Commit

Permalink
Animated terminal output with chalk-animation
Browse files Browse the repository at this point in the history
  • Loading branch information
yTakkar committed Aug 16, 2017
1 parent 82c37f0 commit cfb32e1
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 10 deletions.
9 changes: 5 additions & 4 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ const
favicon = require('serve-favicon'),
bodyParser = require('body-parser'),
validator = require('express-validator'),
session = require('client-sessions'),
session = require('client-sessions'),
app = express()

// Requiring route files
// Requiring project files
const
uRoutes = require('./routes/user-routes'),
apiRoutes = require('./routes/rest-routes'),
Expand All @@ -22,7 +22,8 @@ const
noteRoutes = require('./routes/note_routes'),
nIntRoutes = require('./routes/note-int-routes'),
editRoutes = require('./routes/edit-routes'),
mw = require('./models/middlewares')
mw = require('./models/middlewares'),
chalk = require('./models/chalk')

// View engine
app.engine('hbs', hbs({ extname: "hbs" }))
Expand Down Expand Up @@ -54,4 +55,4 @@ app.use('/api', nIntRoutes)
app.use('/api', editRoutes)
app.use('/', mRoutes)

app.listen(port, () => console.log('App running..') )
app.listen(port, () => chalk.rainbow('App running..') )
16 changes: 11 additions & 5 deletions models/chalk.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
const chalk = require('chalk')
const
chalk = require('chalk'),
an = require('chalk-animation')

const error = chalk.bgRed.bold
const success = chalk.blue.bold

const s = mssg => console.log(success(mssg))

const e = mssg => console.log(error(mssg))

const rainbow = mssg => setTimeout(() => an.rainbow(mssg).start(), 100 )
const radar = mssg => setTimeout(() => an.radar(mssg).start(), 100 )

module.exports = {
error,
error,
success,
s,
e
}
e,
rainbow,
radar
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"bluebird": "^3.5.0",
"body-parser": "^1.17.2",
"chalk": "^1.1.3",
"chalk-animation": "^1.1.1",
"client-sessions": "^0.8.0",
"concurrently": "^3.5.0",
"dotenv": "^4.0.0",
Expand Down
60 changes: 59 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ ansi-styles@^2.2.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe"

ansi-styles@^3.1.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.0.tgz#c159b8d5be0f9e5a6f346dab94f16ce022161b88"
dependencies:
color-convert "^1.9.0"

append-field@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/append-field/-/append-field-0.1.0.tgz#6ddc58fa083c7bc545d3c5995b2830cc2366d44a"
Expand Down Expand Up @@ -943,6 +949,13 @@ center-align@^0.1.1:
align-text "^0.1.3"
lazy-cache "^1.0.3"

chalk-animation@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/chalk-animation/-/chalk-animation-1.1.1.tgz#aedcb5e7c0b766d8b3931d0e06c630fb73a278ef"
dependencies:
chalk "^2.1.0"
gradient-string "^0.1.2"

chalk@0.5.1:
version "0.5.1"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-0.5.1.tgz#663b3a648b68b55d04690d49167aa837858f2174"
Expand All @@ -963,6 +976,14 @@ chalk@^1.1.0, chalk@^1.1.3:
strip-ansi "^3.0.0"
supports-color "^2.0.0"

chalk@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.1.0.tgz#ac5becf14fa21b99c6c92ca7a7d7cfd5b17e743e"
dependencies:
ansi-styles "^3.1.0"
escape-string-regexp "^1.0.5"
supports-color "^4.0.0"

client-sessions@^0.8.0:
version "0.8.0"
resolved "https://registry.yarnpkg.com/client-sessions/-/client-sessions-0.8.0.tgz#a7d8c5558ad5d56f2a199f3533eb654b5df893fd"
Expand All @@ -977,6 +998,16 @@ cliui@^2.1.0:
right-align "^0.1.1"
wordwrap "0.0.2"

color-convert@^1.9.0:
version "1.9.0"
resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.0.tgz#1accf97dd739b983bf994d56fec8f95853641b7a"
dependencies:
color-name "^1.1.1"

color-name@^1.1.1:
version "1.1.3"
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25"

commander@2.6.0:
version "2.6.0"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.6.0.tgz#9df7e52fb2a0cb0fb89058ee80c3104225f37e1d"
Expand Down Expand Up @@ -1182,7 +1213,7 @@ escape-html@~1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988"

escape-string-regexp@^1.0.0, escape-string-regexp@^1.0.2:
escape-string-regexp@^1.0.0, escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"

Expand Down Expand Up @@ -1338,6 +1369,13 @@ graceful-fs@^4.1.2:
version "4.1.11"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658"

gradient-string@^0.1.2:
version "0.1.2"
resolved "https://registry.yarnpkg.com/gradient-string/-/gradient-string-0.1.2.tgz#178bc6e0356f14d0adac9940c3040ab81a7783b3"
dependencies:
chalk "^2.1.0"
tinygradient "^0.3.1"

handlebars@^4.0.5:
version "4.0.10"
resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.0.10.tgz#3d30c718b09a3d96f23ea4cc1f403c4d3ba9ff4f"
Expand Down Expand Up @@ -1392,6 +1430,10 @@ has-flag@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-1.0.0.tgz#9d9e793165ce017a00f00418c43f942a7b1d11fa"

has-flag@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-2.0.0.tgz#e8207af1cc7b30d446cc70b734b5e8be18f88d51"

history@^4.5.1, history@^4.6.0:
version "4.6.3"
resolved "https://registry.yarnpkg.com/history/-/history-4.6.3.tgz#6d723a8712c581d6bef37e8c26f4aedc6eb86967"
Expand Down Expand Up @@ -2178,10 +2220,26 @@ supports-color@^3.2.3:
dependencies:
has-flag "^1.0.0"

supports-color@^4.0.0:
version "4.2.1"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.2.1.tgz#65a4bb2631e90e02420dba5554c375a4754bb836"
dependencies:
has-flag "^2.0.0"

symbol-observable@^1.0.3:
version "1.0.4"
resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.0.4.tgz#29bf615d4aa7121bdd898b22d4b3f9bc4e2aa03d"

tinycolor2@^1.0.0:
version "1.4.1"
resolved "https://registry.yarnpkg.com/tinycolor2/-/tinycolor2-1.4.1.tgz#f4fad333447bc0b07d4dc8e9209d8f39a8ac77e8"

tinygradient@^0.3.1:
version "0.3.1"
resolved "https://registry.yarnpkg.com/tinygradient/-/tinygradient-0.3.1.tgz#2d9e4fbe348c497ed11e287a4336835b3fd11022"
dependencies:
tinycolor2 "^1.0.0"

to-camel-case@1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/to-camel-case/-/to-camel-case-1.0.0.tgz#1a56054b2f9d696298ce66a60897322b6f423e46"
Expand Down

0 comments on commit cfb32e1

Please sign in to comment.