From 134fa1345349c58b3c15f8d8a73278a3f1106ed6 Mon Sep 17 00:00:00 2001 From: Kiko Beats Date: Tue, 26 Jan 2016 00:01:38 +0100 Subject: [PATCH] Separate align from diff --- lib/Default.coffee | 21 ++++++++++++--------- package.json | 17 ++++++++++------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/lib/Default.coffee b/lib/Default.coffee index 57d6a17..40a10a8 100644 --- a/lib/Default.coffee +++ b/lib/Default.coffee @@ -1,18 +1,18 @@ 'use strict' chalk = require 'chalk' -ms = require 'pretty-ms' +humanizeMs = require 'ms' CONST = require './Constants' formatUtil = require 'format-util' - module.exports = print: -> for type of @types @transport @generateMessage type, message for message in @messages[type] outputMessage: (message) -> message - outputType: (type, diff = '') -> - if @align and not @diff then "#{type}#{diff}\t" else "#{type}#{diff} " + outputType: (type) -> + align = if @align then "\t" else " " + "#{type}#{align}" transport: console.log @@ -28,16 +28,19 @@ module.exports = if @diff if @diff[type] - diff = new Date() - @diff[type] - diff = if diff > CONST.MIN_DIFF_MS then ms diff else "#{diff}ms" - @diff[type] = new Date() + diff = humanizeMs(new Date() - @diff[type]) diff = " +#{diff}" + @diff[type] = new Date() else @diff[type] = new Date() + diff = " +0ms" - messageType = @outputType keyword, diff + messageType = @outputType keyword messageType = @colorize colorType, messageType - messageType + message + + output = messageType + message + output += @colorize colorType, diff if diff + output generateTypeMessage: (type) -> (message...) -> diff --git a/package.json b/package.json index fc9fec7..9663609 100644 --- a/package.json +++ b/package.json @@ -5,11 +5,14 @@ "version": "2.4.2", "main": "./index.js", "author": { - "email": "josefrancisco.verdu@gmail.com", "name": "Kiko Beats", + "email": "josefrancisco.verdu@gmail.com", "url": "https://github.com/Kikobeats" }, - "repository": "Kikobeats/acho", + "repository": { + "type": "git", + "url": "git+https://github.com/kikobeats/acho.git" + }, "bugs": { "url": "https://github.com/Kikobeats/acho/issues" }, @@ -19,11 +22,11 @@ "logging" ], "dependencies": { - "chalk": "latest", - "coffee-script": "latest", - "existential-assign": "latest", - "format-util": "latest", - "pretty-ms": "latest" + "chalk": "~1.1.1", + "coffee-script": "~1.10.0", + "existential-assign": "~1.2.2", + "format-util": "1.0.3", + "ms": "~0.7.1" }, "devDependencies": { "browserify": "latest",