Upakovka v Electron.JS no po staroy sborke cherez .cjs
This commit is contained in:
157
node_modules/ora/readme.md
generated
vendored
157
node_modules/ora/readme.md
generated
vendored
@@ -10,16 +10,14 @@
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
npm install ora
|
||||
```
|
||||
|
||||
*Check out [`yocto-spinner`](https://github.com/sindresorhus/yocto-spinner) for a smaller alternative.*
|
||||
$ npm install ora
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import ora from 'ora';
|
||||
const ora = require('ora');
|
||||
|
||||
const spinner = ora('Loading unicorns').start();
|
||||
|
||||
@@ -44,7 +42,7 @@ Type: `object`
|
||||
|
||||
Type: `string`
|
||||
|
||||
The text to display next to the spinner.
|
||||
Text to display after the spinner.
|
||||
|
||||
##### prefixText
|
||||
|
||||
@@ -52,35 +50,29 @@ Type: `string | () => string`
|
||||
|
||||
Text or a function that returns text to display before the spinner. No prefix text will be displayed if set to an empty string.
|
||||
|
||||
##### suffixText
|
||||
|
||||
Type: `string | () => string`
|
||||
|
||||
Text or a function that returns text to display after the spinner text. No suffix text will be displayed if set to an empty string.
|
||||
|
||||
##### spinner
|
||||
|
||||
Type: `string | object`\
|
||||
Default: `'dots'` <img src="screenshot-spinner.gif" width="14">
|
||||
|
||||
The name of one of the [provided spinners](#spinners). See `example.js` in this repo if you want to test out different spinners. On Windows (except for Windows Terminal), it will always use the `line` spinner as the Windows command-line doesn't have proper Unicode support.
|
||||
Name of one of the [provided spinners](https://github.com/sindresorhus/cli-spinners/blob/main/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.
|
||||
|
||||
Or an object like:
|
||||
|
||||
```js
|
||||
{
|
||||
frames: ['-', '+', '-'],
|
||||
interval: 80 // Optional
|
||||
interval: 80, // Optional
|
||||
frames: ['-', '+', '-']
|
||||
}
|
||||
```
|
||||
|
||||
##### color
|
||||
|
||||
Type: `string | boolean`\
|
||||
Type: `string`\
|
||||
Default: `'cyan'`\
|
||||
Values: `'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white' | 'gray' | boolean`
|
||||
Values: `'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white' | 'gray'`
|
||||
|
||||
The color of the spinner.
|
||||
Color of the spinner.
|
||||
|
||||
##### hideCursor
|
||||
|
||||
@@ -136,48 +128,10 @@ 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 is no good way to implement discarding stdin properly there.
|
||||
This has no effect on Windows as there's no good way to implement discarding stdin properly there.
|
||||
|
||||
### Instance
|
||||
|
||||
#### .text <sup>get/set</sup>
|
||||
|
||||
Change the text displayed after the spinner.
|
||||
|
||||
#### .prefixText <sup>get/set</sup>
|
||||
|
||||
Change the text before the spinner.
|
||||
|
||||
No prefix text will be displayed if set to an empty string.
|
||||
|
||||
#### .suffixText <sup>get/set</sup>
|
||||
|
||||
Change the text after the spinner text.
|
||||
|
||||
No suffix text will be displayed if set to an empty string.
|
||||
|
||||
#### .color <sup>get/set</sup>
|
||||
|
||||
Change the spinner color.
|
||||
|
||||
#### .spinner <sup>get/set</sup>
|
||||
|
||||
Change the spinner.
|
||||
|
||||
#### .indent <sup>get/set</sup>
|
||||
|
||||
Change the spinner indent.
|
||||
|
||||
#### .isSpinning <sup>get</sup>
|
||||
|
||||
A boolean indicating whether the instance is currently spinning.
|
||||
|
||||
#### .interval <sup>get</sup>
|
||||
|
||||
The interval between each frame.
|
||||
|
||||
The interval is decided by the chosen spinner.
|
||||
|
||||
#### .start(text?)
|
||||
|
||||
Start the spinner. Returns the instance. Set the current text if `text` is provided.
|
||||
@@ -202,6 +156,10 @@ Stop the spinner, change it to a yellow `⚠` and persist the current text, or `
|
||||
|
||||
Stop the spinner, change it to a blue `ℹ` and persist the current text, or `text` if provided. Returns the instance.
|
||||
|
||||
#### .isSpinning
|
||||
|
||||
A boolean of whether the instance is currently spinning.
|
||||
|
||||
#### .stopAndPersist(options?)
|
||||
|
||||
Stop the spinner and change the symbol or text. Returns the instance. See the GIF below.
|
||||
@@ -222,21 +180,14 @@ Symbol to replace the spinner with.
|
||||
Type: `string`\
|
||||
Default: Current `'text'`
|
||||
|
||||
Text to be persisted after the symbol.
|
||||
Text to be persisted after the symbol
|
||||
|
||||
###### prefixText
|
||||
|
||||
Type: `string | () => string`\
|
||||
Type: `string`\
|
||||
Default: Current `prefixText`
|
||||
|
||||
Text or a function that returns text to be persisted before the symbol. No prefix text will be displayed if set to an empty string.
|
||||
|
||||
###### suffixText
|
||||
|
||||
Type: `string | () => string`\
|
||||
Default: Current `suffixText`
|
||||
|
||||
Text or a function that returns text to be persisted after the text after the symbol. No suffix text will be displayed if set to an empty string.
|
||||
Text to be persisted before the symbol. No prefix text will be displayed if set to an empty string.
|
||||
|
||||
<img src="screenshot-2.gif" width="480">
|
||||
|
||||
@@ -252,73 +203,56 @@ Manually render a new frame. Returns the instance.
|
||||
|
||||
Get a new frame.
|
||||
|
||||
### oraPromise(action, text)
|
||||
### oraPromise(action, options)
|
||||
#### .text
|
||||
|
||||
Starts a spinner for a promise or promise-returning function. The spinner is stopped with `.succeed()` if the promise fulfills or with `.fail()` if it rejects. Returns the promise.
|
||||
Change the text after the spinner.
|
||||
|
||||
```js
|
||||
import {oraPromise} from 'ora';
|
||||
#### .prefixText
|
||||
|
||||
await oraPromise(somePromise);
|
||||
```
|
||||
Change the text before the spinner. No prefix text will be displayed if set to an empty string.
|
||||
|
||||
#### .color
|
||||
|
||||
Change the spinner color.
|
||||
|
||||
#### .spinner
|
||||
|
||||
Change the spinner.
|
||||
|
||||
#### .indent
|
||||
|
||||
Change the spinner indent.
|
||||
|
||||
### ora.promise(action, text)
|
||||
### ora.promise(action, options)
|
||||
|
||||
Starts a spinner for a promise. The spinner is stopped with `.succeed()` if the promise fulfills or with `.fail()` if it rejects. Returns the spinner instance.
|
||||
|
||||
#### action
|
||||
|
||||
Type: `Promise | ((spinner: ora.Ora) => Promise)`
|
||||
|
||||
#### options
|
||||
|
||||
Type: `object`
|
||||
|
||||
All of the [options](#options) plus the following:
|
||||
|
||||
##### successText
|
||||
|
||||
Type: `string | ((result: T) => string) | undefined`
|
||||
|
||||
The new text of the spinner when the promise is resolved.
|
||||
|
||||
Keeps the existing text if `undefined`.
|
||||
|
||||
##### failText
|
||||
|
||||
Type: `string | ((error: Error) => string) | undefined`
|
||||
|
||||
The new text of the spinner when the promise is rejected.
|
||||
|
||||
Keeps the existing text if `undefined`.
|
||||
|
||||
### spinners
|
||||
|
||||
Type: `Record<string, Spinner>`
|
||||
|
||||
All [provided spinners](https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json).
|
||||
Type: `Promise`
|
||||
|
||||
## FAQ
|
||||
|
||||
### How do I change the color of the text?
|
||||
|
||||
Use [`chalk`](https://github.com/chalk/chalk) or [`yoctocolors`](https://github.com/sindresorhus/yoctocolors):
|
||||
Use [Chalk](https://github.com/chalk/chalk):
|
||||
|
||||
```js
|
||||
import ora from 'ora';
|
||||
import chalk from 'chalk';
|
||||
const ora = require('ora');
|
||||
const chalk = require('chalk');
|
||||
|
||||
const spinner = ora(`Loading ${chalk.red('unicorns')}`).start();
|
||||
```
|
||||
|
||||
### Why does the spinner freeze?
|
||||
|
||||
JavaScript is single-threaded, so any synchronous operations will block the spinner's animation. To avoid this, prefer using asynchronous operations.
|
||||
JavaScript is single-threaded, so synchronous operations blocks the thread, including the spinner animation. Prefer asynchronous operations whenever possible.
|
||||
|
||||
## Related
|
||||
|
||||
- [yocto-spinner](https://github.com/sindresorhus/yocto-spinner) - Tiny terminal spinner
|
||||
- [cli-spinners](https://github.com/sindresorhus/cli-spinners) - Spinners for use in the terminal
|
||||
|
||||
**Ports**
|
||||
|
||||
- [listr](https://github.com/SamVerschueren/listr) - Terminal task list
|
||||
- [CLISpinner](https://github.com/kiliankoe/CLISpinner) - Terminal spinner library for Swift
|
||||
- [halo](https://github.com/ManrajGrover/halo) - Python port
|
||||
- [spinners](https://github.com/FGRibreau/spinners) - Terminal spinners for Rust
|
||||
@@ -326,4 +260,5 @@ JavaScript is single-threaded, so any synchronous operations will block the spin
|
||||
- [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
|
||||
- [observablehq.com/@victordidenko/ora](https://observablehq.com/@victordidenko/ora) - Ora port to Observable notebooks
|
||||
- [spinnies](https://github.com/jcarpanelli/spinnies) - Terminal multi-spinner library for Node.js
|
||||
- [kia](https://github.com/HarryPeach/kia) - Simple terminal spinners for Deno 🦕
|
||||
|
||||
Reference in New Issue
Block a user