Commit activity
Last 12 weeks · 1 commit
Community health
4 of 6 standards met
Recent PRs & issues
Description Ora's mutable and flags can prevent completion methods from restoring state that changed. currently returns before calling when is true, leaving the animation interval active. Separately, only restores the cursor when is currently true, so disabling output after can leave the cursor hidden. Steps to reproduce Expected behavior Completion methods always stop the spinner and restore terminal state, while silent mode suppresses persisted output rather than lifecycle cleanup. Actual behavior can leave , and can skip cursor restoration after is changed. A focused fix now tracks whether hid the cursor and calls before the silent-output early return. Regression tests for both cases pass locally. I searched existing issues and pull requests for these state transitions and did not find a matching report.
computes how many terminal rows the current text wraps to using at the moment it runs, and caches the result in . It's only ever called from the // / setters — never in response to a terminal resize. (called at the top of every , i.e. every animation frame) uses that cached to move the cursor up and erase the previous frame. If the terminal is resized while the spinner is running and the text is long enough to wrap across multiple rows, the actual wrapped row count changes but the cached one doesn't — so every subsequent erases the wrong region of the screen. This isn't a one-frame glitch: since is never recomputed for the rest of that spinner's life, the desync is permanent and can progressively corrupt unrelated terminal content above/around the spinner. Repro Observed: subsequent frames overwrite/interleave fragments of the message into adjacent rows instead of cleanly redrawing in place. Environment ora 8.2.0 Found via @sourcegraph/cody's (real-world discovery), reproduced directly against ora in isolation Windows 11, ConPTY-backed terminal — the bug itself isn't Windows-specific (it's pure line-math), but I haven't personally reproduced on macOS/Linux Suggested fix Recompute from the current inside right before using it (or listen for the stream's event while spinning and call then), rather than relying on a value cached at the last //etc. assignment.
Recent fixes
Recently, projects that were compliable using broke because of a breaking change that escaped into a patch. I imagine this was a simple mistake, so I'm just letting you know. The commit bc3a283 changed the interface in a breaking matter by widening the function, and already implemented functions were not ready to handle the broader inputs.
Removed from -> the test suite uses Node.js built-in , not ava (drops 115 packages from the dev dependency tree) Fixed option default in readme -> was (looks like a string literal) now (property reference) matching / style Test plan [x] passes [x] passes [x] confirms ava removal drops 115 packages Doesnt close any specific issue
While using the types, I hit two cases where the type definitions disagree with what actually does. allows , but the setter rejects it is typed as on both and the interface, so type-checks. At runtime the setter throws for anything that is not a valid color or : So this compiles but throws: is meaningful (it disables the color), but is not a valid value. This narrows the type to in both places. / on the interface drop the function form On the interface, and are typed as , but the implementation resolves a function by calling it: The JSDoc on both members already says "text or function that returns text", the / types are already exported, and and already use / . Only the interface members were left as plain , so assigning a function to is a type error even though it works at runtime. This widens them to match. Tests Added assertions for the rejected and for the function forms of /.
Repository: sindresorhus/ora. Description: Elegant terminal spinner Stars: 9769, Forks: 294. Primary language: JavaScript. Languages: JavaScript (97%), TypeScript (3%). License: MIT. Latest release: v9.4.1 (4mo ago). Open PRs: 0, open issues: 2. Last activity: 1mo ago. Community health: 85%. Top contributors: sindresorhus, stroncium, jeetiss, SamVerschueren, BendingBender, tommy-mitchell, agusayerza, aminya, parro-it, andygrunwald and others.