Gathering detailed insights and metrics for yurnalist
Gathering detailed insights and metrics for yurnalist
An elegant console reporter, borrowed from Yarn
npm install yurnalist
Typescript
Module System
Min. Node Version
96.3
Supply Chain
97.5
Quality
75
Maintenance
100
Vulnerability
98.6
License
JavaScript (100%)
Total Downloads
106,305,671
Last Day
48,252
Last Week
230,822
Last Month
1,026,114
Last Year
15,182,567
90 Stars
99 Commits
6 Forks
2 Watching
18 Branches
3 Contributors
Minified
Minified + Gzipped
Latest Version
2.1.0
Package Id
yurnalist@2.1.0
Size
24.43 kB
Publised On
14 Sept 2020
Cumulative downloads
Total Downloads
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
5
36
An elegant console reporter, borrowed from Yarn.
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.
1yarn add yurnalist
Or if your prefer NPM
1npm install yurnalist
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
Node >= 4
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
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.
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 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.
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:
Pretty-prints the thing
.
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
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 .
You can use Emojis in your output. Yurnalist should disable them if they are not allowed in the application environment.
Check:
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
Reason
project is archived
Details
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
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
52 existing vulnerabilities detected
Details
Score
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