Skip to content

build(deps): replace ora with yocto-spinner - #369

Merged
dsanders11 merged 2 commits into
mainfrom
deps/replace-ora
Oct 27, 2026
Merged

dsanders11 merged 2 commits into
mainfrom
deps/replace-ora

Conversation

@claude

@claude claude Bot commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Requested by David Babenko-Sanders · Slack thread

This replaces ora with yocto-spinner for the CLI spinner in src/bin.ts, the same change as electron/docs-parser#214. yocto-spinner has one small dependency (yoctocolors), while ora brings in 17 packages besides chalk, so the published package's runtime dependency tree drops by a net 15 packages. This repo's yarn.lock actually grows by 2 entries for now, because the @electron/docs-parser@^2.0.0 devDependency still depends on ora; the ora tree will leave the lockfile once a docs-parser release that includes #214 is picked up. The API maps directly: ora(text).start() becomes yoctoSpinner({ text }).start(), .text = stays the same, .succeed() becomes .success() and .fail() becomes .error(). The generated electron.d.ts is byte-identical, and the TTY output looks the same apart from spinner frames. Piped (non-TTY) output is a little different: yocto-spinner prints each text update as its own line, so the "Generating API in directory" step now appears in CI logs, and it colors the status symbol unless NO_COLOR is set.


Generated by Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R1iLgtNj9JZPkuSQCZbGfR
@socket-security

socket-security Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedyocto-spinner@​1.2.26710010055100

View full report

@dsanders11

Copy link
Copy Markdown
Member

Cousin to electron/docs-parser#214 and we'll drop ora out of the lockfile once this repo picks up a newer release of @electron/docs-parser.

@dsanders11
dsanders11 marked this pull request as ready for review October 27, 2026 03:24
@dsanders11
dsanders11 requested review from a team as code owners October 27, 2026 03:24

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing blocking. The comments below are optional suggestions. There is no need to push a fix for them before merging.

Additional findings (outside the current diff — GitHub can't attach inline comments there):

  • 🟡 src/bin.ts — When generation fails in an interactive terminal, users may be left with a hidden cursor after the CLI exits, which does not happen on the base branch. The .catch handler calls console.error(err) and process.exit(1) while the spinner is still running. As I recall it, yocto-spinner only restores the cursor on SIGINT/SIGTERM, not on 'exit', while ora's cli-cursor/restore-cursor did. Fix: stop the spinner before exiting, e.g. runner.error(chalk.red('Failed to generate definitions')) and then console.error(err) and process.exit(1).

    Why this was flagged

    I could not install yocto-spinner here to check its source, so this assumes, from my reading of yocto-spinner 1.2.2, that start() hides the cursor with '\u001B[?25l' on a TTY and that its only restore hooks are process.once('SIGINT') and process.once('SIGTERM'). The trigger is any failure in generateDefinitions, JSON.parse or writeFile, for example a malformed --api JSON file. That error goes to the .catch at src/bin.ts:77-80, which calls process.exit(1) without stopping runner. Calling process.exit fires 'exit', not a signal, so with yocto-spinner the cursor stays hidden in the user's shell and the last spinner frame stays on the line in front of the error. On the base branch, ora 8 hides the cursor through cli-cursor, which registers restore-cursor's signal-exit onExit hook, so the cursor came back on process.exit(1). The two argv-error paths are not affected because runner.error() stops the spinner first.

    Verification: Trigger: generation fails while the CLI runs in an interactive terminal. The handler at src/bin.ts:77-80 runs console.error(err); process.exit(1); and never calls runner.stop() or runner.error(). On the base branch, restore-cursor registers an onExit hook that writes \u001B[?25h, so ora's hidden cursor comes back. Nothing runs on 'exit', so process.exit(1) leaves the cursor hidden.

yocto-spinner only restores the hidden cursor on SIGINT/SIGTERM, not on
process exit (ora did this via restore-cursor). Stop the spinner with an
error mark before exiting, and attach the handler to the outer promise
chain so read/parse failures of the --api file are covered too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R1iLgtNj9JZPkuSQCZbGfR
@claude

claude Bot commented Oct 27, 2026

Copy link
Copy Markdown
Contributor Author

Confirmed the cursor-restore finding (in a pseudo-TTY, a failing run left the cursor hidden with yocto-spinner but not with ora) and fixed it in 3eceda3 by stopping the spinner with an error mark before exiting; the handler now also covers read/parse failures of the --api file.


Generated by Claude Code

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review found no issues

No high-confidence issues detected in this change.

@erickzhao erickzhao left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure :)

@dsanders11
dsanders11 merged commit 8e90242 into main Oct 27, 2026
13 checks passed
@dsanders11
dsanders11 deleted the deps/replace-ora branch October 27, 2026 20:31
@electron-npm-package-publisher

Copy link
Copy Markdown

🎉 This PR is included in version 10.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants