### Run activity example Source: https://github.com/0x80/yurnalist/blob/master/README.md Runs the activity example from the examples directory. Requires Node >= 7.6 for async/await syntax; older versions can use the --harmony flag or Babel. ```sh node examples/activity.js ``` -------------------------------- ### Install yurnalist with Yarn Source: https://github.com/0x80/yurnalist/blob/master/README.md Install yurnalist as a dependency using the Yarn package manager. ```sh yarn add yurnalist ``` -------------------------------- ### Simple list with report.list Source: https://github.com/0x80/yurnalist/blob/master/README.md Simple list example. The output shows the list title and each item prefixed with a dash. ```javascript report.list('My grocery list', ['bananas', 'tulips', 'eggs', 'bamischijf']); ``` ```text list My grocery list - bananas - tulips - eggs - bamischijf ``` -------------------------------- ### Install yurnalist with NPM Source: https://github.com/0x80/yurnalist/blob/master/README.md Install yurnalist as a dependency using the NPM package manager. ```sh npm install yurnalist ``` -------------------------------- ### Use yurnalist reporter API functions Source: https://github.com/0x80/yurnalist/blob/master/README.md Shows a combination of different reporter API functions: info, warn, activity spinner, success, and error. The example fakes an async task with a promise and uses the spinner to report progress. ```javascript import report from 'yurnalist' /* A function to fake some async task */ function waitNumberOfSecs(secs) { return new Promise((resolve) => setTimeout(resolve, secs * 1000)); } async function fetchSomething() { report.info('Please wait while I fetch something for you.'); report.warn('It might take a little while though.'); const spinner = report.activity(); spinner.tick('I am on it!'); try { await waitNumberOfSecs(1); spinner.tick('Still busy...'); await waitNumberOfSecs(1); spinner.tick('Almost there...'); await waitNumberOfSecs(1); report.success('Done!'); } catch (err) { report.error(err); } spinner.end(); } fetchSomething(); ``` -------------------------------- ### List with hints using report.list Source: https://github.com/0x80/yurnalist/blob/master/README.md List with hints. When hints are provided, the list becomes a definition list with each hint indented under its item. ```javascript 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); ``` ```text list My grocery list - bananas for baking - tulips because it makes you happy - eggs not the cheap ones though - bamischijf if they have it ``` -------------------------------- ### Default reporter options Source: https://github.com/0x80/yurnalist/blob/master/README.md Default options used by the reporter. The peekMemoryCounter is disabled by default; enabling it requires calling reporter.close() to stop the timer, otherwise the program will not exit. ```javascript const defaults = { verbose: false, stdout: process.stdout, stderr: process.stderr, stdin: process.stdin, emoji: true, noProgress: false, silent: false, nonInteractive: false, peekMemoryCounter: false } ``` -------------------------------- ### ReporterOptions type definition Source: https://github.com/0x80/yurnalist/blob/master/README.md Flow type definition for the options object accepted by createReporter(options). All properties are optional. ```javascript type ReporterOptions = { verbose?: boolean, stdout?: Stdout, stderr?: Stdout, stdin?: Stdin, emoji?: boolean, noProgress?: boolean, silent?: boolean, nonInteractive?: boolean, peekMemoryCounter?: boolean }; ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.