colorprint
Advanced tools
Comparing version 1.1.2 to 2.0.0
@@ -14,3 +14,4 @@ #!/usr/bin/env node | ||
'.*.bud', | ||
'docs/**/.*.bud', | ||
'doc/**/.*.bud', | ||
'example/**/.*.bud', | ||
'lib/.*.bud', | ||
@@ -17,0 +18,0 @@ 'test/.*.bud' |
@@ -0,0 +0,0 @@ /* ======================================================== |
@@ -0,0 +0,0 @@ |
@@ -0,0 +0,0 @@ PR.registerLangHandler(PR.createSimpleLexer([ |
@@ -0,0 +0,0 @@ var q = null; |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /*! |
@@ -11,6 +11,6 @@ /** | ||
var ext = require('./ext'), | ||
formatMsg = require('./format_msg'), | ||
decorateMsg = require('./decorate_msg'), | ||
extend = ext.extend; | ||
var formatMsg = require('./msg/format_msg'), | ||
decorateMsg = require('./msg/decorate_msg'), | ||
indentMsg = require('./msg/indent_msg'), | ||
extend = require('extend'); | ||
@@ -24,11 +24,11 @@ /** @lends module:colorprint/lib~Colorprint */ | ||
Colorprint.prototype = { | ||
_format: function () { | ||
prepareMsg: function () { | ||
var s = this; | ||
var msg = formatMsg.apply(formatMsg, arguments); | ||
return [s.PREFIX, msg, s.SUFFIX].join(''); | ||
return [s.PREFIX, indentMsg(msg, s.indent), s.SUFFIX].join(''); | ||
}, | ||
_printLog: function (msg, color) { | ||
writeToStdout: function (msg, color) { | ||
console.log(decorateMsg(msg, color)); | ||
}, | ||
_printError: function (msg, color) { | ||
writeToStderr: function (msg, color) { | ||
console.error(decorateMsg(msg, color)); | ||
@@ -83,2 +83,4 @@ }, | ||
}, | ||
/** Number of indent */ | ||
indent: 0, | ||
/** Message prefix */ | ||
@@ -94,3 +96,3 @@ PREFIX: '', | ||
var s = this; | ||
s._printLog(s._format.apply(s, arguments), s.NOTICE_COLOR); | ||
s.writeToStdout(s.prepareMsg.apply(s, arguments), s.NOTICE_COLOR); | ||
}, | ||
@@ -103,3 +105,3 @@ /** | ||
var s = this; | ||
s._printLog(s._format.apply(s, arguments), s.INFO_COLOR); | ||
s.writeToStdout(s.prepareMsg.apply(s, arguments), s.INFO_COLOR); | ||
}, | ||
@@ -112,3 +114,3 @@ /** | ||
var s = this; | ||
s._printLog(s._format.apply(s, arguments), s.DEBUG_COLOR); | ||
s.writeToStdout(s.prepareMsg.apply(s, arguments), s.DEBUG_COLOR); | ||
}, | ||
@@ -121,3 +123,3 @@ /** | ||
var s = this; | ||
s._printLog(s._format.apply(s, arguments), s.TRACE_COLOR); | ||
s.writeToStdout(s.prepareMsg.apply(s, arguments), s.TRACE_COLOR); | ||
}, | ||
@@ -130,3 +132,3 @@ /** | ||
var s = this; | ||
s._printError(s._format.apply(s, arguments), s.ERROR_COLOR); | ||
s.writeToStderr(s.prepareMsg.apply(s, arguments), s.ERROR_COLOR); | ||
}, | ||
@@ -139,3 +141,3 @@ /** | ||
var s = this; | ||
s._printError(s._format.apply(s, arguments), s.FATAL_COLOR); | ||
s.writeToStderr(s.prepareMsg.apply(s, arguments), s.FATAL_COLOR); | ||
} | ||
@@ -142,0 +144,0 @@ }; |
/** | ||
* @overview Print ansi-colored message to stdout/stderr. | ||
* @version 1.1.2 | ||
* Print ansi-colored message to stdout/stderr. | ||
* @version 2.0.0 | ||
* @module colorprint | ||
* @author {@link http://okunishitaka.com|Taka Okunishi} | ||
* @borrows module:colorprint/lib~Colorprint#NOTICE_COLOR as NOTICE_COLOR | ||
* @borrows module:colorprint/lib~Colorprint#INFO_COLOR as INFO_COLOR | ||
* @borrows module:colorprint/lib~Colorprint#DEBUG_COLOR as DEBUG_COLOR | ||
* @borrows module:colorprint/lib~Colorprint#TRACE_COLOR as TRACE_COLOR | ||
* @borrows module:colorprint/lib~Colorprint#ERROR_COLOR as ERROR_COLOR | ||
* @borrows module:colorprint/lib~Colorprint#FATAL_COLOR as FATAL_COLOR | ||
* @borrows module:colorprint/lib~Colorprint#NOTICE as NOTICE | ||
* @borrows module:colorprint/lib~Colorprint#INFO as INFO | ||
* @borrows module:colorprint/lib~Colorprint#DEBUG as DEBUG | ||
* @borrows module:colorprint/lib~Colorprint#TRACE as TRACE | ||
* @borrows module:colorprint/lib~Colorprint#ERROR as ERROR | ||
* @borrows module:colorprint/lib~Colorprint#FATAL as FATAL | ||
* @borrows module:colorprint/lib~Colorprint#init as init | ||
* @borrows module:colorprint/lib~Colorprint#PREFIX as PREFIX | ||
* @borrows module:colorprint/lib~Colorprint#SUFFIX as SUFFIX | ||
* @borrows module:colorprint/lib~Colorprint#notice as notice | ||
* @borrows module:colorprint/lib~Colorprint#info as info | ||
* @borrows module:colorprint/lib~Colorprint#debug as debug | ||
* @borrows module:colorprint/lib~Colorprint#trace as trace | ||
* @borrows module:colorprint/lib~Colorprint#error as error | ||
* @borrows module:colorprint/lib~Colorprint#fatal as fatal | ||
* @see https://github.com/okunishinishi/colorprint#readme | ||
* @requires {@link https://www.npmjs.org/package/cli-color|cli-color@^1.0.0} | ||
* @requires {@link https://www.npmjs.org/package/commander|commander@^2.8.1} | ||
* @requires {@link https://www.npmjs.org/package/extend|extend@^3.0.0} | ||
* @author {@link http://okunishitaka.com|Taka Okunishi | ||
* @see https://github.com/okunishinishi/node-colorprint#readme | ||
* @requires {@link https://www.npmjs.org/package/cli-color|cli-color@^1.0.0 | ||
* @requires {@link https://www.npmjs.org/package/commander|commander@^2.8.1 | ||
* @requires {@link https://www.npmjs.org/package/extend|extend@^3.0.0 | ||
*/ | ||
@@ -35,29 +14,12 @@ | ||
var Colorprint = require('./colorprint'); | ||
var Colorprint = require('./colorprint'), | ||
pkg = require('../package.json'), | ||
create = require('./create'); | ||
var colorprint = new Colorprint(); | ||
colorprint.version = '1.1.2'; | ||
//--------------------- | ||
// Classes | ||
//--------------------- | ||
var colorprint = create(); | ||
colorprint.create = create; | ||
colorprint.Colorprint = Colorprint; | ||
colorprint.version = pkg.version; | ||
//--------------------- | ||
// Sub modules | ||
//--------------------- | ||
/** | ||
* External modules installed via npm. | ||
* @name {@link module:colorprint/lib/ext|ext} | ||
* @memberof module:colorprint | ||
* @see module:colorprint/lib/ext | ||
*/ | ||
colorprint.ext = require('./ext'); | ||
//--------------------- | ||
// Aliases | ||
//--------------------- | ||
module.exports = colorprint; |
{ | ||
"name": "colorprint", | ||
"version": "1.1.2", | ||
"version": "2.0.0", | ||
"description": "Print ansi-colored message to stdout/stderr.", | ||
@@ -10,11 +10,5 @@ "main": "lib", | ||
"scripts": { | ||
"build": "./ci/build.js", | ||
"test": "./ci/test.js", | ||
"cover": "./ci/cover.js", | ||
"report": "./ci/report.js" | ||
"test": "./ci/test.js" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/okunishinishi/colorprint.git" | ||
}, | ||
"repository": "okunishinishi/node-colorprint.git", | ||
"keywords": [ | ||
@@ -33,16 +27,17 @@ "ansi", | ||
"bugs": { | ||
"url": "https://github.com/okunishinishi/colorprint/issues" | ||
"url": "https://github.com/okunishinishi/node-colorprint/issues" | ||
}, | ||
"homepage": "https://github.com/okunishinishi/colorprint#readme", | ||
"homepage": "https://github.com/okunishinishi/node-colorprint#readme", | ||
"devDependencies": { | ||
"ape-covering": "^1.0.8", | ||
"ape-deploying": "^1.0.8", | ||
"ape-releasing": "^1.0.14", | ||
"ape-reporting": "^1.0.8", | ||
"ape-tasking": "^1.0.6", | ||
"ape-testing": "^1.1.6", | ||
"ape-tmpl": "^1.0.3", | ||
"ape-releasing": "^1.0.16", | ||
"ape-reporting": "^1.0.9", | ||
"ape-tasking": "^1.0.7", | ||
"ape-testing": "^1.3.2", | ||
"ape-tmpl": "^1.3.5", | ||
"ape-updating": "^1.0.1", | ||
"apiguide": "^1.0.5", | ||
"coz": "^1.5.0" | ||
"apiguide": "^1.0.8", | ||
"coz": "^3.0.15", | ||
"coz-tmpl": "^1.0.4" | ||
}, | ||
@@ -54,2 +49,2 @@ "dependencies": { | ||
} | ||
} | ||
} |
@@ -12,13 +12,14 @@ colorprint | ||
[bd_repo_url]: https://github.com/okunishinishi/node-colorprint | ||
[bd_travis_url]: http://travis-ci.org/okunishinishi/node-colorprint | ||
[bd_travis_shield_url]: http://img.shields.io/travis/okunishinishi/node-colorprint.svg?style=flat | ||
[bd_license_url]: https://github.com/okunishinishi/node-colorprint/blob/master/LICENSE | ||
[bd_codeclimate_url]: http://codeclimate.com/github/okunishinishi/node-colorprint | ||
[bd_codeclimate_shield_url]: http://img.shields.io/codeclimate/github/okunishinishi/node-colorprint.svg?style=flat | ||
[bd_codeclimate_coverage_shield_url]: http://img.shields.io/codeclimate/coverage/github/okunishinishi/node-colorprint.svg?style=flat | ||
[bd_gemnasium_url]: https://gemnasium.com/okunishinishi/node-colorprint | ||
[bd_gemnasium_shield_url]: https://gemnasium.com/okunishinishi/node-colorprint.svg | ||
[bd_repo_url]: https://github.com/okunishinishi/node-colorprint.git | ||
[bd_travis_url]: http://travis-ci.org/okunishinishi/node-colorprint.git | ||
[bd_travis_shield_url]: http://img.shields.io/travis/okunishinishi/node-colorprint.git.svg?style=flat | ||
[bd_license_url]: https://github.com/okunishinishi/node-colorprint.git/blob/master/LICENSE | ||
[bd_codeclimate_url]: http://codeclimate.com/github/okunishinishi/node-colorprint.git | ||
[bd_codeclimate_shield_url]: http://img.shields.io/codeclimate/github/okunishinishi/node-colorprint.git.svg?style=flat | ||
[bd_codeclimate_coverage_shield_url]: http://img.shields.io/codeclimate/coverage/github/okunishinishi/node-colorprint.git.svg?style=flat | ||
[bd_gemnasium_url]: https://gemnasium.com/okunishinishi/node-colorprint.git | ||
[bd_gemnasium_shield_url]: https://gemnasium.com/okunishinishi/node-colorprint.git.svg | ||
[bd_npm_url]: http://www.npmjs.org/package/colorprint | ||
[bd_npm_shield_url]: http://img.shields.io/npm/v/colorprint.svg?style=flat | ||
[bd_bower_badge_url]: https://img.shields.io/bower/v/colorprint.svg?style=flat | ||
@@ -42,5 +43,9 @@ <!-- Badge End --> | ||
<!-- Sections Start --> | ||
<a name="sections"></a> | ||
<!-- Section from "doc/readme/01.Installation.md.hbs" Start --> | ||
<a name="section-doc-readme-01-installation-md"></a> | ||
Installation | ||
@@ -53,2 +58,7 @@ ----- | ||
<!-- Section from "doc/readme/01.Installation.md.hbs" End --> | ||
<!-- Section from "doc/readme/02-Usage.md.hbs" Start --> | ||
<a name="section-doc-readme-02-usage-md"></a> | ||
Usage | ||
@@ -69,7 +79,19 @@ ------- | ||
<!-- Section from "doc/readme/02-Usage.md.hbs" End --> | ||
<!-- Section from "doc/readme/03-CLI.md.hbs" Start --> | ||
<a name="section-doc-readme-03-c-l-i-md"></a> | ||
Using via CIL | ||
------- | ||
### CLI Usage | ||
### Install globally | ||
``` | ||
$ npm install colorprint -g | ||
``` | ||
### From Command Line | ||
```bash | ||
@@ -91,8 +113,8 @@ #!/bin/bash | ||
### Install global for CLI usage. | ||
``` | ||
$ npm install colorprint -g | ||
``` | ||
<!-- Section from "doc/readme/03-CLI.md.hbs" End --> | ||
<!-- Section from "doc/readme/04-Customizing.md.hbs" Start --> | ||
<a name="section-doc-readme-04-customizing-md"></a> | ||
Customizing | ||
@@ -126,3 +148,5 @@ -------- | ||
<!-- Section from "doc/readme/04-Customizing.md.hbs" End --> | ||
<!-- Sections Start --> | ||
@@ -136,3 +160,3 @@ | ||
------- | ||
This software is released under the [MIT License](https://github.com/okunishinishi/node-colorprint/blob/master/LICENSE). | ||
This software is released under the [MIT License](https://github.com/okunishinishi/node-colorprint.git/blob/master/LICENSE). | ||
@@ -139,0 +163,0 @@ <!-- LICENSE End --> |
@@ -25,2 +25,23 @@ /** | ||
exports['Colorprint with indent'] = function (test) { | ||
var colorprint = new Colorprint({ | ||
indent: 2 | ||
}); | ||
colorprint.notice('This is indented notice'); | ||
colorprint.info('This is indented info'); | ||
colorprint.debug('This is indented debug'); | ||
colorprint.trace('This is indented trace'); | ||
colorprint.error('This is indented error'); | ||
colorprint.fatal('This is indented fatal'); | ||
colorprint.INFO('This is indented INFO'); | ||
colorprint.DEBUG('This is indented DEBUG'); | ||
colorprint.TRACE('This is indented TRACE'); | ||
colorprint.ERROR('This is indented ERROR'); | ||
colorprint.FATAL('This is indented FATAL'); | ||
test.done(); | ||
}; | ||
exports['Customize color print.'] = function (test) { | ||
@@ -27,0 +48,0 @@ var colorprint = new Colorprint({ |
@@ -6,3 +6,3 @@ /** | ||
var decorateMsg = require('../lib/decorate_msg.js'); | ||
var decorateMsg = require('../lib/msg/decorate_msg.js'); | ||
@@ -9,0 +9,0 @@ exports['Decorate msg'] = function (test) { |
@@ -6,3 +6,3 @@ /** | ||
var formatMsg = require('../lib/format_msg.js'); | ||
var formatMsg = require('../lib/msg/format_msg.js'); | ||
@@ -9,0 +9,0 @@ exports['Format msg'] = function (test) { |
@@ -6,8 +6,21 @@ /** | ||
var lib = require('../lib/lib.js'); | ||
var lib = require('../lib'); | ||
exports['Lib'] = function(test){ | ||
exports['Lib'] = function (test) { | ||
test.ok(lib.create({})); | ||
test.ok(new lib.Colorprint({})); | ||
lib.notice('This is notice'); | ||
lib.info('This is info'); | ||
lib.debug('This is debug'); | ||
lib.trace('This is trace'); | ||
lib.error('This is error'); | ||
lib.fatal('This is fatal'); | ||
lib.INFO('This is INFO'); | ||
lib.DEBUG('This is DEBUG'); | ||
lib.TRACE('This is TRACE'); | ||
lib.ERROR('This is ERROR'); | ||
lib.FATAL('This is FATAL'); | ||
test.done(); | ||
}; | ||
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6592706
141
245438
159
11
1