An elegant console reporter, borrowed from Yarn
Installations
npm install yurnalist
Developer Guide
Typescript
No
Module System
CommonJS
Min. Node Version
>=4.0.0
Score
96.3
Supply Chain
97.5
Quality
75
Maintenance
100
Vulnerability
98.6
License
Releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Developer
0x80
Download Statistics
Total Downloads
106,305,671
Last Day
48,252
Last Week
230,822
Last Month
1,026,114
Last Year
15,182,567
GitHub Statistics
90 Stars
99 Commits
6 Forks
2 Watching
18 Branches
3 Contributors
Bundle Size
590.05 kB
Minified
239.32 kB
Minified + Gzipped
Package Meta Information
Latest Version
2.1.0
Package Id
yurnalist@2.1.0
Size
24.43 kB
Publised On
14 Sept 2020
Total Downloads
Cumulative downloads
Total Downloads
106,305,671
Last day
-1.8%
48,252
Compared to previous day
Last week
-11.1%
230,822
Compared to previous week
Last month
4.3%
1,026,114
Compared to previous month
Last year
-12.4%
15,182,567
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
5
Dev Dependencies
36
Yurnalist
An elegant console reporter, borrowed from Yarn.
Introduction
Pretty console output makes developers happy and Yarn is doing a nice job. Yurnalist takes the internal console reporter code from Yarn and makes it available for use in other Node.js applications.
The current version is based on code from Yarn v1.13.0.
Yurnalist can be used to report many different things besides simple messages.
Features
- log, info, warn, succes, error & command messages
- progress bars
- activity spinners
- process steps
- object inspection
- lists
- emojis
- trees
- tables
- user question
- user select
- program header & footer
Install
1yarn add yurnalist
Or if your prefer NPM
1npm install yurnalist
How to use
Here is an example showing a combination of different reporter API functions.
1import report from 'yurnalist' 2 3/* A function to fake some async task */ 4function waitNumberOfSecs(secs) { 5 return new Promise((resolve) => setTimeout(resolve, secs * 1000)); 6} 7 8async function fetchSomething() { 9 report.info('Please wait while I fetch something for you.'); 10 report.warn('It might take a little while though.'); 11 12 const spinner = report.activity(); 13 spinner.tick('I am on it!'); 14 15 try { 16 await waitNumberOfSecs(1); 17 spinner.tick('Still busy...'); 18 await waitNumberOfSecs(1); 19 spinner.tick('Almost there...'); 20 await waitNumberOfSecs(1); 21 report.success('Done!'); 22 } catch (err) { 23 report.error(err); 24 } 25 26 spinner.end(); 27} 28 29fetchSomething(); 30
Requirements
Node >= 4
Examples
Examples showing different API functions are found in /examples.
You can run them directly with node >= 7.6 (because of async/await syntax). For
older versions you could use the --harmony
flag, or otherwise Babel.
To run the activity example:
1node examples/activity.js
Configuration
A normal import gives you a reporter instance configured with defaults for easy
use. If you want something else you can call createReporter(options)
to give
you an instance with different options.
Options
These are the options of the reporter as defined by Flow:
1type ReporterOptions = { 2 verbose?: boolean, 3 stdout?: Stdout, 4 stderr?: Stdout, 5 stdin?: Stdin, 6 emoji?: boolean, 7 noProgress?: boolean, 8 silent?: boolean, 9 nonInteractive?: boolean, 10 peekMemoryCounter?: boolean 11};
The defaults used are:
1const defaults = { 2 verbose: false, 3 stdout: process.stdout, 4 stderr: process.stderr, 5 stdin: process.stdin, 6 emoji: true, 7 noProgress: false, 8 silent: false, 9 nonInteractive: false, 10 peekMemoryCounter: false 11}
The peekMemoryCounter is disabled by default. If you enable it, you'll have to
call reporter.close()
to stop its running timer. Otherwise your program will
not exit. The memory counter can be used to display in the footer data.
Silent Mode and CI
Silent mode can be set via the options passed to createReporter. It disables
output for various functions like info
, list
, activity
and progress
. The
output from warning
and error
messages is not silenced.
Silent mode can also be enabled with the YURNALIST_SILENT
environment
variable.
In CI environments the output from activity
and progress
is disabled.
API
The API still needs some documentation, but most methods are straightforward. In the meantime you can also look at the examples and possibly even the tests.
The following functions are available:
table
step
inspect( thing: mixed )
Pretty-prints the thing
.
list(title: string, items: Array, hints?: Object)
Generates a list of the provided items. Turns into a definition list if hints
are provided.
Example of a simple list:
report.list('My grocery list', ['bananas', 'tulips', 'eggs', 'bamischijf']);
Outputs:
list My grocery list
- bananas
- tulips
- eggs
- bamischijf
Example with hints:
const items = ['bananas', 'tulips', 'eggs', 'bamischijf'];
const hints = {
bananas: 'for baking',
tulips: 'because it makes you happy',
eggs: 'not the cheap ones though',
bamischijf: 'if they have it',
};
report.list('My grocery list', items, hints);
Outputs:
list My grocery list
- bananas
for baking
- tulips
because it makes you happy
- eggs
not the cheap ones though
- bamischijf
if they have it
header
footer
log
success
error
info
command
warn
question
tree
activitySet
activity
select
progress
close
createReporter
Language
Yarn uses a language file for certain messages. For example if you try to skip a required question, or when you pick an invalid item from a select. This language file is not yet exposed in the Yurnalist API. The only supported language is English, as it is in Yarn at the moment.
I plan to make this configurable so that you can define your own messages in your own language .
Emojis
You can use Emojis in your output. Yurnalist should disable them if they are not allowed in the application environment.
Check:
Credits
Of course ❤️ and credits to all the contributers of Yarn. The ease with which I was able to extract this module from their codebase is proving some awesome engineering skills.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Warn: project license file does not contain an FSF or OSI license.
Reason
project is archived
Details
- Warn: Repository is archived.
Reason
Found 2/25 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 12 are checked with a SAST tool
Reason
52 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-6chw-6frg-f759
- Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw
- Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw
- Warn: Project is vulnerable to: GHSA-fwr7-v2mv-hh25
- Warn: Project is vulnerable to: GHSA-cwfw-4gq5-mrqx
- Warn: Project is vulnerable to: GHSA-g95f-p29q-9xw4
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c
- Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq
- Warn: Project is vulnerable to: GHSA-8r6j-v8pm-fqw3
- Warn: Project is vulnerable to: MAL-2023-462
- Warn: Project is vulnerable to: GHSA-pfrx-2q88-qq97
- Warn: Project is vulnerable to: GHSA-765h-qjxv-5f44
- Warn: Project is vulnerable to: GHSA-f2jv-r9rf-7988
- Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj
- Warn: Project is vulnerable to: GHSA-rc47-6667-2j5j
- Warn: Project is vulnerable to: GHSA-qqgx-2p2h-9c37
- Warn: Project is vulnerable to: GHSA-896r-f27r-55mw
- Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h
- Warn: Project is vulnerable to: GHSA-6c8f-qphg-qjgp
- Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9
- Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm
- Warn: Project is vulnerable to: GHSA-4xcv-9jjx-gfj3
- Warn: Project is vulnerable to: GHSA-7wpw-2hjm-89gp
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m
- Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h
- Warn: Project is vulnerable to: GHSA-5fw9-fq32-wv5p
- Warn: Project is vulnerable to: GHSA-px4h-xg32-q955
- Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9
- Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp
- Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-4g88-fppr-53pp
- Warn: Project is vulnerable to: GHSA-4jqc-8m5r-9rpr
- Warn: Project is vulnerable to: GHSA-3jfq-g458-7qm9
- Warn: Project is vulnerable to: GHSA-r628-mhmh-qjhw
- Warn: Project is vulnerable to: GHSA-9r2w-394v-53qc
- Warn: Project is vulnerable to: GHSA-5955-9wpr-37jh
- Warn: Project is vulnerable to: GHSA-qq89-hq3f-393p
- Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36
- Warn: Project is vulnerable to: GHSA-jgrx-mgxx-jf9v
- Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3
- Warn: Project is vulnerable to: GHSA-7p7h-4mm5-852v
- Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7
- Warn: Project is vulnerable to: GHSA-6fc8-4gx4-v693
- Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q
- Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh
- Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp
Score
1.7
/10
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More