added functionality

This commit is contained in:
Phil Kunz 2015-09-20 19:45:37 +00:00
parent e4225d10e3
commit 8d4e3eca49
6 changed files with 170 additions and 22 deletions

View File

@ -1,11 +1,20 @@
/// <reference path="typings/tsd.d.ts" /> /// <reference path="typings/tsd.d.ts" />
var path, through; var colors = require("colors");
through = require("through2"); var through = require("through2");
path = require("path"); var bl = {}; //beautylog object
module.exports = function (jadeTemplate, mojo) { bl.errorPrefix = ' Error: '.bgRed.white.bold;
if (mojo === void 0) { mojo = undefined; } bl.successPrefix = ' Success: '.bgGreen.white.bold;
return through.obj(function (file, enc, cb) { module.exports = function (logText, logType) {
//run callback function to signal end of plugin process. if (logText === void 0) { logText = 'empty log'; }
return cb(null, file); if (logType === void 0) { logType = 'normal'; }
}); switch (logType) {
case 'normal':
logText.cyan.bold;
case 'error':
logText = bl.errorPrefix + logText.red;
case 'success':
logText = bl.successPrefix + logText.cyan;
}
console.log(logText);
return true;
}; };

View File

@ -11,14 +11,19 @@
"url": "https://github.com/pushrocks/beautylog.git" "url": "https://github.com/pushrocks/beautylog.git"
}, },
"keywords": [ "keywords": [
"json", "log",
"jade", "color",
"template" "console",
"beautiful"
], ],
"author": "Smart Coordination GmbH <office@push.rocks> (https://push.rocks)", "author": "Smart Coordination GmbH <office@push.rocks> (https://push.rocks)",
"license": "MIT", "license": "MIT",
"bugs": { "bugs": {
"url": "https://github.com/pushrocks/beautylog/issues" "url": "https://github.com/pushrocks/beautylog/issues"
}, },
"homepage": "https://github.com/pushrocks/beautylog" "homepage": "https://github.com/pushrocks/beautylog",
"dependencies": {
"through2": "~2.0.0",
"colors": "~1.1.2"
}
} }

View File

@ -1,14 +1,21 @@
/// <reference path="typings/tsd.d.ts" /> /// <reference path="typings/tsd.d.ts" />
var path, through; var colors = require("colors");
var through = require("through2");
through = require("through2"); var bl:any = {}; //beautylog object
path = require("path"); bl.errorPrefix = ' Error: '.bgRed.white.bold;
bl.successPrefix = ' Success: '.bgGreen.white.bold;
module.exports = (jadeTemplate,mojo = undefined) => {
return through.obj((file, enc, cb) => { module.exports = (logText:string = 'empty log',logType = 'normal') => {
switch(logType) {
//run callback function to signal end of plugin process. case 'normal':
return cb(null, file); logText.cyan.bold;
}); case 'error':
logText = bl.errorPrefix + logText.red;
case 'success':
logText = bl.successPrefix + logText.cyan;
}
console.log(logText);
return true;
}; };

View File

@ -7,6 +7,9 @@
"installed": { "installed": {
"node/node.d.ts": { "node/node.d.ts": {
"commit": "efa0c1196d7280640e624ac1e7fa604502e7bd63" "commit": "efa0c1196d7280640e624ac1e7fa604502e7bd63"
},
"colors/colors.d.ts": {
"commit": "273a567b0a0bcc34cbf2a2470b2febc95796b644"
} }
} }
} }

123
ts/typings/colors/colors.d.ts vendored Normal file
View File

@ -0,0 +1,123 @@
// Type definitions for Colors.js 0.6.0-1
// Project: https://github.com/Marak/colors.js
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module "colors" {
interface Color {
(text: string): string;
black: Color;
red: Color;
green: Color;
yellow: Color;
blue: Color;
magenta: Color;
cyan: Color;
white: Color;
gray: Color;
grey: Color;
bgBlack: Color;
bgRed: Color;
bgGreen: Color;
bgYellow: Color;
bgBlue: Color;
bgMagenta: Color;
bgCyan: Color;
bgWhite: Color;
reset: Color;
bold: Color;
dim: Color;
italic: Color;
underline: Color;
inverse: Color;
hidden: Color;
strikethrough: Color;
rainbow: Color;
zebra: Color;
america: Color;
trap: Color;
random: Color;
}
module e {
export function setTheme(theme:any): void;
export var black: Color;
export var red: Color;
export var green: Color;
export var yellow: Color;
export var blue: Color;
export var magenta: Color;
export var cyan: Color;
export var white: Color;
export var gray: Color;
export var grey: Color;
export var bgBlack: Color;
export var bgRed: Color;
export var bgGreen: Color;
export var bgYellow: Color;
export var bgBlue: Color;
export var bgMagenta: Color;
export var bgCyan: Color;
export var bgWhite: Color;
export var reset: Color;
export var bold: Color;
export var dim: Color;
export var italic: Color;
export var underline: Color;
export var inverse: Color;
export var hidden: Color;
export var strikethrough: Color;
export var rainbow: Color;
export var zebra: Color;
export var america: Color;
export var trap: Color;
export var random: Color;
}
export = e;
}
interface String {
black: string;
red: string;
green: string;
yellow: string;
blue: string;
magenta: string;
cyan: string;
white: string;
gray: string;
grey: string;
bgBlack: string;
bgRed: string;
bgGreen: string;
bgYellow: string;
bgBlue: string;
bgMagenta: string;
bgCyan: string;
bgWhite: string;
reset: string;
bold: string;
dim: string;
italic: string;
underline: string;
inverse: string;
hidden: string;
strikethrough: string;
rainbow: string;
zebra: string;
america: string;
trap: string;
random: string;
}

1
ts/typings/tsd.d.ts vendored
View File

@ -1 +1,2 @@
/// <reference path="node/node.d.ts" /> /// <reference path="node/node.d.ts" />
/// <reference path="colors/colors.d.ts" />