Repository: lirantal/lockfile-lint (js)

Issue:
Use log symbols for easier to read output
<!--
Thank you for suggesting an idea to make this project better!

Please fill in as much of the template below as you're able.
-->

**Is your feature request related to a problem? Please describe.**
1. More friendly and easier to read output. 
2. Also in case of no issues found, a success message should be printed - right now i don't see any message if all is ok.

**Describe the solution you'd like**
Use something like: https://www.npmjs.com/package/log-symbols

**Describe alternatives you've considered**
Alternative solution, styling the text: https://www.npmjs.com/package/ansi-colors, though i think the symbols are better. 

Pull request:
feat: Use symbols for easier to read output (#21)
## Description

- Use log symbols for easier to read output (#21)

## Types of changes

- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)

## Related Issue

Fixes #21 

## Motivation and Context

- By using symbols in the output it's easier to discern success or failure at a glance. Windows is also supported.

## How Has This Been Tested?

- Updated unit tests

## Screenshots (if appropriate):
#### Mac (in iterm2 with oh-my-zsh theme)
<img width="875" alt="mac1" src="https://user-images.githubusercontent.com/5598081/107130429-0fa9ac00-68d6-11eb-86bc-a692286d3409.png">
<img width="878" alt="mac2" src="https://user-images.githubusercontent.com/5598081/107130430-10dad900-68d6-11eb-976b-357c4ae9b2a3.png">
<img width="882" alt="mac3" src="https://user-images.githubusercontent.com/5598081/107130431-12a49c80-68d6-11eb-900a-f01d66eba33b.png">

#### Windows (in cmder)
![win3](https://user-images.githubusercontent.com/5598081/107130393-a0cc5300-68d5-11eb-94fb-02511b6f8a47.jpeg)
![win1](https://user-images.githubusercontent.com/5598081/107130391-9f028f80-68d5-11eb-90b2-5ba5d3d65b3f.jpeg)
![win2](https://user-images.githubusercontent.com/5598081/107130392-9f9b2600-68d5-11eb-89f0-a7d6adf24d08.jpeg)

## Checklist:

- [ ] I have updated the documentation (if required).
- [x] I have read the **CONTRIBUTING** document.
- [ ] I have added tests to cover my changes.
- [x] All new and existing tests passed.
- [x] I added a picture of a cute animal cause it's fun
![cat](https://user-images.githubusercontent.com/5598081/107130509-cb6adb80-68d6-11eb-81e3-2b21a3ec93c2.gif)



Patch:
diff --git a/packages/lockfile-lint/bin/lockfile-lint.js b/packages/lockfile-lint/bin/lockfile-lint.js
index 368a3de..be75848 100755
--- a/packages/lockfile-lint/bin/lockfile-lint.js
+++ b/packages/lockfile-lint/bin/lockfile-lint.js
@@ -4,6 +4,28 @@
 const debug = require('debug')('lockfile-lint')
 const main = require('../src/main')
 
+const isSupported =
+  process.platform !== 'win32' || process.env.CI || process.env.TERM === 'xterm-256color'
+
+const symbolsDefault = {
+  info: 'ℹ',
+  success: '✔',
+  error: '✖'
+}
+
+const symbolsFallback = {
+  info: 'i',
+  success: '√',
+  error: '×'
+}
+
+const symbols = isSupported ? symbolsDefault : symbolsFallback
+
+const RESET = '\x1b[0m'
+const RED = '\x1b[31m'
+const GREEN = '\x1b[32m'
+const YELLOW = '\x1b[33m'
+
 let config
 
 try {
@@ -57,10 +79,15 @@ try {
     validators
   })
 } catch (error) {
-  console.error('ABORTING lockfile lint process due to error exceptions', '\n')
+  console.error(
+    YELLOW,
+    `${symbols.info} ABORTING lockfile lint process due to error exceptions`,
+    '\n',
+    RESET
+  )
   console.error(error.message, '\n')
   console.error(error.stack, '\n')
-  console.error('error: command failed with exit code 1', '\n')
+  console.error(RED, `${symbols.error} Error: command failed with exit code 1`, '\n', RESET)
   process.exit(1)
 }
 
@@ -71,10 +98,8 @@ debug(`total validator failures: ${validatorFailures}`)
 debug(`total validator successes: ${validatorSuccesses}`)
 
 if (validatorFailures !== 0) {
-  console.error('error: command failed with exit code 1', '\n')
+  console.error(RED, `${symbols.error} Error: security issues detected!`, '\n', RESET)
   process.exit(1)
 } else {
-  const GREEN = '\x1b[32m'
-  const RESET = '\x1b[0m'
-  console.info(GREEN, 'No issues detected', '\n', RESET)
+  console.info(GREEN, `${symbols.success} No issues detected`, '\n', RESET)
 }


Test patch:
diff --git a/packages/lockfile-lint/__tests__/cli.test.js b/packages/lockfile-lint/__tests__/cli.test.js
index 930ec03..8286a87 100644
--- a/packages/lockfile-lint/__tests__/cli.test.js
+++ b/packages/lockfile-lint/__tests__/cli.test.js
@@ -59,7 +59,7 @@ describe('CLI tests', () => {
       expect(output).toContain(
         'detected invalid protocol for package: ms@^2.1.1\n    expected: https:\n    actual: http:\n'
       )
-      expect(output).toContain('error: command failed with exit code 1')
+      expect(output).toContain('Error: security issues detected!')
       done()
     })
   })