added test and fixed an error
This commit is contained in:
parent
7bd46ad13e
commit
959fd9004a
10
index.js
10
index.js
@ -1,6 +1,5 @@
|
||||
/// <reference path="./typings/tsd.d.ts" />
|
||||
var colors = require("colors");
|
||||
var through = require("through2");
|
||||
var bl;
|
||||
bl = {};
|
||||
/**
|
||||
@ -9,8 +8,9 @@ bl = {};
|
||||
*/
|
||||
var localBl;
|
||||
localBl = {};
|
||||
localBl.errorPrefix = ' Error: '.bgRed.white.bold;
|
||||
localBl.successPrefix = ' Success: '.bgGreen.white.bold;
|
||||
localBl.normalPrefix = ' Log: '.bgCyan.white.bold + ' ';
|
||||
localBl.errorPrefix = ' Error: '.bgRed.white.bold + ' ';
|
||||
localBl.successPrefix = ' Success: '.bgGreen.white.bold + ' ';
|
||||
/**
|
||||
*
|
||||
* @param logText
|
||||
@ -23,13 +23,13 @@ bl.log = function (logText, logType) {
|
||||
try {
|
||||
switch (logType) {
|
||||
case 'normal':
|
||||
logText.cyan.bold;
|
||||
logText = localBl.normalPrefix + logText.cyan.bold;
|
||||
break;
|
||||
case 'error':
|
||||
logText = localBl.errorPrefix + logText.red.bold;
|
||||
break;
|
||||
case 'success':
|
||||
logText = localBl.successPrefix + logText.cyan.bold;
|
||||
logText = localBl.successPrefix + logText.green.bold;
|
||||
break;
|
||||
default:
|
||||
logText.blue.bold;
|
||||
|
@ -23,6 +23,6 @@
|
||||
},
|
||||
"homepage": "https://github.com/pushrocks/beautylog",
|
||||
"dependencies": {
|
||||
"beautylog": "latest"
|
||||
"colors": "latest"
|
||||
}
|
||||
}
|
||||
|
15
test.js
Normal file
15
test.js
Normal file
@ -0,0 +1,15 @@
|
||||
/// <reference path="./typings/tsd.d.ts" />
|
||||
var beautyLog = require('./index.js');
|
||||
console.log('*** start test ***');
|
||||
console.log('');
|
||||
console.log('declarative function calls:');
|
||||
beautyLog.log('beautylog.log(), with normal logText, without logType');
|
||||
beautyLog.error('beautylog.error(), with normal logText, without logType');
|
||||
beautyLog.success('beautylog.success(), with normal logText, without logType');
|
||||
console.log('');
|
||||
console.log('logType String:');
|
||||
beautyLog.log('beautylog.log(), with normal logText, without logType');
|
||||
beautyLog.log('beautylog.log(), with normal logText, with logType "error"', 'error');
|
||||
beautyLog.log('beautylog.log(), with normal logText, with logType "success"', 'success');
|
||||
console.log('');
|
||||
console.log('*** end test ***');
|
@ -11,6 +11,15 @@ gulp.task('compileTS', function() {
|
||||
return stream;
|
||||
});
|
||||
|
||||
gulp.task('default',['compileTS'], function() {
|
||||
gulp.task('compileTSTest', function() {
|
||||
var stream = gulp.src('../test.ts')
|
||||
.pipe(gulpTypescript({
|
||||
out: "test.js"
|
||||
}))
|
||||
.pipe(gulp.dest("../../"));
|
||||
return stream;
|
||||
});
|
||||
|
||||
gulp.task('default',['compileTS','compileTSTest'], function() {
|
||||
console.log('Typescript compiled');
|
||||
});
|
10
ts/index.ts
10
ts/index.ts
@ -1,6 +1,5 @@
|
||||
/// <reference path="./typings/tsd.d.ts" />
|
||||
var colors = require("colors");
|
||||
var through = require("through2");
|
||||
|
||||
|
||||
var bl:any;
|
||||
@ -12,8 +11,9 @@ bl = {}
|
||||
*/
|
||||
var localBl:any;
|
||||
localBl = {};
|
||||
localBl.errorPrefix = ' Error: '.bgRed.white.bold;
|
||||
localBl.successPrefix = ' Success: '.bgGreen.white.bold;
|
||||
localBl.normalPrefix = ' Log: '.bgCyan.white.bold + ' ';
|
||||
localBl.errorPrefix = ' Error: '.bgRed.white.bold + ' ';
|
||||
localBl.successPrefix = ' Success: '.bgGreen.white.bold + ' ';
|
||||
|
||||
/**
|
||||
*
|
||||
@ -25,13 +25,13 @@ bl.log = (logText:string = 'empty log',logType:string = 'normal') => {
|
||||
try {
|
||||
switch (logType) {
|
||||
case 'normal':
|
||||
logText.cyan.bold;
|
||||
logText = localBl.normalPrefix + logText.cyan.bold;
|
||||
break;
|
||||
case 'error':
|
||||
logText = localBl.errorPrefix + logText.red.bold;
|
||||
break;
|
||||
case 'success':
|
||||
logText = localBl.successPrefix + logText.cyan.bold;
|
||||
logText = localBl.successPrefix + logText.green.bold;
|
||||
break;
|
||||
default:
|
||||
logText.blue.bold;
|
||||
|
20
ts/test.ts
Normal file
20
ts/test.ts
Normal file
@ -0,0 +1,20 @@
|
||||
/// <reference path="./typings/tsd.d.ts" />
|
||||
var beautyLog = require('./index.js');
|
||||
|
||||
console.log('*** start test ***');
|
||||
console.log ('');
|
||||
|
||||
console.log('declarative function calls:');
|
||||
beautyLog.log('beautylog.log(), with normal logText, without logType');
|
||||
beautyLog.error('beautylog.error(), with normal logText, without logType');
|
||||
beautyLog.success('beautylog.success(), with normal logText, without logType');
|
||||
|
||||
console.log('');
|
||||
|
||||
console.log('logType String:');
|
||||
beautyLog.log('beautylog.log(), with normal logText, without logType');
|
||||
beautyLog.log('beautylog.log(), with normal logText, with logType "error"','error');
|
||||
beautyLog.log('beautylog.log(), with normal logText, with logType "success"','success');
|
||||
|
||||
console.log ('');
|
||||
console.log('*** end test ***');
|
Loading…
Reference in New Issue
Block a user