Skip to content

Commit

Permalink
Use stdin-discarder package
Browse files Browse the repository at this point in the history
Fixes #143
  • Loading branch information
sindresorhus committed Jul 26, 2022
1 parent 074a013 commit b4d9c06
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 96 deletions.
8 changes: 1 addition & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ import stripAnsi from 'strip-ansi';
import wcwidth from 'wcwidth';
import isInteractive from 'is-interactive';
import isUnicodeSupported from 'is-unicode-supported';
import {StdinDiscarder} from './utilities.js';

let stdinDiscarder;
import stdinDiscarder from 'stdin-discarder';

class Ora {
#linesToClear = 0;
Expand All @@ -30,10 +28,6 @@ class Ora {
color;

constructor(options) {
if (!stdinDiscarder) {
stdinDiscarder = new StdinDiscarder();
}

if (typeof options === 'string') {
options = {
text: options,
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
},
"files": [
"index.js",
"index.d.ts",
"utilities.js"
"index.d.ts"
],
"keywords": [
"cli",
Expand All @@ -40,13 +39,13 @@
"idle"
],
"dependencies": {
"bl": "^5.0.0",
"chalk": "^5.0.0",
"cli-cursor": "^4.0.0",
"cli-spinners": "^2.6.1",
"is-interactive": "^2.0.0",
"is-unicode-supported": "^1.1.0",
"log-symbols": "^5.1.0",
"stdin-discarder": "^0.1.0",
"strip-ansi": "^7.0.1",
"wcwidth": "^1.0.1"
},
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ Default: `true`

Discard stdin input (except Ctrl+C) while running if it's TTY. This prevents the spinner from twitching on input, outputting broken lines on <kbd>Enter</kbd> key presses, and prevents buffering of input while the spinner is running.

This has no effect on Windows as there's no good way to implement discarding stdin properly there.
This has no effect on Windows as there is no good way to implement discarding stdin properly there.

### Instance

Expand Down
85 changes: 0 additions & 85 deletions utilities.js

This file was deleted.

0 comments on commit b4d9c06

Please sign in to comment.