Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@comandeer/cli-spinner

Comandeer3.3kMIT1.0.2TypeScript support: included

Simple CLI spinner

cli spinner

readme

@comandeer/cli-spinner

Build Status codecov npm (scoped)

Super simple CLI spinner.

Installation

npm install @comandeer/cli-spinner --save

Usage

import Spinner from '@comandeer/cli-spinner';

const spinner = new Spinner( {
    label: 'Working…'
} );

await spinner.show();

//do something

await spinner.hide();

Configuration

You can configure the spinner by passing options via options object in the constructor:

const spinner = new Spinner( options );

The list of available options is presented below:

Name Type Default value Description
stdout Stream process.stderr Stream to which the spinner will be outputted.
label string '' Additional text label that will be displayed next to the spinner.
spinner Array<string> See src/defaultSpinner.js An array containing frames that will be used to animate the spinner.
interval number 80 Indicates how often frames of the spinner should be changed.

Why should I use it instead of x?

The truth is: you probably shouldn't. This package was created because I couldn't stand the API of gauge and ora didn't work for me for some reason. As I have quite severe NIH syndrome, I decided to create my own, very naive implementation of a CLI spinner.

So if you look for a battle-tested solution and don't mind more convoluted API, use gauge. If you prefer a battle-tested solution but with really user-friendly API, use ora. If for some reason these solutions don't work for you, you probably still shouldn't use this package.

License

See LICENSE file for details.

changelog

@comandeer/cli-spinner Changelog

All notable changes to this project will be documented in this file. The format is based on Keep a Changelog and this project adheres to Semantic Versioning.


1.0.2 – 2023-08-02

Fixed

  • #27: tslib was incorrectly marked as dev dependency instead of runtime one.

1.0.1 – 2023-07-28

Fixed

  • #25: incorrect order of exports in the package.json file.

1.0.0 – 2023-07-28

Added

  • #14: .d.ts file for the package.
  • #15: support for Node.js 18 and 20.

Changed

  • #18: BREAKING CHANGE: made the package an ESM only one.
  • #20: BREAKING CHANGE: move from symbol and _-private methods to real private fields and methods.
  • #17: BREAKING CHANGE: updated depdendencies:

    | Dependency | Old version | New version | | --------------------------- | ----------- | ----------- | | ⭐ ansi-escapes | N/A | ^6.2.0 | | ☠️ console-control-strings | ^1.1.0 | N/A | | ⭐ is-interactive | N/A | ^2.0.0 |

    New dependencies are marked with the "⭐" emoji.

    Removed dependencies are marked with the "☠️" emoji.

Removed

  • #15: BREAKING CHANGE: support for Node.js 12 and 14.

0.3.2 – 2021-11-20

Fixed

  • #12: make the API truly asynchronous.

0.3.1 – 2021-11-19

Fixed

  • #9: incorect repo URL in package.json.

0.3.0 – 2021-11-16

Added

  • #5: some docs.

    Changed

  • #6: BREAKING CHANGE: make the API fully asynchronous.

0.2.0 – 2021-11-13

Changed

  • #1: BREAKING CHANGE: use stderr instead of stdout.
  • #3: BREAKING CHANGE: do not show spinner in non-interactive terminals or on CI.

0.1.0

Added

  • First working version, yay!