Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ora

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ora - npm Package Compare versions

Comparing version 3.0.0 to 3.1.0

50

index.js

@@ -25,9 +25,4 @@ 'use strict';

const sp = this.options.spinner;
this.spinner = typeof sp === 'object' ? sp : (process.platform === 'win32' ? cliSpinners.line : (cliSpinners[sp] || cliSpinners.dots)); // eslint-disable-line no-nested-ternary
this.spinner = this.options.spinner;
if (this.spinner.frames === undefined) {
throw new Error('Spinner must define `frames`');
}
this.color = this.options.color;

@@ -38,3 +33,2 @@ this.hideCursor = this.options.hideCursor !== false;

this.id = null;
this.frameIndex = 0;
this.isEnabled = typeof this.options.isEnabled === 'boolean' ? this.options.isEnabled : ((this.stream && this.stream.isTTY) && !process.env.CI);

@@ -45,4 +39,42 @@

this.linesToClear = 0;
this.indent = this.options.indent;
}
get indent() {
return this._indent;
}
set indent(indent = 0) {
if (!(indent >= 0 && Number.isInteger(indent))) {
throw new Error('The `indent` option must be an integer from 0 and up');
}
this._indent = indent;
}
get spinner() {
return this._spinner;
}
set spinner(spinner) {
this.frameIndex = 0;
if (typeof spinner === 'object') {
if (spinner.frames === undefined) {
throw new Error('The given spinner must have a `frames` property');
}
this._spinner = spinner;
} else if (process.platform === 'win32') {
this._spinner = cliSpinners.line;
} else if (spinner === undefined) {
// Set default spinner
this._spinner = cliSpinners.dots;
} else if (cliSpinners[spinner]) {
this._spinner = cliSpinners[spinner];
} else {
throw new Error(`There is no built-in spinner named '${spinner}'. See https://github.com/sindresorhus/cli-spinners/blob/master/spinners.json for a full list.`);
}
}
get text() {

@@ -86,5 +118,7 @@ return this[TEXT];

}
this.stream.clearLine();
this.stream.cursorTo(0);
this.stream.cursorTo(this.indent);
}
this.linesToClear = 0;

@@ -91,0 +125,0 @@

96

package.json
{
"name": "ora",
"version": "3.0.0",
"description": "Elegant terminal spinner",
"license": "MIT",
"repository": "sindresorhus/ora",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=6"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"cli",
"spinner",
"spinners",
"terminal",
"term",
"console",
"ascii",
"unicode",
"loading",
"indicator",
"progress",
"busy",
"wait",
"idle"
],
"dependencies": {
"chalk": "^2.3.1",
"cli-cursor": "^2.1.0",
"cli-spinners": "^1.1.0",
"log-symbols": "^2.2.0",
"strip-ansi": "^4.0.0",
"wcwidth": "^1.0.1"
},
"devDependencies": {
"ava": "1.0.0-beta.6",
"get-stream": "^3.0.0",
"xo": "*"
}
"name": "ora",
"version": "3.1.0",
"description": "Elegant terminal spinner",
"license": "MIT",
"repository": "sindresorhus/ora",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=6"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"cli",
"spinner",
"spinners",
"terminal",
"term",
"console",
"ascii",
"unicode",
"loading",
"indicator",
"progress",
"busy",
"wait",
"idle"
],
"dependencies": {
"chalk": "^2.4.2",
"cli-cursor": "^2.1.0",
"cli-spinners": "^1.3.1",
"log-symbols": "^2.2.0",
"strip-ansi": "^5.0.0",
"wcwidth": "^1.0.1"
},
"devDependencies": {
"ava": "^1.2.1",
"get-stream": "^4.1.0",
"xo": "^0.24.0"
}
}

@@ -58,3 +58,3 @@ # ora [![Build Status](https://travis-ci.org/sindresorhus/ora.svg?branch=master)](https://travis-ci.org/sindresorhus/ora)

Name of one of the [provided spinners](https://github.com/sindresorhus/cli-spinners/blob/master/spinners.json). See `example.js` in this repo if you want to test out different spinners.
Name of one of the [provided spinners](https://github.com/sindresorhus/cli-spinners/blob/master/spinners.json). See `example.js` in this repo if you want to test out different spinners. On Windows, it will always use the `line` spinner as the Windows command-line doesn't have proper Unicode support.

@@ -65,3 +65,3 @@ Or an object like:

{
interval: 80, // optional
interval: 80, // Optional
frames: ['-', '+', '-']

@@ -86,2 +86,9 @@ }

##### indent
Type: `number`<br>
Default: `0`
Indent the spinner with the given number of spaces.
##### interval

@@ -98,3 +105,3 @@

Type: `WritableStream`<br>
Type: `stream.Writable`<br>
Default: `process.stderr`

@@ -188,2 +195,10 @@

#### .spinner
Change the spinner.
#### .indent
Change the spinner indent.
### ora.promise(action, [options|text])

@@ -206,2 +221,4 @@

- [marquee-ora](https://github.com/joeycozza/marquee-ora) - Scrolling marquee spinner for Ora
- [briandowns/spinner](https://github.com/briandowns/spinner) - Terminal spinner/progress indicator for Go
- [tj/go-spin](https://github.com/tj/go-spin) - Terminal spinner package for Go

@@ -208,0 +225,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc