Skip to content

Commit

Permalink
Merge pull request #2 from flarebyte/april-2016
Browse files Browse the repository at this point in the history
April 2016 - Update deps - Adds screenshots
  • Loading branch information
olih committed Apr 8, 2016
2 parents 287030c + d4f5f0a commit 3a3ffba
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 18 deletions.
28 changes: 23 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
# solace [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-image]][daviddm-url] [![Coverage percentage][coveralls-image]][coveralls-url]
> Alternative to the console log which automatically beautifies the output
Solace is particularly useful if you intend:
* to debug some data.
* to display some data for a CLI.

Solace has a specific support for string, boolean, number, date, regex, null, void, error, NaN, object, array and will deal with these types in a pleasant way.

By default, the output is expected to be stdout/stderr, but you can override this to implement more advanced logging.

The theme (machine, beautiful, outline) can be changed at runtime, which can be a handy option for the user of a CLI.

## Installation

```sh
Expand All @@ -13,9 +23,9 @@ $ npm install --save solace
import solaceCreator from 'solace';

const solace = solaceCreator({
standardOut: process.stdout,
standardErr: process.stderr,
defaultTheme: 'beautiful'
//standardOut: process.stdout,
//standardErr: process.stderr,
//defaultTheme: 'beautiful'
});

const value = {
Expand All @@ -34,7 +44,15 @@ solace.log(value, {title: 'title', theme: 'outline'});

* machine: Format the output in a compact manner easily readable by a machine.
* beautiful: Format the output in a beautiful manner.
* outline: Format the output with the main outlines.
* outline: Format the output with the main outlines. If the data is an array of objects, it may be displayed as a table.

Example of beautiful output:

![Beautiful theme](/screenshots/solace-beautiful.png)

Example of outline output:

![Outline theme](/screenshots/solace-outline.png)


## License
Expand All @@ -48,5 +66,5 @@ MIT © [flarebyte](https://github.com/flarebyte)
[travis-url]: https://travis-ci.org/flarebyte/solace
[daviddm-image]: https://david-dm.org/flarebyte/solace.svg?theme=shields.io
[daviddm-url]: https://david-dm.org/flarebyte/solace
[coveralls-image]: https://coveralls.io/repos/flarebyte/solace/badge.svg?branch=master&service=githubs
[coveralls-image]: https://coveralls.io/repos/github/flarebyte/solace/badge.svg?branch=master
[coveralls-url]: https://coveralls.io/github/flarebyte/solace?branch=master
8 changes: 4 additions & 4 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ const BEAUTIFUL = 'beautiful';
const OUTLINE = 'outline';

const confSchema = Joi.object().keys({
standardOut: Joi.object().required(),
standardErr: Joi.object().required(),
standardOut: Joi.object(),
standardErr: Joi.object(),
defaultTheme: Joi.string().valid(MACHINE, BEAUTIFUL, OUTLINE)
});

Expand All @@ -36,8 +36,8 @@ const isArrayOfSimpleObjects = (values) => {

export default (cfg) => {
Joi.assert(cfg, confSchema);
const stdOut = cfg.standardOut;
const stdErr = cfg.standardErr;
const stdOut = cfg.standardOut ? cfg.standardOut : process.stdout;
const stdErr = cfg.standardErr ? cfg.standardErr : process.stderr;
const themes = {
machine: machine,
beautiful: beautiful,
Expand Down
21 changes: 12 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "solace",
"version": "0.1.3",
"version": "1.1.0",
"description": "Alternative to console log which automatically beautifies the output",
"homepage": "https://github.com/flarebyte/solace",
"author": {
Expand All @@ -17,7 +17,11 @@
"stdout",
"beautify",
"json",
"yaml"
"yaml",
"CLI",
"command line interface",
"debugging",
"logging"
],
"repository": "https://github.com/flarebyte/solace.git",
"devDependencies": {
Expand All @@ -42,13 +46,12 @@
},
"license": "MIT",
"dependencies": {
"chalk": "^1.1.1",
"chalk": "^1.1.3",
"cli-table": "^0.3.1",
"joi": "^7.0.1",
"js-beautify": "^1.5.10",
"lodash": "^3.10.1",
"moment": "^2.10.6",
"prettyjson": "^1.1.3",
"string": "^3.3.1"
"joi": "^7.3.0",
"js-beautify": "^1.6.2",
"lodash": "^4.9.0",
"moment": "^2.12.0",
"prettyjson": "^1.1.3"
}
}
Binary file added screenshots/solace-beautiful.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/solace-outline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 3a3ffba

Please sign in to comment.